-
Notifications
You must be signed in to change notification settings - Fork 389
Several mermaid-format: svg edge-cases improvement
#13702
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
Open
cderv
wants to merge
17
commits into
main
Choose a base branch
from
fix/mermaid-svg-beamer-13661
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+492
−33
Conversation
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
Test expects SVG files to be used directly via \includesvg without HTML script tags in LaTeX output. This test should fail initially because setupMermaidSvgJsRuntime() adds script tags that break LaTeX compilation.
It is `image.src`
The warning was shown for all non-JavaScript formats (PDF, LaTeX, Beamer, DOCX, Typst), but only PDF/LaTeX/Beamer require external tooling (rsvg-convert or Inkscape). DOCX and Typst handle SVG natively. Changed mermaid.ts to use isLatexOutput() instead of !isJavascriptCompatible().
This reverts commit 64a810c.
SVG format without JavaScript postprocessing may have text clipping issues with multi-line labels. LaTeX-based formats additionally require external tooling (rsvg-convert or Inkscape). Updated mermaid.ts to emit comprehensive warnings for non-JavaScript formats. Test coverage: - LaTeX test verifies both clipping + tooling warnings - DOCX test verifies clipping warning only - Manual testing checklist for full validation
and add mention of limitations
Migrates SVG to PDF conversion tests from smoke-all to smoke tests with conditional execution based on rsvg-convert availability.
Old smoke-all tests couldn't conditionally test based on tool availability or verify proper error messages.
New test structure:
- Test 1: With rsvg-convert - verifies successful SVG→PDF conversion
- Test 2: Without rsvg-convert, with pre-converted PDF - uses existing PDF, verifies warning message
- Test 3: Without rsvg-convert, no PDF - verifies warning and LaTeX \includesvg usage
Uses which('rsvg-convert') to conditionally run tests based on tool availability.
mermaid-format: svg edge-cases improvement
Collaborator
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
- Add skip-on-os metadata field (string or array of OS names) - Rename skipTestOnCi() to skipTest() for broader scope - Skip mermaid SVG tests on Linux (Puppeteer/Chrome environment issue) Tests skipped on Linux (all timeout after 10 minutes): - tests/docs/smoke-all/2025/11/10/13661.qmd (LaTeX) - tests/docs/smoke-all/2025/11/14/mermaid-svg-docx.qmd (DOCX) - tests/docs/smoke-all/2025/11/18/mermaid-gfm-svg.qmd (GFM) These tests pass on Windows. Linux support will be tracked in a separate issue to investigate Puppeteer/headless Chrome setup.
Eliminates duplicate metadata retrieval by having skipTest() return the skip reason (string) instead of boolean. Cleaner and more efficient.
Follows codebase pattern for OS detection.
Replaces separate string/array handling with asArray helper.
Adds documentation for the new skip-on-os metadata field that allows skipping smoke-all tests on specific operating systems.
Collaborator
Author
OS-Specific Test Filtering AddedAdded What was added:
Tests skipped on Linux:
All tests pass on Windows. Linux support tracked in #13704. |
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.
This closes #13661
Looking into how
mermaid-format: svgcurrently work for various format leads to this PR:rsvg-convertlogic needs rsvg-convert tool.mermaid-format: svgin other context that HTML rendering is prone to problem (especially in LaTeX / Beamer)<script>tag being included always even when we decided to load the .svg with<img>tag. Probably we'll need to revisitmermaid-format: svgresults in clipping of diagrams #1622 and maybe usemermaid-clito create the PNG or SVG file.