We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
At present, some common advanced features of code highlighting plug-ins cannot work properly, such as highlighted lines.
Because the most of code-highlighting plug-ins implement these advanced features by code blocks meta, like this:
```js {1,3-4} // highlighted-line // console.log('foo') // highlighted-line console.log('bar') // highlighted-line ```
But in Velite's markdown process, rehype-raw is used to process the rehype tree before loading the custom rehypePlugins.
rehype-raw
rehypePlugins
However, rehype-raw will lead to the loss of metadata, refer to:
The text was updated successfully, but these errors were encountered:
import { unified } from 'unified' import rehypeRaw from 'rehype-raw' import remarkParse from 'remark-parse' import remarkRehype from 'remark-rehype' import rehypeStringify from 'rehype-stringify' import rehypePrettyCode from 'rehype-pretty-code' import { inspect } from 'unist-util-inspect' const text = ` <img src="https://example.com/image.png" alt="Example image" /> \`\`\`js {1} import React from 'react' \`\`\` ` const file = await unified() .use(remarkParse) .use(remarkRehype, { allowDangerousHtml: true }) .use(() => tree => console.log('before rehypeRaw', inspect(tree), '\n')) .use(rehypeRaw) .use(() => tree => console.log('after rehypeRaw', inspect(tree), '\n')) .use(rehypePrettyCode) .use(rehypeStringify) .process(text) console.log(file.toString())
Sorry, something went wrong.
aa704be
rehype-shikiji
node.properties
No branches or pull requests
TL;DR
At present, some common advanced features of code highlighting plug-ins cannot work properly, such as highlighted lines.
Explains
Because the most of code-highlighting plug-ins implement these advanced features by code blocks meta, like this:
But in Velite's markdown process,
rehype-raw
is used to process the rehype tree before loading the customrehypePlugins
.However,
rehype-raw
will lead to the loss of metadata, refer to:The text was updated successfully, but these errors were encountered: