yzane / vscode-markdown-pdf

Markdown converter for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=yzane.markdown-pdf
Other
974 stars 202 forks source link

[BUG] Mermaid Diagrams Not Rendered in Exported PDF #342

Open emmett08 opened 9 months ago

emmett08 commented 9 months ago

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:

  1. Create or open a Markdown file (.md) containing a fenced code block with the mermaid language identifier.
    graph TD;
       A-->B;
       A-->C;
       B-->D;
       C-->D;
  2. Execute the command Markdown PDF: Export (pdf) from the VSCode command palette.
  3. 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.

emmett08 commented 9 months ago

Link to https://github.com/yzane/vscode-markdown-pdf/issues/337

cajun-code commented 6 months ago

I found changing the mermaid server to "https://cdn.jsdelivr.net/npm/mermaid@10.4.0/dist/mermaid.min.js" worked to fix the issue.

cabal95 commented 6 months ago

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/mermaid@9.4.3/dist/mermaid.min.js which is the most recent v9 release and everything seems to work well.

sanurielf commented 5 months ago

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/mermaid@9.4.3/dist/mermaid.min.js which is the most recent v9 release and everything seems to work well.

Thanks, only this version worked for me.

thewingit commented 5 months ago

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.

megaromb commented 4 months ago

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.

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?

hobbes1069 commented 3 months ago

Running into a similar problem here, my erDiagrams are not rendering in either 9.4.3 or 10.4.0.