Skip to content

Commit b614fb5

Browse files
committed
Fix highlighting of dollar amount at start of line in md files
Fixes #136535
1 parent 0eee604 commit b614fb5

File tree

3 files changed

+77
-3
lines changed

3 files changed

+77
-3
lines changed

extensions/markdown-math/syntaxes/md-math-block.tmLanguage.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"single_dollar_math_block": {
4949
"name": "markup.math.block.markdown",
5050
"contentName": "meta.embedded.math.markdown",
51-
"begin": "(?<=^\\s*)(\\${1})(?![^$]*\\${1})",
51+
"begin": "(?<=^\\s*)(\\$)(?![^$]*\\$|\\d)",
5252
"beginCaptures": {
5353
"1": {
5454
"name": "punctuation.definition.math.begin.markdown"

extensions/vscode-colorize-tests/test/colorize-fixtures/md-math.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,18 @@ a **b**
152152
$$
153153
**b**
154154

155-
<!-- Should allow inline code to be followed by non word character #136584 -->
155+
<!-- Should allow inline code to be followed by non word character #136584 -->
156156

157157
Should be highlighted $\frac{1}{2}$.
158158

159159
Should not be highlighted $\frac{1}{2}$text
160160

161161
Should not be highlighted $\frac{1}{2}$10
162+
163+
<!-- Should not highlight dollar amount at start of line #136535 -->
164+
165+
$12.45
166+
167+
$12.45 x
168+
169+
x $12.45

extensions/vscode-colorize-tests/test/colorize-results/md-math_md.json

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6292,7 +6292,7 @@
62926292
}
62936293
},
62946294
{
6295-
"c": " Should allow inline code to be followed by non word character #136584 ",
6295+
"c": " Should allow inline code to be followed by non word character #136584 ",
62966296
"t": "text.html.markdown comment.block.html",
62976297
"r": {
62986298
"dark_plus": "comment: #6A9955",
@@ -6466,5 +6466,71 @@
64666466
"light_vs": "default: #000000",
64676467
"hc_black": "default: #FFFFFF"
64686468
}
6469+
},
6470+
{
6471+
"c": "<!--",
6472+
"t": "text.html.markdown comment.block.html punctuation.definition.comment.html",
6473+
"r": {
6474+
"dark_plus": "comment: #6A9955",
6475+
"light_plus": "comment: #008000",
6476+
"dark_vs": "comment: #6A9955",
6477+
"light_vs": "comment: #008000",
6478+
"hc_black": "comment: #7CA668"
6479+
}
6480+
},
6481+
{
6482+
"c": " Should not highlight dollar amount at start of line #136535 ",
6483+
"t": "text.html.markdown comment.block.html",
6484+
"r": {
6485+
"dark_plus": "comment: #6A9955",
6486+
"light_plus": "comment: #008000",
6487+
"dark_vs": "comment: #6A9955",
6488+
"light_vs": "comment: #008000",
6489+
"hc_black": "comment: #7CA668"
6490+
}
6491+
},
6492+
{
6493+
"c": "-->",
6494+
"t": "text.html.markdown comment.block.html punctuation.definition.comment.html",
6495+
"r": {
6496+
"dark_plus": "comment: #6A9955",
6497+
"light_plus": "comment: #008000",
6498+
"dark_vs": "comment: #6A9955",
6499+
"light_vs": "comment: #008000",
6500+
"hc_black": "comment: #7CA668"
6501+
}
6502+
},
6503+
{
6504+
"c": "$12.45",
6505+
"t": "text.html.markdown meta.paragraph.markdown",
6506+
"r": {
6507+
"dark_plus": "default: #D4D4D4",
6508+
"light_plus": "default: #000000",
6509+
"dark_vs": "default: #D4D4D4",
6510+
"light_vs": "default: #000000",
6511+
"hc_black": "default: #FFFFFF"
6512+
}
6513+
},
6514+
{
6515+
"c": "$12.45 x",
6516+
"t": "text.html.markdown meta.paragraph.markdown",
6517+
"r": {
6518+
"dark_plus": "default: #D4D4D4",
6519+
"light_plus": "default: #000000",
6520+
"dark_vs": "default: #D4D4D4",
6521+
"light_vs": "default: #000000",
6522+
"hc_black": "default: #FFFFFF"
6523+
}
6524+
},
6525+
{
6526+
"c": "x $12.45",
6527+
"t": "text.html.markdown meta.paragraph.markdown",
6528+
"r": {
6529+
"dark_plus": "default: #D4D4D4",
6530+
"light_plus": "default: #000000",
6531+
"dark_vs": "default: #D4D4D4",
6532+
"light_vs": "default: #000000",
6533+
"hc_black": "default: #FFFFFF"
6534+
}
64696535
}
64706536
]

0 commit comments

Comments
 (0)