rapier-markdown-kit 1.2.56 → 1.2.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -419,6 +419,7 @@ export function mountHtmlBlocks(doc, options = {}) {
|
|
|
419
419
|
if (++count > 512) throw new Error('HTML node budget exceeded');
|
|
420
420
|
const tag = el.localName.toLowerCase();
|
|
421
421
|
if (!allowed.has(tag)) {el.remove(); continue;}
|
|
422
|
+
if (el.namespaceURI === 'http://www.w3.org/1999/xhtml' && el.parentNode?.namespaceURI === 'http://www.w3.org/2000/svg') {el.remove(); continue;}
|
|
422
423
|
if (tag === 'style') el.textContent = css(el.textContent);
|
|
423
424
|
if (el.hasAttribute('style')) el.setAttribute('style', css(el.getAttribute('style')));
|
|
424
425
|
for (const attr of [...el.attributes]) {
|
|
@@ -451,10 +452,10 @@ export function mountHtmlBlocks(doc, options = {}) {
|
|
|
451
452
|
if (/<!\s*(?:DOCTYPE|ENTITY)\b/i.test(svgText)) throw new Error('SVG declarations are unsupported');
|
|
452
453
|
const parsed = new win.DOMParser().parseFromString(svgText, 'image/svg+xml');
|
|
453
454
|
if (parsed.querySelector('parsererror') || parsed.documentElement.localName !== 'svg') throw new Error('Invalid SVG image');
|
|
454
|
-
const svg =
|
|
455
|
+
const inert = template.content.ownerDocument, svg = inert.importNode(parsed.documentElement, true);
|
|
455
456
|
if (el.getAttribute('style')) svg.setAttribute('style', el.getAttribute('style'));
|
|
456
457
|
for (const key of ['width','height','class','id']) if (el.hasAttribute(key)) svg.setAttribute(key, el.getAttribute(key));
|
|
457
|
-
const holder =
|
|
458
|
+
const holder = inert.createElement('div'); holder.append(svg); walk(holder); el.replaceWith(svg); continue;
|
|
458
459
|
}
|
|
459
460
|
el.setAttribute(name, info.first ? 'data:image/gif;base64,' + media.encode(info.first) : url);
|
|
460
461
|
if (info.animated) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rapier-markdown-kit",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.57",
|
|
4
4
|
"description": "Read, render and write Self-contained Markdown: one .md file that carries its pictures, drawings and layout, and that any Markdown app can read. HTML renderer, stylesheet, text layout, Will/1 agent permissions, and an edit history with authorship and offline merge. MIT, no dependencies.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"markdown",
|