Skip to content

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

@adamdehaven

Description

@adamdehaven

This issue replicates the findings reported here: shikijs/textmate-grammars-themes#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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions