Skip to content

[FEATURE]: Detect Mermaid diagrams in untagged fences, not only ```mermaid #43304

Closed as not planned

Description

@chronoflux-germany

Feature hasn't been suggested before.

Describe the enhancement you want to request

decorateMermaid (from the merged, unreleased #43024) only acts on tagged fences:

if (!code.classList.contains("language-mermaid")) {
  clearMermaid(wrapper)
  return
}

Correct by the letter — but models often don't tag the fence, even when explicitly asked for a Mermaid diagram.

Measured across the stored sessions of one instance ([email protected], Nemotron 3 Ultra 550B):

fence count
``` (untagged) 50
```text 26
```mermaid 22
```bash 2

Not every untagged block is a diagram. But the diagrams that were there arrived untagged more often than tagged, and the user just sees a code block — with no way to tell whether the feature is missing or the tag is.

The mechanism is already in the PR. renderMermaidSvg does:

if (!(await mermaid.parse(source, { suppressErrors: true }))) return

That alone identifies a diagram; non-diagram code doesn't parse. So the class check could be relaxed rather than replaced — attempt untagged (and text) blocks too and let parse decide, keeping the fast path for tagged ones. Cost is one suppressed parse per candidate, and it can be limited to complete blocks, which the code already distinguishes, so streaming is unaffected.

I first tried matching the first word against Mermaid's diagram keywords. It works, but ages badly — every new diagram type has to be added by hand. parse always knows.

Caveat: I haven't run your build; #43024 is merged but not in a published release (latest 1.18.18, 2026-08-13). This comes from reading the diff. The measurement is from our own sessions and stands on its own.

Activity

  1. github-actions commented on Aug 18, 2026

    @github-actions
    Contributor

    This issue doesn't fully meet our contributing guidelines.

    What needs to be fixed:

    • No issue template was used. Please resubmit using one of the three required templates: Bug Report, Feature Request, or Question. Since this appears to be a bug report or enhancement on the recently merged Mermaid rendering feature, the Bug Report template would be most appropriate.

    Please edit this issue to address the above within 2 hours, or it will be automatically closed.


    This issue might be related to existing issues. Please check:

    If you believe this was flagged incorrectly, please let a maintainer know.

  2. changed the title [-]Mermaid rendering only triggers on ```mermaid-tagged fences — models often emit untagged blocks[/-] [+][FEATURE]: Detect Mermaid diagrams in untagged fences, not only ```mermaid[/+] on Aug 18, 2026
  3. chronoflux-germany commented on Aug 18, 2026

    @chronoflux-germany
    Author

    Rewritten using the Feature Request template rather than Bug Report, deliberately: the Bug Report template asks for version, steps to reproduce, OS and terminal, and I can't fill those honestly — #43024 isn't in a published release, so there is no shipped behaviour to reproduce. This is a suggestion about detection scope, not a defect report.

    Also checked the two issues you linked before ticking "hasn't been suggested before": #39816 and #40508 both cover rendering; neither addresses untagged fences.

    (Minor: the guidance mentions three templates including "Question", but .github/ISSUE_TEMPLATE/ currently holds only bug-report.yml and feature-request.yml.)

  4. github-actions commented on Aug 18, 2026

    @github-actions
    Contributor

    Thanks for updating the issue! This looks good now — the feature request is clear, well-documented with real measurements, and follows the template. Removing the compliance label.

  5. github-actions commented on Oct 18, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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