-
The error in your screenshot is on the line defining node
C(line 3 of the diagram, countingflowchart LRas line 1). It opens withC[but ends with}. Replace that final}with]:B -->|"allowed"| C["TODAY: build a brand-new machine for this one visit (new server + transport)"]As for showing where an error occurs: yes, OneDev could display more detail. The “Syntax error in text” image is Mermaid’s generic error graphic. OneDev currently invokes Mermaid to render the diagram without adding an inline display of the underlying parser diagnostic.
The bundled flowchart parser can report a line number, a source excerpt with a position marker, and expected/unexpected tokens. Mermaid also exposes error handling that applications can use to display those diagnostics; see its syntax validation documentation. Showing this beside the preview would require an enhancement to OneDev’s integration. A precise character location is not available uniformly for every kind of Mermaid error, and the reported position can be where parsing failed rather than where the original mistake began.
For now, you can open your browser’s developer tools Console and regenerate the preview to inspect the Mermaid error. The Mermaid Live Editor is another way to troubleshoot a diagram, though its Mermaid version may differ from OneDev’s.
Does the correction resolve your diagram, and does this answer your question about the error display?
-
@servicedesk yeah, but I need you to address it in a systemic manner, not just give me a workaround. What I mean is that when OneDev shows a syntax error in the text, I want it to show me which line and which character the error is on. I want it to work similarly to how Mermaid Live Editor does: it shows you the line and the location within that line where the error is occurring.
I don't want to have to go through this many steps:
- Click on Edit.
- Find the Mermaid diagram that has the error.
- Copy it.
- Open up the Mermaid live editor.
- Paste it.
- Fix it.
- Copy it.
- Come back to OneDev, paste it, and save it.
It's too many steps. It would be much easier if you could just show me in the Markdown preview where the error is occurring as I write or edit the Mermaid diagram.
-
@zaakiy Understood: the request is to show Mermaid syntax diagnostics directly in OneDev’s Markdown preview while writing or editing a diagram, including the line number and position within that line, without copying the diagram to another tool. My previous workaround does not address that requirement. The current integration does not display those diagnostics alongside the failed diagram.
@robin Please review this enhancement request and decide how to proceed: show the parser’s error message, offending source line, and a caret or character position in the Markdown preview where Mermaid provides that information, with a useful message when no position is available. Leaving this issue open for that decision.
-
This is the kind of text I'd like to see.
Error: Error: Parse error on line 3: ...server + transport)"} B -->|"allowed -----------------------^ Expecting 'SQE', 'TAGEND', 'UNICODE_TEXT', 'TEXT', 'TAGSTART', got 'DIAMOND_STOP'It should be natively available from the Mermaid library. We just need to decide to show it.
| Type |
Question
|
| Priority |
Normal
|
| Assignee | |
| Labels |
No labels
|
When there is an error with the mermaid and we display a syntax error in text because the mermaid could not be parsed, why can't we show which line and which character had the issue? Some additional information about what went wrong would be really, really helpful when writing the mermaid charts.