-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Description
Description
When I add a multiline accDescr element to my XY Chart, the moment the braces are closed, the browser tab hangs and crashes with a CODE_HUNG error
Steps to reproduce
- Copy the code sample into the mermaid.live editor
- Tab will crash
Alternatively, remove the trailing } character before pasting, so you can type it yourself to trigger the crash.
Screenshots
Tab hanging immediately after typing closing } (it's not visible because the tab hangs before monaco-editor can render it.
Crashed tab:
Code Sample
xychart
accTitle: Sales Overview
accDescr {}
title "Revenue Report"
y-axis 0 --> 100
line [45, 67,89, 55]
bar [30, 40, 50, 35]
bar [.5, 1.5, +2.0, -0.5]
x-axis ["Q1", "Q2", "Q3", "Q4"]
Setup
- Mermaid version: v11.12.0
- Browser and Version: Chrome 143.0.7499.170 (Official Build) (arm64)
Suggested Solutions
This appears to be a parsing bug caused by an incorrect closing token pattern for acc_descr_multiline - matching { instead of } resulting in the parser getting trapped in an infinite loop within the acc_descr_multiline state.
Additional Context
It doesn't matter if there's text between the braces or if it's spread across multiple lines. Any of those patterns will crash the tab.