Skip to content

Mermaid diagram fails to render with node labels starting with / #304

@danhdx2

Description

@danhdx2

🐛 Bug: Mermaid diagram fails to render with node labels starting with /

Description

When generating Mermaid diagrams, labels starting with / cause a rendering failure.

Example error:

Lexical error on line 2. Unrecognized text.
... A[/archie command] --> B[Fetch issue
-----------------------^

Reproduction

graph LR
    A[/archie command] --> B[Fetch issue or PR details]
    B --> C[Extract relationships and concepts]
    C --> D[Select diagram types]
    D --> E[Generate 1-3 Mermaid diagrams]
    E --> F[Validate syntax]
    F --> G[Post comment with diagrams]
Loading

Expected behavior

Diagram should render correctly.

Actual behavior

Mermaid fails to parse the diagram due to invalid syntax.

Root cause

Mermaid does not support unescaped special characters (e.g. /) at the beginning of node labels.

Suggested fix

Wrap labels in quotes to ensure proper parsing:

graph LR
    A["/archie command"] --> B["Fetch issue or PR details"]
    B --> C["Extract relationships and concepts"]
    C --> D["Select diagram types"]
    D --> E["Generate 1-3 Mermaid diagrams"]
    E --> F["Validate syntax"]
    F --> G["Post comment with diagrams"]
Loading

Additional context

This issue affects auto-generated diagrams (e.g. via Archie command), where labels may include special characters.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions