Skip to content

Transcluded Mermaid diagrams get mangled if there is indentation #1414

Description

Describe the bug

If I ![[transclude]] a document with a mermaid diagram, there seems to be so mangling of greater-than symbols to HTML entities that is connected to indentation in a way I can't quite parse. Is this documented somewhere, so I can know how to avoid it reliably? My solution right now is just not to use indentation in my Mermaid code fences, which is fine enough I guess. Feel free to close this if you think that's enough.

Small Reproducible Example

No response

Steps to Reproduce the Bug or Issue

File src.md:

This is the src.

Transclusion:

![[dst]]

File dst.md (using quad-backticks for this outer fence):

This works:
```mermaid
flowchart LR
A --> B
```

This also works:
```mermaid
flowchart LR
    A --> B
```

This does not:
```mermaid
flowchart LR

    A --> B
```

This is now garbled because the previous:
```mermaid
flowchart LR
A --> B
```

I get this preview for src.md:
image

Expected behavior

Transclusion should look like this:

image

Screenshots or Videos

No response

Operating System Version

Win 10 Enterprise

Visual Studio Code Version

Version: 1.82.2 (system setup) Commit: abd2f3db4bdb28f9e95536dfa84d8479f1eb312d Date: 2023-09-14T05:55:25.390Z Electron: 25.8.1 ElectronBuildId: 23779380 Chromium: 114.0.5735.289 Node.js: 18.15.0 V8: 11.4.183.29-electron.0 OS: Windows_NT x64 10.0.19045

Additional context

Some maybe relevant installed extensions:

  • Foam
  • Markdown All in One (Yu Zhang)
  • Markdown Extended (jebbs, kbd plugin disabled)
  • Markdown Preview Mermaid (Matt Bierner)
  • markdownlint
  • Prettier
  • YAML (Red Hat)

I raised this here rather than with Mermaid Preview because the issue occurs only when transcluding dst, not when previewing dst directly (see "Expected behavior" screenshot).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions