Skip to content

Mermaid chart in Quarto document doesn't render to pdf #13569

Closed as duplicate

Description

@Laszlo75

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

I have a mermaid chart in a quarto document. The document renders to html without issues, but the chromium crashes when I am trying to render it to pdf (Latex or Typst).

Steps to reproduce

```{mermaid}
flowchart TB
A[A] --> B[B]
```

Actual behavior

Internal Error: "Couldn't find an svg element in svg string" when rendering Mermaid diagram into pdf

Description: When attempting to render a simple Mermaid flowchart in a Quarto document to pdf, the rendering fails with an internal error about missing SVG element.

Environment:
Quarto version: 1.7.32
Platform: macOS 26.0.1 (Build 25A362)
Application: Positron.app (bundled Quarto)
Quarto binary path: /Applications/Positron.app/Contents/Resources/app/quarto/bin/quarto.js

Actual Behavior:
Rendering fails with the following error:

ERROR: Internal Error: Couldn't find an svg element in svg string Stack trace: at resolveSize (file:///Applications/Positron.app/Contents/Resources/app/quarto/bin/quarto.js:83281:15) at eventLoopTick (ext:core/01_core.js:175:7) at async makePng (file:///Applications/Positron.app/Contents/Resources/app/quarto/bin/quarto.js:83624:55) at async makeDefault (file:///Applications/Positron.app/Contents/Resources/app/quarto/bin/quarto.js:83676:24) at async Object.cell (file:///Applications/Positron.app/Contents/Resources/app/quarto/bin/quarto.js:83699:20) at async Promise.all (index 0) at async Object.document (file:///Applications/Positron.app/Contents/Resources/app/quarto/bin/quarto.js:39507:25) at async handleLanguageCells (file:///Applications/Positron.app/Contents/Resources/app/quarto/bin/quarto.js:39477:42) at async file:///Applications/Positron.app/Contents/Resources/app/quarto/bin/quarto.js:87066:51 at async withTimingAsync (file:///Applications/Positron.app/Contents/Resources/app/quarto/bin/quarto.js:17114:25)

Additional Context:

The error occurs in the resolveSize function when attempting to create a PNG from the Mermaid diagram. The stack trace suggests:

  1. Mermaid is generating output that doesn't contain a valid SVG element
  2. The makePng function is trying to process this output
  3. The resolveSize function fails to find an <svg> element in the string

Expected behavior

The Mermaid diagram should render successfully as a flowchart with two nodes (A and B) connected by an arrow.

Your environment

Positron Version: 2025.10.1 build 4
Code - OSS Version: 1.103.0
Commit: b13dd1ca4803bc04a4a9165395b589b8caf4ab58
Date: 2025-10-14T21:43:42.876Z
Electron: 37.2.3
Chromium: 138.0.7204.100
Node.js: 22.17.0
V8: 13.8.500258-electron.0
OS: Darwin arm64 25.0.0

Quarto check output

Quarto 1.7.32
[✓] Checking environment information...
Quarto cache location: /Users/laszlo/Library/Caches/quarto
[✓] Checking versions of quarto binary dependencies...
Pandoc version 3.6.3: OK
Dart Sass version 1.85.1: OK
Deno version 1.46.3: OK
Typst version 0.13.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
Version: 1.7.32
Path: /Applications/Positron.app/Contents/Resources/app/quarto/bin

[✓] Checking tools....................OK
TinyTeX: v2025.10
Chromium: 869685

[✓] Checking LaTeX....................OK
Using: TinyTex
Path: /Users/laszlo/Library/TinyTeX/bin/universal-darwin
Version: 2025

[✓] Checking Chrome Headless....................OK
Chrome: (not detected)

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
Version: 3.13.5
Path: /usr/local/bin/python3
Jupyter: (None)

  Jupyter is not available in this Python installation.
  Install with python3 -m pip install jupyter

[✓] Checking R installation...........OK
Version: 4.5.1
Path: /Library/Frameworks/R.framework/Resources
LibPaths:
- /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/library
knitr: 1.50
rmarkdown: 2.30

[✓] Checking Knitr engine render......OK

Activity

  1. added
    bug
    on Oct 16, 2025
  2. cderv commented on Oct 16, 2025

    @cderv
    Member

    Duplicate of

    This is related to your chromium version. I'll close and you can follow up in the other issue.

    Though,

    • Quarto 1.7.32 => please update to latest stable 1.8
    • Chromium: 869685 => do uninstall the quarto install chromium binary by doing quarto uninstall chromium

    as it is broken with new logic. We'll fix it in 1.9.

  3. added
    duplicate
    on Oct 16, 2025
  4. removed
    bug
    on Oct 16, 2025
  5. Laszlo75 commented on Oct 17, 2025

    @Laszlo75
    Author

    Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicate

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions