forked from hlfcoding/sublime-mermaid
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmermaid.sublime-syntax
More file actions
93 lines (83 loc) · 2.63 KB
/
mermaid.sublime-syntax
File metadata and controls
93 lines (83 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
%YAML 1.2
---
# See https://www.sublimetext.com/docs/syntax.html
name: Mermaid
file_extensions:
- mermaid
- mmd
scope: source.mermaid
version: 2
contexts:
prototype:
- include: line-comment
main:
# don't include the prototype so we can have preprocesor comments take precedence over normal ones
- meta_include_prototype: false
- include: preprocessor-comments
- include: line-comment
- match: <
push:
- meta_scope: punctuation.definition.comment.mermaid.html
- match: $
pop: true
- match: (?-i)^\s*(sequenceDiagram)\s+
captures:
1: keyword.declaration.trait.diagram.mermaid
push:
- meta_scope: meta.declaration.diagram.mermaid
- match: $
set: scope:source.mermaid.sequence
- match: ^\s*(graph|flowchart)\s+
captures:
1: keyword.declaration.graph.mermaid
push:
- meta_scope: meta.declaration.graph.mermaid
- include: graph-direction
- include: scope:source.mermaid.flowchart#prototype
- match: $
set: scope:source.mermaid.flowchart
graph-direction:
- match: \b(?:T[BD]|BT|LR|RL)\b
scope: constant.language.graph-direction.mermaid
preprocessor-comments:
- match: '^\s*(%%)(?={)'
captures:
1: punctuation.definition.comment.mermaid
push: inside-preprocessor-comment
inside-preprocessor-comment:
- meta_scope: comment.line.percentage.mermaid
- match: ''
embed: scope:source.js
escape: (%%)?$
escape_captures:
1: punctuation.definition.comment.end.mermaid
pop: 1
#- match: '' # basis, bumpX, bumpY, cardinal, catmullRom, linear, monotoneX, monotoneY, natural, step, stepAfter, and stepBefore.
line-comment:
- match: '^\s*(%%)'
captures:
1: punctuation.definition.comment.mermaid
push: inside-line-comment
inside-line-comment:
- meta_scope: comment.line.percentage.mermaid
- match: $\n?
pop: true
quoted-string:
- match: '"'
scope: punctuation.definition.string.begin.mermaid
push: inside-quoted-string
inside-quoted-string:
- meta_scope: string.quoted.double.mermaid
- match: '"'
scope: punctuation.definition.string.end.mermaid
pop: true
- match: (#)[0-9]{1,7}(;)
scope: constant.character.entity.decimal.mermaid
captures:
1: punctuation.definition.entity.mermaid
2: punctuation.terminator.entity.mermaid
- match: (#)[a-zA-Z0-9]+(;)
scope: constant.character.entity.named.mermaid
captures:
1: punctuation.definition.entity.mermaid
2: punctuation.terminator.entity.mermaid