From b614fb5db84b3ac07fc3e8b12c69c1dd581924ce Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Mon, 8 Nov 2021 17:53:52 -0800 Subject: [PATCH] Fix highlighting of dollar amount at start of line in md files Fixes #136535 --- .../syntaxes/md-math-block.tmLanguage.json | 2 +- .../test/colorize-fixtures/md-math.md | 10 ++- .../test/colorize-results/md-math_md.json | 68 ++++++++++++++++++- 3 files changed, 77 insertions(+), 3 deletions(-) diff --git a/extensions/markdown-math/syntaxes/md-math-block.tmLanguage.json b/extensions/markdown-math/syntaxes/md-math-block.tmLanguage.json index df6c97d9184..43fd1bda5db 100644 --- a/extensions/markdown-math/syntaxes/md-math-block.tmLanguage.json +++ b/extensions/markdown-math/syntaxes/md-math-block.tmLanguage.json @@ -48,7 +48,7 @@ "single_dollar_math_block": { "name": "markup.math.block.markdown", "contentName": "meta.embedded.math.markdown", - "begin": "(?<=^\\s*)(\\${1})(?![^$]*\\${1})", + "begin": "(?<=^\\s*)(\\$)(?![^$]*\\$|\\d)", "beginCaptures": { "1": { "name": "punctuation.definition.math.begin.markdown" diff --git a/extensions/vscode-colorize-tests/test/colorize-fixtures/md-math.md b/extensions/vscode-colorize-tests/test/colorize-fixtures/md-math.md index 1f7a0953e89..a2dad9e3282 100644 --- a/extensions/vscode-colorize-tests/test/colorize-fixtures/md-math.md +++ b/extensions/vscode-colorize-tests/test/colorize-fixtures/md-math.md @@ -152,10 +152,18 @@ a **b** $$ **b** - + Should be highlighted $\frac{1}{2}$. Should not be highlighted $\frac{1}{2}$text Should not be highlighted $\frac{1}{2}$10 + + + +$12.45 + +$12.45 x + +x $12.45 diff --git a/extensions/vscode-colorize-tests/test/colorize-results/md-math_md.json b/extensions/vscode-colorize-tests/test/colorize-results/md-math_md.json index f49f0313a87..51e8f336d91 100644 --- a/extensions/vscode-colorize-tests/test/colorize-results/md-math_md.json +++ b/extensions/vscode-colorize-tests/test/colorize-results/md-math_md.json @@ -6292,7 +6292,7 @@ } }, { - "c": " Should allow inline code to be followed by non word character #136584 ", + "c": " Should allow inline code to be followed by non word character #136584 ", "t": "text.html.markdown comment.block.html", "r": { "dark_plus": "comment: #6A9955", @@ -6466,5 +6466,71 @@ "light_vs": "default: #000000", "hc_black": "default: #FFFFFF" } + }, + { + "c": "", + "t": "text.html.markdown comment.block.html punctuation.definition.comment.html", + "r": { + "dark_plus": "comment: #6A9955", + "light_plus": "comment: #008000", + "dark_vs": "comment: #6A9955", + "light_vs": "comment: #008000", + "hc_black": "comment: #7CA668" + } + }, + { + "c": "$12.45", + "t": "text.html.markdown meta.paragraph.markdown", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "$12.45 x", + "t": "text.html.markdown meta.paragraph.markdown", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "x $12.45", + "t": "text.html.markdown meta.paragraph.markdown", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } } ] \ No newline at end of file