Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
emmett08 opened this issue Oct 25, 2023 · 7 comments
Open

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

emmett08 opened this issue Oct 25, 2023 · 7 comments

Comments

@emmett08
Copy link

emmett08 commented Oct 25, 2023

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 emmett08 changed the title [FEATURE] Request MermaidJs diagram rendering [BUG] Mermaid Diagrams Not Rendered in Exported PDF Oct 25, 2023
@emmett08
Copy link
Author

Link to #337

@cajun-code
Copy link

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
Copy link

cabal95 commented Jan 19, 2024

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
Copy link

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
Copy link

thewingit commented Feb 20, 2024

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
Copy link

megaromb commented Mar 14, 2024

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?

@hobbes1069
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants