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
657 stars 120 forks source link

Mermaid directives cause a parse error #204

Closed matthias-colt closed 10 months ago

matthias-colt commented 1 year ago

If there are directives in the mermaid code, it is not rendered by this extension.

Example:

```mermaid
flowchart LR
  %%{init: {'flowchart':{'useMaxWidth': false}}}%%
  A --> B
  A --> C
  B --> C
```

This causes an error:

Parse error on line 2:
flowchart LR  %%{init: {'flowchart
--------------^
Expecting 'SEMI', 'NEWLINE', 'SPACE', 'EOF', 'subgraph', 'end', 'acc_title', 'acc_descr', 'acc_descr_multiline_value', 'AMP', 'ALPHA', 'COLON', 'STYLE', 'LINKSTYLE', 'CLASSDEF', 'CLASS', 'CLICK', 'DOWN', 'DEFAULT', 'NUM', 'COMMA', 'MINUS', 'BRKT', 'DOT', 'direction_tb', 'direction_bt', 'direction_rl', 'direction_lr', 'PUNCTUATION', 'UNICODE_TEXT', 'PLUS', 'EQUALS', 'MULT', 'UNDERSCORE', got 'open_directive'

There is a PR #192 for support of directives, but this seems only for settings.json and not for the mermaid markup parser if I correctly understand.

mjbvz commented 10 months ago

Seems to be working for me with version 1.21 of this extension:

Image

palto42 commented 10 months ago

Thanks, works for me as well now :)