Skip to content

Commit 4719230

Browse files
committed
Undo revert of markdown grammar
With added fix for microsoft#57183 Fixes microsoft#57183
1 parent 6ed4cce commit 4719230

4 files changed

Lines changed: 205 additions & 101 deletions

File tree

extensions/markdown-basics/syntaxes/markdown.tmLanguage.json

Lines changed: 81 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
55
"Once accepted there, we are happy to receive an update request."
66
],
7-
"version": "https://github.com/microsoft/vscode-markdown-tm-grammar/commit/4504240cdb13a4640f64fc98a0adb858226a879e",
7+
"version": "https://github.com/microsoft/vscode-markdown-tm-grammar/commit/83a1940ab00b770392c3ae71b92e80cca2960613",
88
"name": "Markdown",
99
"scopeName": "text.html.markdown",
1010
"patterns": [
@@ -165,6 +165,9 @@
165165
{
166166
"include": "#fenced_code_block_dart"
167167
},
168+
{
169+
"include": "#fenced_code_block_handlebars"
170+
},
168171
{
169172
"include": "#fenced_code_block_unknown"
170173
},
@@ -186,7 +189,7 @@
186189
"begin": "(^|\\G)[ ]{0,3}(>) ?",
187190
"captures": {
188191
"2": {
189-
"name": "beginning.punctuation.definition.quote.markdown"
192+
"name": "punctuation.definition.quote.begin.markdown"
190193
}
191194
},
192195
"name": "markup.quote.markdown",
@@ -1685,6 +1688,39 @@
16851688
}
16861689
]
16871690
},
1691+
"fenced_code_block_handlebars": {
1692+
"begin": "(^|\\G)(\\s*)(`{3,}|~{3,})\\s*(?i:(handlebars|hbs)(\\s+[^`~]*)?$)",
1693+
"name": "markup.fenced_code.block.markdown",
1694+
"end": "(^|\\G)(\\2|\\s{0,3})(\\3)\\s*$",
1695+
"beginCaptures": {
1696+
"3": {
1697+
"name": "punctuation.definition.markdown"
1698+
},
1699+
"5": {
1700+
"name": "fenced_code.block.language"
1701+
},
1702+
"6": {
1703+
"name": "fenced_code.block.language.attributes"
1704+
}
1705+
},
1706+
"endCaptures": {
1707+
"3": {
1708+
"name": "punctuation.definition.markdown"
1709+
}
1710+
},
1711+
"patterns": [
1712+
{
1713+
"begin": "(^|\\G)(\\s*)(.*)",
1714+
"while": "(^|\\G)(?!\\s*([`~]{3,})\\s*$)",
1715+
"contentName": "meta.embedded.block.handlebars",
1716+
"patterns": [
1717+
{
1718+
"include": "text.html.handlebars"
1719+
}
1720+
]
1721+
}
1722+
]
1723+
},
16881724
"fenced_code_block_unknown": {
16891725
"begin": "(^|\\G)(\\s*)(`{3,}|~{3,})\\s*(?=([^`~]*)?$)",
16901726
"beginCaptures": {
@@ -1912,7 +1948,7 @@
19121948
"name": "punctuation.definition.string.end.markdown"
19131949
}
19141950
},
1915-
"match": "(?x)\n \\s* # Leading whitespace\n (\\[)(.+?)(\\])(:) # Reference name\n [ \\t]* # Optional whitespace\n (<?)(\\S+?)(>?) # The url\n [ \\t]* # Optional whitespace\n (?:\n ((\\().+?(\\))) # Match title in quotes…\n | ((\").+?(\")) # or in parens.\n )? # Title is optional\n \\s* # Optional whitespace\n $\n",
1951+
"match": "(?x)\n \\s* # Leading whitespace\n (\\[)([\\w ]+?)(\\])(:) # Reference name\n [ \\t]* # Optional whitespace\n (<?)(\\S+?)(>?) # The url\n [ \\t]* # Optional whitespace\n (?:\n ((\\().+?(\\))) # Match title in quotes…\n | ((\").+?(\")) # or in parens.\n )? # Title is optional\n \\s* # Optional whitespace\n $\n",
19161952
"name": "meta.link.reference.def.markdown"
19171953
},
19181954
"list_paragraph": {
@@ -1934,10 +1970,10 @@
19341970
"lists": {
19351971
"patterns": [
19361972
{
1937-
"begin": "(^|\\G)([ ]{0,3})([*+-])([ ]{1,3}|\\t)",
1973+
"begin": "(^|\\G)([ ]{0,3})([*+-])([ \\t])",
19381974
"beginCaptures": {
19391975
"3": {
1940-
"name": "beginning.punctuation.definition.list.markdown"
1976+
"name": "punctuation.definition.list.begin.markdown"
19411977
}
19421978
},
19431979
"comment": "Currently does not support un-indented second lines.",
@@ -1950,13 +1986,13 @@
19501986
"include": "#list_paragraph"
19511987
}
19521988
],
1953-
"while": "((^|\\G)([ ]{4}|\\t))|(^[ \\t]*$)"
1989+
"while": "((^|\\G)([ ]{2,4}|\\t))|(^[ \\t]*$)"
19541990
},
19551991
{
1956-
"begin": "(^|\\G)([ ]{0,3})([0-9]+\\.)([ ]{1,3}|\\t)",
1992+
"begin": "(^|\\G)([ ]{0,3})([0-9]+\\.)([ \\t])",
19571993
"beginCaptures": {
19581994
"3": {
1959-
"name": "beginning.punctuation.definition.list.markdown"
1995+
"name": "punctuation.definition.list.begin.markdown"
19601996
}
19611997
},
19621998
"name": "markup.list.numbered.markdown",
@@ -1968,7 +2004,7 @@
19682004
"include": "#list_paragraph"
19692005
}
19702006
],
1971-
"while": "((^|\\G)([ ]{4}|\\t))|(^[ \\t]*$)"
2007+
"while": "((^|\\G)([ ]{2,4}|\\t))|(^[ \\t]*$)"
19722008
}
19732009
]
19742010
},
@@ -1994,7 +2030,7 @@
19942030
"while": "(^|\\G)([ ]{4}|\\t)"
19952031
},
19962032
"separator": {
1997-
"match": "(^|\\G)[ ]{0,3}([\\*\\-\\_])([ ]{0,2}\\2){2,}[ \\t]*$\\n?",
2033+
"match": "(^|\\G)[ ]{0,3}([*-_])([ ]{0,2}\\2){2,}[ \\t]*$\\n?",
19982034
"name": "meta.separator.markdown"
19992035
}
20002036
}
@@ -2049,6 +2085,9 @@
20492085
},
20502086
{
20512087
"include": "#link-ref-literal"
2088+
},
2089+
{
2090+
"include": "#link-ref-shortcut"
20522091
}
20532092
],
20542093
"repository": {
@@ -2058,7 +2097,7 @@
20582097
"name": "meta.other.valid-ampersand.markdown"
20592098
},
20602099
"bold": {
2061-
"begin": "(?x)\n ((?<!\\w)\\*\\*\\b|\\b__)(?=\\S) # Open\n (?=\n (\n <[^>]*+> # HTML tags\n | (?<raw>`+)([^`]|(?!(?<!`)\\k<raw>(?!`))`)*+\\k<raw>\n # Raw\n | \\\\[\\\\`*_{}\\[\\]()#.!+\\->]?+ # Escapes\n | \\[\n (\n (?<square> # Named group\n [^\\[\\]\\\\] # Match most chars\n | \\\\. # Escaped chars\n | \\[ \\g<square>*+ \\] # Nested brackets\n )*+\n \\]\n (\n ( # Reference Link\n [ ]? # Optional space\n \\[[^\\]]*+\\] # Ref name\n )\n | ( # Inline Link\n \\( # Opening paren\n [ \\t]*+ # Optional whitespace\n <?(.*?)>? # URL\n [ \\t]*+ # Optional whitespace\n ( # Optional Title\n (?<title>['\"])\n (.*?)\n \\k<title>\n )?\n \\)\n )\n )\n )\n | (?!(?<=\\S)\\1). # Everything besides\n # style closer\n )++\n (?<=\\S)(?=__\\b|\\*\\*)\\1 # Close\n )\n",
2100+
"begin": "(?x)\n (\\*\\*(?=\\w)|(?<!\\w)\\*\\*|(?<!\\w)\\b__)(?=\\S) # Open\n (?=\n (\n <[^>]*+> # HTML tags\n | (?<raw>`+)([^`]|(?!(?<!`)\\k<raw>(?!`))`)*+\\k<raw>\n # Raw\n | \\\\[\\\\`*_{}\\[\\]()#.!+\\->]?+ # Escapes\n | \\[\n (\n (?<square> # Named group\n [^\\[\\]\\\\] # Match most chars\n | \\\\. # Escaped chars\n | \\[ \\g<square>*+ \\] # Nested brackets\n )*+\n \\]\n (\n ( # Reference Link\n [ ]? # Optional space\n \\[[^\\]]*+\\] # Ref name\n )\n | ( # Inline Link\n \\( # Opening paren\n [ \\t]*+ # Optional whitespace\n <?(.*?)>? # URL\n [ \\t]*+ # Optional whitespace\n ( # Optional Title\n (?<title>['\"])\n (.*?)\n \\k<title>\n )?\n \\)\n )\n )\n )\n | (?!(?<=\\S)\\1). # Everything besides\n # style closer\n )++\n (?<=\\S)(?=__\\b|\\*\\*)\\1 # Close\n )\n",
20622101
"captures": {
20632102
"1": {
20642103
"name": "punctuation.definition.bold.markdown"
@@ -2115,6 +2154,9 @@
21152154
},
21162155
{
21172156
"include": "#link-ref"
2157+
},
2158+
{
2159+
"include": "#link-ref-shortcut"
21182160
}
21192161
]
21202162
},
@@ -2200,7 +2242,7 @@
22002242
"name": "meta.image.reference.markdown"
22012243
},
22022244
"italic": {
2203-
"begin": "(?x) (\\*\\b|\\b_)(?=\\S) # Open\n (?=\n (\n <[^>]*+> # HTML tags\n | (?<raw>`+)([^`]|(?!(?<!`)\\k<raw>(?!`))`)*+\\k<raw>\n # Raw\n | \\\\[\\\\`*_{}\\[\\]()#.!+\\->]?+ # Escapes\n | \\[\n (\n (?<square> # Named group\n [^\\[\\]\\\\] # Match most chars\n | \\\\. # Escaped chars\n | \\[ \\g<square>*+ \\] # Nested brackets\n )*+\n \\]\n (\n ( # Reference Link\n [ ]? # Optional space\n \\[[^\\]]*+\\] # Ref name\n )\n | ( # Inline Link\n \\( # Opening paren\n [ \\t]*+ # Optional whtiespace\n <?(.*?)>? # URL\n [ \\t]*+ # Optional whtiespace\n ( # Optional Title\n (?<title>['\"])\n (.*?)\n \\k<title>\n )?\n \\)\n )\n )\n )\n | \\1\\1 # Must be bold closer\n | (?!(?<=\\S)\\1). # Everything besides\n # style closer\n )++\n (?<=\\S)(?=_\\b|\\*)\\1 # Close\n )\n",
2245+
"begin": "(?x) (\\*(?=\\w)|(?<!\\w)\\*|(?<!\\w)\\b_)(?=\\S) # Open\n (?=\n (\n <[^>]*+> # HTML tags\n | (?<raw>`+)([^`]|(?!(?<!`)\\k<raw>(?!`))`)*+\\k<raw>\n # Raw\n | \\\\[\\\\`*_{}\\[\\]()#.!+\\->]?+ # Escapes\n | \\[\n (\n (?<square> # Named group\n [^\\[\\]\\\\] # Match most chars\n | \\\\. # Escaped chars\n | \\[ \\g<square>*+ \\] # Nested brackets\n )*+\n \\]\n (\n ( # Reference Link\n [ ]? # Optional space\n \\[[^\\]]*+\\] # Ref name\n )\n | ( # Inline Link\n \\( # Opening paren\n [ \\t]*+ # Optional whtiespace\n <?(.*?)>? # URL\n [ \\t]*+ # Optional whtiespace\n ( # Optional Title\n (?<title>['\"])\n (.*?)\n \\k<title>\n )?\n \\)\n )\n )\n )\n | \\1\\1 # Must be bold closer\n | (?!(?<=\\S)\\1). # Everything besides\n # style closer\n )++\n (?<=\\S)(?=_\\b|\\*)\\1 # Close\n )\n",
22042246
"captures": {
22052247
"1": {
22062248
"name": "punctuation.definition.italic.markdown"
@@ -2254,6 +2296,9 @@
22542296
},
22552297
{
22562298
"include": "#link-ref"
2299+
},
2300+
{
2301+
"include": "#link-ref-shortcut"
22572302
}
22582303
]
22592304
},
@@ -2307,32 +2352,32 @@
23072352
"7": {
23082353
"name": "markup.underline.link.markdown"
23092354
},
2310-
"8": {
2355+
"9": {
23112356
"name": "punctuation.definition.link.markdown"
23122357
},
2313-
"9": {
2358+
"10": {
23142359
"name": "string.other.link.description.title.markdown"
23152360
},
2316-
"10": {
2361+
"11": {
23172362
"name": "punctuation.definition.string.begin.markdown"
23182363
},
2319-
"11": {
2364+
"12": {
23202365
"name": "punctuation.definition.string.end.markdown"
23212366
},
2322-
"12": {
2367+
"13": {
23232368
"name": "string.other.link.description.title.markdown"
23242369
},
2325-
"13": {
2370+
"14": {
23262371
"name": "punctuation.definition.string.begin.markdown"
23272372
},
2328-
"14": {
2373+
"15": {
23292374
"name": "punctuation.definition.string.end.markdown"
23302375
},
2331-
"15": {
2376+
"16": {
23322377
"name": "punctuation.definition.metadata.markdown"
23332378
}
23342379
},
2335-
"match": "(?x)\n (\\[)((?<square>[^\\[\\]\\\\]|\\\\.|\\[\\g<square>*+\\])*+)(\\])\n # Match the link text.\n (\\() # Opening paren for url\n (<?)(.*?)(>?) # The url\n [ \\t]* # Optional whitespace\n (?:\n ((\\().+?(\\))) # Match title in parens…\n | ((\").+?(\")) # or in quotes.\n )? # Title is optional\n \\s* # Optional whitespace\n (\\))\n",
2380+
"match": "(?x)\n (\\[)((?<square>[^\\[\\]\\\\]|\\\\.|\\[\\g<square>*+\\])*+)(\\])\n # Match the link text.\n (\\() # Opening paren for url\n (<?)((?<url>(?>[^\\s()]+)|\\(\\g<url>*\\))*)(>?) # The url\n [ \\t]* # Optional whitespace\n (?:\n ((\\().+?(\\))) # Match title in parens…\n | ((\").+?(\")) # or in quotes.\n )? # Title is optional\n \\s* # Optional whitespace\n (\\))\n",
23362381
"name": "meta.link.inline.markdown"
23372382
},
23382383
"link-ref": {
@@ -2380,6 +2425,21 @@
23802425
"match": "(\\[)((?<square>[^\\[\\]\\\\]|\\\\.|\\[\\g<square>*+\\])*+)(\\])[ ]?(\\[)(\\])",
23812426
"name": "meta.link.reference.literal.markdown"
23822427
},
2428+
"link-ref-shortcut": {
2429+
"captures": {
2430+
"1": {
2431+
"name": "punctuation.definition.string.begin.markdown"
2432+
},
2433+
"2": {
2434+
"name": "string.other.link.title.markdown"
2435+
},
2436+
"4": {
2437+
"name": "punctuation.definition.string.end.markdown"
2438+
}
2439+
},
2440+
"match": "(\\[)(\\S+?)(\\])",
2441+
"name": "meta.link.reference.markdown"
2442+
},
23832443
"raw": {
23842444
"captures": {
23852445
"1": {

0 commit comments

Comments
 (0)