← Back to editor

Mermaid error

The Markdown code fence must not be part of the diagram

Reproduced on Mermaid 11.17.2 · Updated

The Markdown code fence must not be part of the diagram in Mermaid. The exact parser message, why it happens, and corrected source that renders.

What Mermaid says

No diagram type detected matching given configuration for text: ```mermaid
flowchart TD
  A --> B
```

Why it happens

The three backticks and the word mermaid belong to Markdown, not to the diagram. As the first line they stop any diagram type from being detected.

The source that fails

```mermaid
flowchart TD
  A --> B
```

How to fix it

Paste only the lines between the fences. The repair tool removes them for you.

flowchart TD
  A --> B

Next steps

Paste your own version into the Mermaid repair tool, which applies this correction and fourteen others and shows every change. The related page covers the surrounding syntax, and the error dictionary lists every message.