-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy pathMarkdown.sublime-syntax.patch
199 lines (199 loc) · 8.12 KB
/
Markdown.sublime-syntax.patch
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
diff --git syntaxes/01_Packages/Markdown/Markdown.sublime-syntax syntaxes/01_Packages/Markdown/Markdown.sublime-syntax
index 19dc685d..3a45ea05 100644
--- syntaxes/01_Packages/Markdown/Markdown.sublime-syntax
+++ syntaxes/01_Packages/Markdown/Markdown.sublime-syntax
@@ -24,7 +24,6 @@ variables:
)
[ \t]*$ # followed by any number of tabs or spaces, followed by the end of the line
)
- setext_escape: ^(?=\s{0,3}(?:---+|===+)\s*$)
block_quote: (?:[ ]{,3}>(?:.|$)) # between 0 and 3 spaces, followed by a greater than sign, followed by any character or the end of the line
atx_heading: (?:[#]{1,6}\s*) # between 1 and 6 hashes, followed by any amount of whitespace
indented_code_block: (?:[ ]{4}|\t) # 4 spaces or a tab
@@ -277,69 +276,40 @@ contexts:
8: markup.underline.link.markdown
push: [link-ref-def, after-link-title, link-title]
- match: '^(?=\S)(?![=-]{3,}\s*$)'
- branch_point: heading2-branch
- branch:
- - not-heading2
- - heading2
-
- not-paragraph:
- - match: |-
- (?x) # pop out of this context when one of the following conditions are met:
- ^(?:
- \s*$ # the line is blank (or only contains whitespace)
- | (?=
- {{block_quote}} # a block quote begins the line
- | [ ]{,3}[*+-][ ] # an unordered list item begins the line
- | [ ]{,3}1[.][ ] # an ordered list item with number "1" begins the line
- | \# # an ATX heading begins the line
- | [ ]{,3}<( # all types of HTML blocks except type 7 may interrupt a paragraph
- {{html_tag_block_end_at_close_tag}} # 1
- | !-- # 2
- | \? # 3
- | ![A-Z] # 4
- | !\[CDATA\[ # 5
- | {{html_tag_block_end_at_blank_line}} # 6
+ push:
+ - meta_scope: meta.paragraph.markdown
+ - match: |-
+ (?x) # pop out of this context when one of the following conditions are met:
+ ^(?:
+ \s*$ # the line is blank (or only contains whitespace)
+ | (?=
+ {{block_quote}} # a block quote begins the line
+ | [ ]{,3}[*+-][ ] # an unordered list item begins the line
+ | [ ]{,3}1[.][ ] # an ordered list item with number "1" begins the line
+ | \# # an ATX heading begins the line
+ | [ ]{,3}<( # all types of HTML blocks except type 7 may interrupt a paragraph
+ {{html_tag_block_end_at_close_tag}} # 1
+ | !-- # 2
+ | \? # 3
+ | ![A-Z] # 4
+ | !\[CDATA\[ # 5
+ | {{html_tag_block_end_at_blank_line}} # 6
+ )
)
)
- )
- pop: true
-
- not-heading2:
- - include: not-paragraph
- - match: (?=\S)
- branch_point: heading1-branch
- branch:
- - paragraph
- - heading1
- - match: ''
- pop: true
-
- paragraph:
- - meta_scope: meta.paragraph.markdown
- - match: ^\s{0,3}===+\s*$
- fail: heading1-branch
- - match: ^\s{0,3}---+\s*$
- fail: heading2-branch
- - include: not-paragraph
- - include: inline-bold-italic-linebreak
- - include: scope:text.html.basic
-
- heading1:
- - meta_scope: markup.heading.1.markdown
- - include: inline-bold-italic-linebreak
- - match: '^[ \t]{0,3}(={3,})(?=[ \t]*$)'
- captures:
- 1: markup.heading.1.setext.markdown punctuation.definition.heading.setext.markdown
- pop: true
-
- heading2:
- - meta_scope: markup.heading.2.markdown
- - include: inline-bold-italic-linebreak
- - match: '^[ \t]{0,3}(-{3,})(?=[ \t]*$)'
- captures:
- 1: markup.heading.2.setext.markdown punctuation.definition.heading.setext.markdown
- pop: true
-
+ pop: true
+ - include: inline-bold-italic-linebreak
+ - include: scope:text.html.basic
+ - match: '^(={3,})(?=[ \t]*$)'
+ scope: markup.heading.1.setext.markdown
+ captures:
+ 1: punctuation.definition.heading.setext.markdown
+ pop: true
+ - match: '^(-{3,})(?=[ \t]*$)'
+ scope: markup.heading.2.setext.markdown
+ captures:
+ 1: punctuation.definition.heading.setext.markdown
+ pop: true
link-ref-def:
- meta_scope: meta.link.reference.def.markdown
- match: ''
@@ -430,8 +400,6 @@ contexts:
push:
- meta_scope: markup.bold.markdown
- meta_content_scope: markup.italic.markdown
- - match: '{{setext_escape}}'
- pop: true
- match: |-
(?x)
[ \t]*\*{4,} # if there are more than 3 its not applicable to be bold or italic
@@ -446,8 +414,6 @@ contexts:
scope: punctuation.definition.bold.end.markdown
set:
- meta_content_scope: markup.italic.markdown
- - match: '{{setext_escape}}'
- pop: true
- match: |-
(?x)
[ \t]*\*{3,} # if there are more than 3 its not applicable to be bold or italic
@@ -463,8 +429,6 @@ contexts:
scope: punctuation.definition.italic.end.markdown
set:
- meta_content_scope: markup.bold.markdown
- - match: '{{setext_escape}}'
- pop: true
- match: |-
(?x)
[ \t]*\*{3,} # if there are more than 3 its not applicable to be bold or italic
@@ -727,8 +691,6 @@ contexts:
scope: punctuation.definition.italic.begin.markdown
push:
- meta_scope: markup.italic.markdown
- - match: '{{setext_escape}}'
- pop: true
- match: |-
(?x)
[ \t]*\*{4,} # if there are more than 3 its not applicable to be bold or italic
@@ -745,8 +707,6 @@ contexts:
scope: punctuation.definition.italic.begin.markdown
push:
- meta_scope: markup.italic.markdown
- - match: '{{setext_escape}}'
- pop: true
- match: |-
(?x)
[ \t]*_{4,} # if there are more than 3 its not applicable to be bold or italic
@@ -773,8 +733,6 @@ contexts:
- include: bold-italic-trailing
bold-italic-trailing:
- include: scope:text.html.basic
- - match: '{{setext_escape}}'
- pop: true
- match: ^\s*$\n?
scope: invalid.illegal.non-terminated.bold-italic.markdown
pop: true
@@ -1073,6 +1031,21 @@ contexts:
escape: '{{code_fence_escape}}'
escape_captures:
0: meta.code-fence.definition.end.python.markdown-gfm
+ 1: punctuation.definition.raw.code-fence.end.markdown
+ - match: |-
+ (?x)
+ {{fenced_code_block_start}}
+ ((?i:puppet))
+ {{fenced_code_block_trailing_infostring_characters}}
+ captures:
+ 0: meta.code-fence.definition.begin.puppet.markdown-gfm
+ 2: punctuation.definition.raw.code-fence.begin.markdown
+ 5: constant.other.language-name.markdown
+ embed: scope:source.puppet
+ embed_scope: markup.raw.code-fence.puppet.markdown-gfm
+ escape: '{{code_fence_escape}}'
+ escape_captures:
+ 0: meta.code-fence.definition.end.puppet.markdown-gfm
1: punctuation.definition.raw.code-fence.end.markdown
- match: |-
(?x)
@@ -1152,7 +1125,7 @@ contexts:
- match: |-
(?x)
{{fenced_code_block_start}}
- ((?i:rust))
+ ((?i:rust|rs))
{{fenced_code_block_trailing_infostring_characters}}
captures:
0: meta.code-fence.definition.begin.rust.markdown-gfm