Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions Mermaid Flowchart.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ contexts:
scope: punctuation.terminator.flowchart

main:
- match: ^---$
scope: punctuation.section.block.begin.graph.mermaid
push: config
- include: style
- match: ^\s*(click)\s+
captures:
Expand Down Expand Up @@ -242,14 +245,16 @@ contexts:
captures:
1: keyword.declaration.styling.graph.mermaid
2: entity.name.constant.styling.graph.mermaid
embed: scope:source.css.mermaid#property-list-body
embed: scope:source.css.mermaid#rule-list-body
embed_scope: source.css.embedded
escape: $

- match: ^\s*(style)\s+({{entity}})\s+
- match: ^\s*(style|linkStyle)\s+({{entity}})\s+
captures:
1: keyword.declaration.styling.graph.mermaid
2: variable.parameter.graph.mermaid
embed: scope:source.css.mermaid#property-list-content
embed: scope:source.css.mermaid#rule-list-body
embed_scope: source.css.embedded
escape: $

class-expect-node-name:
Expand Down Expand Up @@ -289,3 +294,9 @@ contexts:
escape_captures:
0: punctuation.definition.string.end.mermaid
#pop: 1

config:
- match: ^---$
scope: punctuation.section.block.end.graph.mermaid
pop: 1
- include: scope:source.yaml
24 changes: 24 additions & 0 deletions tests/syntax_test_flowchart.mermaid
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,15 @@ flowchart LR
click A call callback() "Tooltip for a callback"
click B href "https://www.github.com" "This is a tooltip for a link"

---
config:
markdownAutoWrap: false
%%^^^^^^^^^^^^^^^^ meta.mapping.key meta.string string.unquoted
%% ^ meta.mapping punctuation.separator.key-value.mapping
%% ^^^^^ constant.language.boolean.false
---
%%^ source.mermaid.flowchart punctuation.section.block.end.graph.mermaid

flowchart LR
A-->B
B-->C
Expand All @@ -319,3 +328,18 @@ flowchart LR
click B "https://www.github.com" "Open this top" _top
click C href "https://www.github.com" _parent
click D href "https://www.github.com" "Open this in a new tab" _blank

linkStyle 0 stroke:#BBDEFB,fill:none
%%^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.mermaid.flowchart
%% ^^^^^^^^^ keyword.declaration.styling.graph.mermaid
%% ^ variable.parameter.graph.mermaid
%% ^^^^^^^^^^^^^^^^^^^^^^^^ source.css.embedded
%% ^^^^^^ meta.property-name.css support.type.property-name.css
%% ^ punctuation.separator.key-value.css
%% ^^^^^^^ meta.property-value.css constant.other.color.rgb-value.css
%% ^ punctuation.definition.constant.css
%% ^ punctuation.terminator.rule.css.mermaid
%% ^^^^ meta.property-name.css support.type.property-name.css
%% ^ punctuation.separator.key-value.css
%% ^^^^ meta.property-value.css constant.language.null.css
%% ^ - source.css