You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
🪲 pri/majorBugs will affect your normal use of Mark Text, causing you unwilling or unable to continue using MT🐿️ markdown/extensionThis issue will extend the markdown specification (unofficial)🕊️ export/pdfIssue about exporting to PDF or printing🐛 bugSomething isn't working
Whenever I export a mermaid graph with headers enabled, the content is replaced by black boxes without arrows.
When I turn the header above it off, the rendering works perfectly again.
Can you reproduce the issue?
Steps to reproduce
Make a mermaid graph in MarkText
Export to PDF menu
Add a header
Finish export
Expected behavior:
Render the Mermaid graph in its location.
Actual behavior:
Black boxes and shown above. I'm also not sure, but it seems some text might also disappear:
The buffer headers don't end up in the final PDF at all. I feel, especially with the header being part of the issue, this is related to the page break.
This is a minimal reproduction file for me: Reproduce.md containing only:
flowchart LR
example --> example
Loading
resulting in:
and without adding an export header resulting in:
Fixed on the current develop (upcoming 0.20.0) by #4805 — this is the same defect as #3359, which you correctly suspected in your first comment.
Root cause. The Header & Footer branch of the exporter re-sanitized the whole already-rendered document with DOMPurify. That config strips the <foreignObject> elements mermaid draws its node labels into, so enabling a header mangled every diagram; the branch without a header never re-sanitized, which is exactly the asymmetry you described. #4805 sanitizes only the user-supplied header/footer text fields and leaves the rendered article untouched.
Verified on today's build (macOS, Electron 42), driving the real export pipeline end to end:
Your Reproduce.md verbatim, exported to PDF with a three-cell header: the flowchart renders with its example label and its arrow, pixel-identical to the same export without a header.
A larger document (flowchart + sequence + class diagram) that spans two pages: the header repeats on both pages and all three diagrams render intact, including the one after the page break.
Counter-proof: putting the pre-fix(desktop): keep diagram content when exporting with Header & Footer #4805sanitize(...) call back into exportHtml.ts and rebuilding reproduces the defect on today's code — the <foreignObject> count in the exported HTML drops from 12 to 0 and the node renders as an empty box.
Regression coverage lives in packages/desktop/test/unit/specs/export-header-footer-diagram.spec.ts.
Closing as fixed. If you still hit this on 0.20.0, please reopen with the document.
🪲 pri/majorBugs will affect your normal use of Mark Text, causing you unwilling or unable to continue using MT🐿️ markdown/extensionThis issue will extend the markdown specification (unofficial)🕊️ export/pdfIssue about exporting to PDF or printing🐛 bugSomething isn't working
Activity
Omnieboer commentedon Nov 15, 2022
I think #3359 might be the same issue, but the description wasn't clear enough to be sure.
4lpMeunier commentedon Jun 30, 2026
I do experience the same issue on v0.17.1 on Linux version.
Jocs commentedon Sep 24, 2026
Fixed on the current
develop(upcoming 0.20.0) by #4805 — this is the same defect as #3359, which you correctly suspected in your first comment.Root cause. The Header & Footer branch of the exporter re-sanitized the whole already-rendered document with DOMPurify. That config strips the
<foreignObject>elements mermaid draws its node labels into, so enabling a header mangled every diagram; the branch without a header never re-sanitized, which is exactly the asymmetry you described. #4805 sanitizes only the user-supplied header/footer text fields and leaves the rendered article untouched.Verified on today's build (macOS, Electron 42), driving the real export pipeline end to end:
Reproduce.mdverbatim, exported to PDF with a three-cell header: the flowchart renders with itsexamplelabel and its arrow, pixel-identical to the same export without a header.sanitize(...)call back intoexportHtml.tsand rebuilding reproduces the defect on today's code — the<foreignObject>count in the exported HTML drops from 12 to 0 and the node renders as an empty box.Regression coverage lives in
packages/desktop/test/unit/specs/export-header-footer-diagram.spec.ts.Closing as fixed. If you still hit this on 0.20.0, please reopen with the document.
Add a zoom/pan viewer and image export for rendered diagrams (#5554)