mjbvz / vscode-markdown-mermaid

Adds Mermaid diagram and flowchart support to VS Code's builtin markdown preview
https://marketplace.visualstudio.com/items?itemName=bierner.markdown-mermaid
MIT License
640 stars 115 forks source link

Better syntax error reporting #129

Open pcholakov opened 2 years ago

pcholakov commented 2 years ago

This can be seen as a continuation of #46

Syntax errors are currently not reported with any level of detail by extension v1.13.2, e.g.:

```mermaid
sequenceDiagram

A - > B: test
B --> A: error
```

Produces this output in the preview pane:

image

By contrast, the Mermaid online editor will helpfully point to the location of the problem:

image
pcholakov commented 2 years ago

Haven't looked at the extension code but the Mermaid docs now show a mechanism for registering a syntax error callback - from https://mermaid-js.github.io/mermaid/#/usage?id=advanced-usage:

mermaid.parseError = function(err,hash){
    displayErrorInGui(err);
};