shikijs / shiki

A beautiful yet powerful syntax highlighter
http://shiki.style/
MIT License
10.29k stars 374 forks source link

Incorrect highlighting of HTML in `mdx` blocks #769

Open jasongerbes opened 2 months ago

jasongerbes commented 2 months ago

Validations

Describe the bug

I previous versions of Shiki (^0.14.3), MDX code blocks had correct syntax highlighting for both markdown content and HTML code:

before

However, the latest version of Shiki (1.16.2) lacks syntax highlighting for HTML code within MDX blocks:

after

For reference, here's the MDX code snippet:

# Hello World!

<p className="lead">This is an introductory paragraph for the article.</p>

This is a standard markdown paragraph.

Reproduction

Using the Shiki playground (https://shiki.style), select MDX and paste the code snippet from above

Contributes

antfu commented 2 months ago

It seems there are some changes in the upstream grammar: https://github.com/wooorm/markdown-tm-language/commits/0229d1b8fc37a7dea8cf7225d7713ac8a69621ca/source.mdx.tmLanguage

I don't know yet why it happens tho