Skip to content

Commit 3d2a28f

Browse files
committed
Disable math highlighting in markdown fenced code blocks
1 parent 5adddee commit 3d2a28f

File tree

4 files changed

+135
-2
lines changed

4 files changed

+135
-2
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
@@ -1,6 +1,6 @@
11
{
22
"fileTypes": [],
3-
"injectionSelector": "L:text.html.markdown - (comment, string, meta.paragraph.markdown, markup.math.block.markdown)",
3+
"injectionSelector": "L:text.html.markdown - (comment, string, meta.paragraph.markdown, markup.math.block.markdown, markup.fenced_code.block.markdown)",
44
"patterns": [
55
{
66
"include": "#math_block"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"fileTypes": [],
3-
"injectionSelector": "L:meta.paragraph.markdown - (comment, string, markup.math.inline.markdown)",
3+
"injectionSelector": "L:meta.paragraph.markdown - (comment, string, markup.math.inline.markdown, markup.fenced_code.block.markdown)",
44
"patterns": [
55
{
66
"include": "#math_inline"

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,15 @@ $$
6262
\theta % comment
6363
$$
6464
-->
65+
66+
Should be disabled in fenced code blocks:
67+
68+
```txt
69+
$$
70+
\displaystyle
71+
\left( \sum_{k=1}^n a_k b_k \right)^2
72+
\leq
73+
\left( \sum_{k=1}^n a_k^2 \right)
74+
\left( \sum_{k=1}^n b_k^2 \right)
75+
$$
76+
```

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

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3782,5 +3782,126 @@
37823782
"light_vs": "comment: #008000",
37833783
"hc_black": "comment: #7CA668"
37843784
}
3785+
},
3786+
{
3787+
"c": "Should be disabled in fenced code blocks:",
3788+
"t": "text.html.markdown meta.paragraph.markdown",
3789+
"r": {
3790+
"dark_plus": "default: #D4D4D4",
3791+
"light_plus": "default: #000000",
3792+
"dark_vs": "default: #D4D4D4",
3793+
"light_vs": "default: #000000",
3794+
"hc_black": "default: #FFFFFF"
3795+
}
3796+
},
3797+
{
3798+
"c": "```",
3799+
"t": "text.html.markdown markup.fenced_code.block.markdown punctuation.definition.markdown",
3800+
"r": {
3801+
"dark_plus": "default: #D4D4D4",
3802+
"light_plus": "default: #000000",
3803+
"dark_vs": "default: #D4D4D4",
3804+
"light_vs": "default: #000000",
3805+
"hc_black": "default: #FFFFFF"
3806+
}
3807+
},
3808+
{
3809+
"c": "txt",
3810+
"t": "text.html.markdown markup.fenced_code.block.markdown fenced_code.block.language",
3811+
"r": {
3812+
"dark_plus": "default: #D4D4D4",
3813+
"light_plus": "default: #000000",
3814+
"dark_vs": "default: #D4D4D4",
3815+
"light_vs": "default: #000000",
3816+
"hc_black": "default: #FFFFFF"
3817+
}
3818+
},
3819+
{
3820+
"c": "$$",
3821+
"t": "text.html.markdown markup.fenced_code.block.markdown",
3822+
"r": {
3823+
"dark_plus": "default: #D4D4D4",
3824+
"light_plus": "default: #000000",
3825+
"dark_vs": "default: #D4D4D4",
3826+
"light_vs": "default: #000000",
3827+
"hc_black": "default: #FFFFFF"
3828+
}
3829+
},
3830+
{
3831+
"c": "\\displaystyle",
3832+
"t": "text.html.markdown markup.fenced_code.block.markdown",
3833+
"r": {
3834+
"dark_plus": "default: #D4D4D4",
3835+
"light_plus": "default: #000000",
3836+
"dark_vs": "default: #D4D4D4",
3837+
"light_vs": "default: #000000",
3838+
"hc_black": "default: #FFFFFF"
3839+
}
3840+
},
3841+
{
3842+
"c": "\\left( \\sum_{k=1}^n a_k b_k \\right)^2",
3843+
"t": "text.html.markdown markup.fenced_code.block.markdown",
3844+
"r": {
3845+
"dark_plus": "default: #D4D4D4",
3846+
"light_plus": "default: #000000",
3847+
"dark_vs": "default: #D4D4D4",
3848+
"light_vs": "default: #000000",
3849+
"hc_black": "default: #FFFFFF"
3850+
}
3851+
},
3852+
{
3853+
"c": "\\leq",
3854+
"t": "text.html.markdown markup.fenced_code.block.markdown",
3855+
"r": {
3856+
"dark_plus": "default: #D4D4D4",
3857+
"light_plus": "default: #000000",
3858+
"dark_vs": "default: #D4D4D4",
3859+
"light_vs": "default: #000000",
3860+
"hc_black": "default: #FFFFFF"
3861+
}
3862+
},
3863+
{
3864+
"c": "\\left( \\sum_{k=1}^n a_k^2 \\right)",
3865+
"t": "text.html.markdown markup.fenced_code.block.markdown",
3866+
"r": {
3867+
"dark_plus": "default: #D4D4D4",
3868+
"light_plus": "default: #000000",
3869+
"dark_vs": "default: #D4D4D4",
3870+
"light_vs": "default: #000000",
3871+
"hc_black": "default: #FFFFFF"
3872+
}
3873+
},
3874+
{
3875+
"c": "\\left( \\sum_{k=1}^n b_k^2 \\right)",
3876+
"t": "text.html.markdown markup.fenced_code.block.markdown",
3877+
"r": {
3878+
"dark_plus": "default: #D4D4D4",
3879+
"light_plus": "default: #000000",
3880+
"dark_vs": "default: #D4D4D4",
3881+
"light_vs": "default: #000000",
3882+
"hc_black": "default: #FFFFFF"
3883+
}
3884+
},
3885+
{
3886+
"c": "$$",
3887+
"t": "text.html.markdown markup.fenced_code.block.markdown",
3888+
"r": {
3889+
"dark_plus": "default: #D4D4D4",
3890+
"light_plus": "default: #000000",
3891+
"dark_vs": "default: #D4D4D4",
3892+
"light_vs": "default: #000000",
3893+
"hc_black": "default: #FFFFFF"
3894+
}
3895+
},
3896+
{
3897+
"c": "```",
3898+
"t": "text.html.markdown markup.fenced_code.block.markdown punctuation.definition.markdown",
3899+
"r": {
3900+
"dark_plus": "default: #D4D4D4",
3901+
"light_plus": "default: #000000",
3902+
"dark_vs": "default: #D4D4D4",
3903+
"light_vs": "default: #000000",
3904+
"hc_black": "default: #FFFFFF"
3905+
}
37853906
}
37863907
]

0 commit comments

Comments
 (0)