-
Notifications
You must be signed in to change notification settings - Fork 408
Description
I have:
- searched the issue tracker for similar issues
- installed the latest version of Quarto CLI
- formatted my issue following the Bug Reports guide
Bug description
mermaid-format: svg does not work for format: pdf or format: typst. Instead of using Chromium to render the mermaid diagram to an SVG image file, the diagram is rendered as inline HTML/SVG via deno-dom and the raw HTML — including <script> tags — is passed into the .tex / .typ file, causing compilation to fail.
mermaid-format: png works correctly — Chromium renders the diagram to a PNG image which is properly embedded.
Steps to reproduce
---
title: "Mermaid Test"
format:
pdf:
mermaid-format: svg
---
```{mermaid}
flowchart LR
A[Start] --> B{Decision}
B -->|Yes| C[Action 1]
B -->|No| D[Action 2]
C --> E[End]
D --> E
```quarto render mermaid_test.qmd --to pdfAlso fails with format: typst and mermaid-format: svg.
Note: Replacing mermaid-format: svg with mermaid-format: png renders successfully. rsvg-convert is installed and available on PATH (rsvg-convert version 2.40.20).
Actual behavior
LaTeX (format: pdf):
! LaTeX Error: Missing \begin{document}.
l.109 <
script src="mermaid_test_files/libs/quarto-diagram/mermaid-postprocess...
The .tex file contains raw HTML <script> tags and inline SVG elements instead of \includegraphics{} referencing a rendered SVG/PDF image.
Typst (format: typst):
error: unclosed label
┌─ mermaid_test.typ:281:0
│
281 │ <script src="mermaid_test_files/libs/quarto-diagram/mermaid-postprocess-shim.js"></script>
│ ^^^^^^^
Debug output (--log-level DEBUG) with mermaid-format: svg shows:
[CHROMIUM] Found Chromium on OS known location/Path: C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe— detected but never launched for SVG rendering.- Mermaid rendered via
deno-dom-native(JS/HTML path) producing inline SVG. - Pandoc logs hundreds of
[INFO] Not rendering RawInline (Format "html")— raw HTML passed to LaTeX/Typst writer.
In contrast, with mermaid-format: png:
Chromium is properly invoked, the diagram is rendered as a PNG image, and the trace shows [trace] Parsed [Para [Image ("",[],[("width","6.27in"),("height","1.81in"),... — a proper image element. PDF compiles successfully.
Expected behavior
With mermaid-format: svg, Quarto should:
- Use Chromium to render the mermaid diagram to an SVG image file
- Convert the SVG to PDF via
rsvg-convertorinkscape(as documented) - Embed the image via
\includegraphics{}(LaTeX) orimage()(Typst)
Per the Quarto diagrams docs, valid values for mermaid-format include js, png, and svg.
Your environment
- IDE: Cursor
- OS: Windows 11
- Quarto installed via Chocolatey
rsvg-convertversion 2.40.20 available on PATH
Quarto check output
❯ quarto check
Quarto 1.8.27
[>] Checking environment information...
Quarto cache location: C:\Users\msameer.abbas\AppData\Local\quarto
[>] Checking versions of quarto binary dependencies...
Pandoc version 3.6.3: OK
Dart Sass version 1.87.0: OK
Deno version 2.3.1: OK
Typst version 0.13.0: OK
[>] Checking versions of quarto dependencies......OK
[>] Checking Quarto installation......OK
Version: 1.8.27
Path: C:\ProgramData\chocolatey\lib\quarto\tools\bin
CodePage: 1252
[>] Checking tools....................OK
TinyTeX: v2026.02
Chromium: 869685
[>] Checking LaTeX....................OK
Using: TinyTex
Path: C:\Users\msameer.abbas\AppData\Roaming\TinyTeX\bin\windows\
Version: 2025
[>] Checking Chrome Headless....................OK
Using: Chrome found on system
Path: C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe
Source: Windows Registry
[>] Checking basic markdown render....OK
[>] Checking Python 3 installation....(None)
Unable to locate an installed version of Python 3.
Install Python 3 from https://www.python.org/downloads/
[>] Checking R installation...........(None)
Unable to locate an installed version of R.
Install R from https://cloud.r-project.org/