Skip to content

Commit 9df92ee

Browse files
Merge pull request #42 from esumerfd/master
2 parents ec72178 + 5803ac0 commit 9df92ee

3 files changed

Lines changed: 58 additions & 2 deletions

File tree

cmd/parse.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package cmd
22

33
import (
44
"errors"
5+
"fmt"
56
"regexp"
67
"strconv"
78
"strings"
@@ -252,10 +253,10 @@ func mermaidFileToMap(mermaid, styleType string) (*graphProperties, error) {
252253
switch lines[0] {
253254
case "graph LR", "flowchart LR":
254255
graphDirection = "LR"
255-
case "graph TD", "flowchart TD":
256+
case "graph TD", "flowchart TD", "graph TB", "flowchart TB":
256257
graphDirection = "TD"
257258
default:
258-
return &properties, errors.New("first line should define the graph")
259+
return &properties, fmt.Errorf("unsupported graph type '%s'. Supported types: graph TD, graph TB, graph LR, flowchart TD, flowchart TB, flowchart LR", lines[0])
259260
}
260261
lines = lines[1:]
261262

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
flowchart TB
2+
A --> B
3+
B --> C
4+
---
5+
+---+
6+
| |
7+
| A |
8+
| |
9+
+---+
10+
|
11+
|
12+
|
13+
|
14+
v
15+
+---+
16+
| |
17+
| B |
18+
| |
19+
+---+
20+
|
21+
|
22+
|
23+
|
24+
v
25+
+---+
26+
| |
27+
| C |
28+
| |
29+
+---+
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
graph TB
2+
subgraph one
3+
A --> B
4+
end
5+
---
6+
+-------+
7+
| one |
8+
| |
9+
| |
10+
| +---+ |
11+
| | | |
12+
| | A | |
13+
| | | |
14+
| +---+ |
15+
| | |
16+
| | |
17+
| | |
18+
| | |
19+
| v |
20+
| +---+ |
21+
| | | |
22+
| | B | |
23+
| | | |
24+
| +---+ |
25+
| |
26+
+-------+

0 commit comments

Comments
 (0)