Code block treatment breaks compatibility with some rehype plugins?
See original GitHub issueWas trying to get https://github.com/rsclarke/rehype-shiki to work. It lets you syntax highlight with any VSCode theme. It wasn’t working, so I dug into it: it just walks the tree lookiing for pre
tags wrapping a code
tag.
But, it seems MDsvex is doing something special with @html
that breaks this https://github.com/pngwn/MDsveX/blob/master/packages/mdsvex/test/it/code_highlighting.test.ts#L64
I’m just going to use the built-in syntax highlighting for now, but just making a note of this with this issue
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
rehype-highlight - unified
rehype plugin to highlight code blocks with lowlight (highlight.js) ... Some of them are great choices but some are broken. As anyone can...
Read more >Transforming Markdown with Remark & Rehype - ryanfiller.com
Writing custom plugins to give extra powers to Markdown syntax using the Unified ecosystem.
Read more >rehype-prism-plus - npm
rehype plugin to highlight code blocks in HTML with Prism (via refractor) with line highlighting and line numbers. Latest version: 1.5.0, ...
Read more >1 Code::Blocks Project Management
This view show all the projects opened in Code::Blocks at a certain time. The 'Symbols' tab of the Management window shows symbols, variables...
Read more >Create a Markdown Blog Using Next.js - Joy of Code
Using the rehype-prism-plus Markdown plugin from earlier we break the code into tokens using Prism that has a lot of themes we can...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Okay I got around it again by using the custom highlight function 😄
Working great:
Yeah, you can apply any textmate grammar at all which is better than Prism’s non-standard grammar (even though they have some similarities) as you don’t need to write a new grammar when you’re doing something funky.
The other reason is more selfish, the way Prism is built makes it incredibly difficult to work with in various contexts. It is really quite frustrating and makes a mess of my code due to the UMD format that it publishes.
shiki
is much friendlier in that regard.