typora / typora-issues

Bugs, suggestions or free discussions about the minimal markdown editor — Typora
https://typora.io
1.53k stars 58 forks source link

Some flowchart examples from Mermaid website are not working #4491

Closed etrokal closed 3 years ago

etrokal commented 3 years ago

Describe the bug Some flowchart examples from Mermaid website are not working in Typora. More specifically the direction statement results in error. If I remove the statement, the graph shows correctly.

To Reproduce Steps to reproduce the behavior:

  1. Create a new document
  2. Create a mermaid code block
  3. Paste the following code:
    flowchart LR
    subgraph TOP
    direction TB
    subgraph B1
        direction RL
        i1 -->f1
    end
    subgraph B2
        direction BT
        i2 -->f2
    end
    end
    A --> TOP --> B
    B1 --> B2
  4. See the error being shown as follows:
    ERROR: [Mermaid] Parse error on line 3:
    ...h TOP    direction TB    subgraph B1 
    ----------------------^
    Expecting 'SEMI', 'NEWLINE', 'EOF', 'AMP', 'START_LINK', 'LINK', got 'ALPHA'

Expected behavior The mermaid diagram should be shown correctly

Screenshots / Screencasts img

Sample Markdown File example.md

Desktop (please complete the following information):

Typora Version 0.10.11

Additional context It appears that setting the direction of subgraphs was introduced in version 8.10.2 of mermaid.

abnerlee commented 3 years ago

put into #1661