vscode-markdown-pdf
vscode-markdown-pdf copied to clipboard
[BUG] Mermaid Diagrams Not Rendered in Exported PDF
Description: When attempting to export a Markdown file containing Mermaid diagrams to PDF using the "Markdown PDF" extension in VSCode, the resulting PDF does not render the Mermaid diagrams. Instead, it displays the raw Mermaid code.
Reproduction Steps:
- Create or open a Markdown file (
.md
) containing a fenced code block with themermaid
language identifier.graph TD; A-->B; A-->C; B-->D; C-->D;
- Execute the command
Markdown PDF: Export (pdf)
from the VSCode command palette. - Review the exported PDF.
Expected Behaviour: The PDF should display a rendered Mermaid diagram corresponding to the code in the Markdown file.
Actual Behaviour: The PDF displays the raw Mermaid code instead of the rendered diagram.
Link to https://github.com/yzane/vscode-markdown-pdf/issues/337
I found changing the mermaid server to "https://cdn.jsdelivr.net/npm/[email protected]/dist/mermaid.min.js" worked to fix the issue.
I had other issues with every mermaid 10.x release. Some failed to render completely, some had syntax errors. Mermaid v10 had a number of breaking changes, so maybe that is the reason for the problems. I switched to https://unpkg.com/[email protected]/dist/mermaid.min.js
which is the most recent v9 release and everything seems to work well.
I had other issues with every mermaid 10.x release. Some failed to render completely, some had syntax errors. Mermaid v10 had a number of breaking changes, so maybe that is the reason for the problems. I switched to
https://unpkg.com/[email protected]/dist/mermaid.min.js
which is the most recent v9 release and everything seems to work well.
Thanks, only this version worked for me.
Same for me! Mermaid v9.4.3 is also working on my end.
EDIT: In VS code, you have to edit the markdown-pdf.mermaidServer
setting.
unfortunately, neither the default, nor 10.4.0, nor 9.4.3 server renders my sequence diagram
, which is displayed fine in preview with Markdown Preview Mermaid Support
extension.
- the default one (latest?) just shows mermaid code as is
- 9.4.3 and 10.4.0 show the image with message about syntax or graph error
P.S. there is logging in the source code, but I didn't see any log files at %USERPROFILE%\.vscode\extensions\yzane.markdown-pdf-1.5.0
. excuse me for noob's question (never coded extensions for VS Code), where to find the logs just to help all of us with troubleshooting?
Running into a similar problem here, my erDiagram
s are not rendering in either 9.4.3 or 10.4.0.
I found changing the mermaid server to "https://cdn.jsdelivr.net/npm/[email protected]/dist/mermaid.min.js" worked to fix the issue.
As of today, this solution worked for me. Thanks
It works, but seems like it's only working for 'mature' components.
block-beta
is working in Markdown Preview, but not in PDF export.
With https://cdn.jsdelivr.net/npm/[email protected]/dist/mermaid.min.js (and 10.7) and https://cdn.jsdelivr.net/npm/[email protected]/dist/mermaid.min.js" the output is