Skip to content

Commit e23ca32

Browse files
committed
feat(state): support no spaces in links
1 parent 4ce4a65 commit e23ca32

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ State diagram:
66

77
- Add support for direction
88
- Add support for symbols in state description
9-
- Adjust requirements for spaces in state and note declarations
9+
- Adjust requirements for spaces in state and note declarations and links
1010

1111
## [v1.7.1]
1212

syntaxes/diagrams/stateDiagram.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
- comment: '(state) -->'
8282
begin: !regex |-
8383
([\w-]+) # state name
84-
\s+(-->) # -->
84+
\s*(-->) # -->
8585
beginCaptures:
8686
'1':
8787
name: variable
@@ -90,7 +90,7 @@
9090
patterns:
9191
- comment: '(state) (:)? (transition text)?'
9292
match: !regex |-
93-
\s+([\w-]+) # state name
93+
\s*([\w-]+) # state name
9494
\s*(:)? # :
9595
\s*([^\n:]+)? # transition text
9696
captures:
@@ -116,8 +116,8 @@
116116
- comment: '[*] --> (state) (:)? (transition text)?'
117117
match: !regex |-
118118
(\[\*\]) # [*]
119-
\s+(-->) # -->
120-
\s+([\w-]+) # state name
119+
\s*(-->) # -->
120+
\s*([\w-]+) # state name
121121
\s*(:)? # :
122122
\s*([^\n:]+)? # transition text
123123
captures:

tests/diagrams/state.test.mermaid

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ stateDiagram
3737
%%^^ variable
3838
%% ^^^ keyword.control.mermaid
3939
%% ^^ variable
40+
s1-->s2
41+
%%^^ variable
42+
%% ^^^ keyword.control.mermaid
43+
%% ^^ variable
4044
s2 --> s3: Colon transition
4145
%%^^ variable
4246
%% ^^^ keyword.control.mermaid
@@ -48,6 +52,9 @@ stateDiagram
4852
%% ^^ variable
4953
%% ^ keyword.control.mermaid
5054
%% ^^^^^^^^^^^^^^^ string
55+
[*]-->s2
56+
%%^^^^^^ keyword.control.mermaid
57+
%% ^^ variable
5158
s3 --> [*]
5259
%%^^ variable
5360
%% ^^^ keyword.control.mermaid

0 commit comments

Comments
 (0)