-
-
Notifications
You must be signed in to change notification settings - Fork 382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@shikijs/markdown-it doesn't seem to work with markdown-it-attrs #852
Comments
Can also reproduce. I'm trying to migrate from Prism to Shiki on my blog and I followed the docs' recommendation to use custom delimiters. I'm doing this in my Markdown: ```js [data-property="value"]
``` But all the custom attributes on fenced code blocks are getting swallowed by Shiki. I couldn't figure out a way to extract them in a transform. |
I was curious how some of the out-of-the-box transforms worked, so I looked through the code and found this: shiki/packages/transformers/src/transformers/meta-highlight.ts Lines 32 to 48 in 64f1453
Note in particular L45 and L48. The solution for me was to:
In a custom transform, you can then access the header string under For example, given this input (which doesn't even need the curly braces): ```js {property=value}
```
|
Validations
Describe the bug
Hi,
I'm attempting to use the @shikijs/markdown-it plugin with markdown-it-attrs, but the attributes defined in markdown disappear when using shiki.
Documentation mentions some past conflict with line highlighting and markdown-it-attrs, but even the suggested changing delimiters doesn't help, see reproduction below.
Reproduction
https://gist.github.com/kari/d83bb38fbf76ba3b3487d023f2363a11
Contributes
The text was updated successfully, but these errors were encountered: