Skip to content

Weird Bug: mermaid config option breaks OJS #14765

Closed

Description

@dasayan05

Bug description

Just stumbled upon a weird bug. Maybe I'm missing something. Found this while working on a larger project. Managed to narrow down to a minimal example. I am just reporting my observation -- I didn't investigate further.

When I have config: ... option for mermaid code block, the OJS breaks.

Steps to reproduce

Run this simple test.qmd file

---
title: "Test"
date: "2026-08-10"
format: html
---

```{mermaid}
graph LR
    A --> B
```

```{ojs}
//| echo: true
x = 2
x ** 5
```

with quarto preview test.qmd.

Now run it with a config option in the mermaid block (everything else stays same)

---
title: "Test"
date: "2026-08-10"
format: html
---

```{mermaid}
---
config:
    look: handDrawn
---
graph LR
    A --> B
```

```{ojs}
//| echo: true
x = 2
x ** 5
```

In the second case, the ojs block stops executing -- it becomes just code.

Actual behavior

Left: Without, Right: With the mermaid option
(OJS breaks; although the mermaid option takes correct effect)

quarto preview with everything works as usual quarto preview with the ojs block not showing as usual

There's no error whatsoever.

Expected behavior

The OJS block shouldn't be affected by mermaid's option.

Your environment

Quarto 1.9.38
[✓] Checking environment information...
      Quarto cache location: /Users/k2692978/Library/Caches/quarto
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.8.3: OK
      Dart Sass version 1.87.0: OK
      Deno version 2.4.5: OK
      Typst version 0.14.2: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.9.38
      Path: /Users/k2692978/Applications/quarto/bin

[✓] Checking tools....................OK
      TinyTeX: (not installed)
      Chromium: (not installed)
      Chrome Headless Shell: (not installed)
      VeraPDF: (not installed)

[✓] Checking LaTeX....................OK
      Tex:  (not detected)

[✓] Checking Chrome Headless....................OK
      Using: Chrome found on system
      Path: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
      Source: MacOS known location

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

[✓] Checking R installation...........OK
      Version: 4.6.1
      Path: /Library/Frameworks/R.framework/Resources
      LibPaths:
        - /Users/k2692978/Library/R/arm64/4.6/library
        - /Library/Frameworks/R.framework/Versions/4.6/Resources/library
      knitr: 1.51
      rmarkdown: 2.31

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

[✓] Checking Python 3 installation....OK
      Version: 3.9.6
      Path: /Library/Developer/CommandLineTools/usr/bin/python3
      Jupyter: (None)

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

[✓] Checking Julia installation...

Activity

  1. transferred this issue fromquarto-dev/quartoon Aug 12, 2026
  2. mcanouil commented on Aug 12, 2026

    @mcanouil
    Collaborator

    That's basically a parsing issue of the mermaid block related to the use of ---.
    Meanwhile, the workaround is to use inline syntax from mermaid %%{init: ...}.

    The issue is unrelated to OJS, whatever comes after is broken.

    Adding keep-md: true show the bare and alone --- with no empty lines around.

    ---
    title: "Test"
    format: html
    keep-md: true
    ---
    
    
    ::::::{.cell layout-align="default"}
    
    :::::{.cell-output-display}
    
    ::::{}
    `<figure class=''>`{=html}
    
    :::{}
    
    <pre class="mermaid mermaid-js">---
    config:
        look: handDrawn
    ---
    graph LR
        A --&gt; B
    </pre>
    :::
    `</figure>`{=html}
    ::::
    :::::
    ::::::
    
    ::::::{.cell}
    
    ```{.js .cell-code startFrom="20" source-offset="-0"}
    x = 2
    x ** 5
    ```
    
    :::::{.cell-output .cell-output-display}
    
    ::::{}
    
    :::{#ojs-cell-1-1 nodetype="declaration"}
    :::
    ::::
    :::::
    
    :::::{.cell-output .cell-output-display}
    
    ::::{}
    
    :::{#ojs-cell-1-2 nodetype="expression"}
    :::
    ::::
    :::::
    ::::::
  3. self-assigned this
    on Aug 12, 2026
  4. mcanouil commented on Aug 12, 2026

    @mcanouil
    Collaborator

    @dasayan05

    Important

    Accessibility: To improve accessibility, please add alternative text to your screenshots. This helps all users, including those using screen readers, to understand the context of the images. A brief description can make a big difference! See Good Alt Text, Bad Alt Text — Making Your Content Perceivable.

  5. mcanouil commented on Aug 12, 2026

    @mcanouil
    Collaborator

    PR is up for the team to review, i.e., enclose mermaid code inside raw HTML block so --- are not treated as markdown.

  6. dasayan05 commented on Aug 13, 2026

    @dasayan05
    Author

    ah, I had the same feeling that it was the ---.

    thanks for the fix.

  7. added this to the v1.11 milestone on Oct 19, 2026
  8. added a commit that references this issue on Oct 19, 2026
    da49117
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingdiagrams-mermaidMermaid diagrams

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions