fix(md to pdf): restore mermaid flowchart node labels. Fixes #738

This commit is contained in:
Mondeep Chetry committed 2026-06-04 17:18:51 +05:30
1 parent ac3ad68b56
commit e1843e17b3
2 files changed
+78 -3

No files matched your search

+5 -3
View File
@@ -299,6 +299,7 @@ export class MarkdownEditor {
startOnLoad: false,
theme: 'default',
securityLevel: 'strict',
htmlLabels: false,
fontFamily:
'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
});
@@ -717,9 +718,10 @@ export class MarkdownEditor {
const wrapper = document.createElement('div');
wrapper.className = 'mermaid-diagram';
wrapper.innerHTML = DOMPurify.sanitize(svg, {
USE_PROFILES: { svg: true, svgFilters: true },
});
// Mermaid already sanitizes SVG at securityLevel: 'strict' (including
// foreignObject HTML labels). A second DOMPurify pass with the SVG-only
// profile strips those labels and leaves empty flowchart nodes.
wrapper.innerHTML = svg;
pre.replaceWith(wrapper);
} catch (error) {