Add Mermaid diagram support - #5
Merged
Merged
Conversation
Render ```mermaid / ```mmd fences to SVG with mermaid-rs-renderer and embed them as virtual Typst assets, keeping PDF generation browser-free. Co-authored-by: Thomas <0xtlt@users.noreply.github.com>
Typst resolves a single SVG font family, so use the embedded DejaVu face instead of the Mermaid Inter/system stack that would drop diagram labels. Co-authored-by: Thomas <0xtlt@users.noreply.github.com>
Crop excess Mermaid canvas padding and size SVGs from CSS pixels into the printable page box so diagrams are neither tiny nor oversized. Co-authored-by: Thomas <0xtlt@users.noreply.github.com>
Use denser CSS-pixel conversion and a tighter page box so diagrams stay closer to body-text size instead of dominating the page. Co-authored-by: Thomas <0xtlt@users.noreply.github.com>
Keep simple diagrams compact, but let large charts use more of the page so architecture and sequence labels stay readable in print. Co-authored-by: Thomas <0xtlt@users.noreply.github.com>
Co-authored-by: Thomas <0xtlt@users.noreply.github.com>
Include polygon/circle/ellipse bounds, skip tiny marker arrowheads, and avoid expanding already-tight SVGs. Add a diamond flowchart regression test. Co-authored-by: Thomas <0xtlt@users.noreply.github.com>
Match whole attribute names, skip tiny marker circles, clamp crop size to the original canvas, and add a padded-diamond crop regression test. Co-authored-by: Thomas <0xtlt@users.noreply.github.com>
Regenerate docs/assets/preview.png from the current example.md so the README screenshot shows the Mermaid diagram section. Co-authored-by: Thomas <0xtlt@users.noreply.github.com>
Keep diagrams on Mermaid's classic light theme so they match the light page background instead of following the dark code-block theme. Refresh the README preview. Co-authored-by: Thomas <0xtlt@users.noreply.github.com>
Use --code-theme light for the example screenshot so code blocks and Mermaid diagrams both sit on a light page without dark panels. Co-authored-by: Thomas <0xtlt@users.noreply.github.com>
Hard-code the classic light Mermaid colors (independent of --code-theme), rewrite any dark canvas background that leaks through, and replace the README preview asset path so GitHub/CDN cannot keep serving the old dark diagram image. Co-authored-by: Thomas <0xtlt@users.noreply.github.com>
0xtlt
marked this pull request as ready for review
July 29, 2026 13:00
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
md2pdf previously treated
mermaidfences as plain code. This PR adds in-process Mermaid rendering so diagrams appear as images in the PDF.mermaid/mmdfenced blocks during Markdown conversionmermaid-rs-renderer(pure Rust, no browser/Node)DejaVu Sansso Typst can render diagram labels with embedded fonts--code-theme) so diagrams match the light PDF pageReview follow-ups included
xvsrx,widthvsstroke-width)preview-v2.png) so the old dark diagram image is not served from CDNTesting
cargo fmt --checkcargo clippy --all-targets --locked -- -D warningscargo test --locked--code-theme dark