vscode-comark icon indicating copy to clipboard operation
vscode-comark copied to clipboard

mdc language should support a single alpha character as MDC block component

Open adamdehaven opened this issue 1 year ago • 0 comments

This issue replicates the findings reported here: https://github.com/shikijs/textmate-grammars-themes/issues/137


Referencing the line here: https://github.com/nuxtlabs/vscode-mdc/blob/892432874be99282bbf5171eb0d015e9f23a8d09/syntaxes/mdc.tmLanguage.json#L141

I believe the expression for MDC component block matching should be updated to only require a single word character (rather than two) after the leading :{2,} pattern in order to account for native Prose* components such as ProseA and ProseP in MDC.

[!Note] Please verify with shikijs, @antfu, and @farnabaz for proper functionality and matching across repositories, and I believe they would also want to make the change here: https://github.com/shikijs/textmate-grammars-themes/blob/33485630b9b9335b86b5207c60aeb634f8622a6b/packages/tm-grammars/raw/mdc.json#L166

Reproduction

Utilizing the syntax highlighter playground from the homepage of https://shiki.style, paste this content into the live editor:

<!-- ✅ Proper highlighting -->
::card
---
foo: "bar"
---
::

:card{ foo="bar" }
 
<!-- ⚠️ Incorrect highlighting (only for block components) -->
::a
---
href: "https://example.com"
---
::

<!-- ✅ Proper highlighting (only for inline components) -->
:a{ href="https://example.com" }

Output

Image

adamdehaven avatar Apr 05 '25 18:04 adamdehaven