shikijs / shiki

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

`remove-notation-escape`: notation escape syntax’s normalize transformer #690

Closed sor4chi closed 1 week ago

sor4chi commented 1 month ago

Clear and concise description of the problem

Hi there, thank you for this wonderful project!

Currently, when using Notation expressions such as // [!code highlight] in Shiki, and you want to render this directly to markdown code, the escape notation // [\!code highlight] is used. However, this expression doesn’t normalize, // [\!code highlight] is output as is.

Suggested solution

https://github.com/shikijs/shiki/blob/a397882fa19d267917c0f8cd59b7717118f4b89f/docs/.vitepress/config.ts#L123-L128

Alternative

Therefore, shiki's docs has created its own transformer to solve this problem. At this time, why not export it as a @shiki/transformers function, or provide built-in support for it?

Additional context

No response

Validations

Contributes

sor4chi commented 1 week ago

I'd like someone's opinion on whether this should go ahead.

antfu commented 1 week ago

Well, feel free to send a PR! Thanks