Mermaid error
Explanatory text above the diagram stops it rendering
Reproduced on Mermaid 11.17.2 · Updated
Explanatory text above the diagram stops it rendering 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: Here is the diagram:
flowchart TD
A --> BWhy it happens
A sentence from a chat answer sits above the code. The first line is no longer a diagram type, so no parser matches the block.
The source that fails
Here is the diagram:
flowchart TD
A --> BHow to fix it
Delete everything above the diagram keyword.
flowchart TD
A --> BNext 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.