Include Prism diff-highlight
under review
Remi Rousselet
It seems that Docusaurus includes Prism's language-diff by default. But it doesn't include
diff-highlight
, so diffs are colorlessIf not, it would be interesting to have a documentation about how to add plugins.
I've asked that on StackOverflow, and spent a few hours playing with
swizzle CodeBlock
, without successJoshua Chen
under review
Hey, in case anyone's still interested: it recently came to my attention that Prism-react-renderer may _not_ allow you to do this. (I'm happy to be proven wrong.)
However, I've implemented an alternative solution here: https://github.com/typescript-eslint/typescript-eslint/pull/5099 and it's live here: https://typescript-eslint.io/docs/linting/#community-configs
We'll consider making this an official API (i.e. custom line highlight colors, original syntax highlight), only using diff syntax highlight when you explicitly use the diff language. We'll not use the
diff-highlight
plugin, but use a Docusaurus theme-based API instead. But just so that you know, this is already possible in userland.Joshua Chen
closed
I'll close this, because if you need additional Prism modules, you can swizzle
prism-include-languages
, which allows you to do anything with the Prism instance that's passed to the code block.X
Xomega .Net
Joshua Chen: Would it be possible to provide an example of how to do highlighting for both the diff and the language syntax using https://prismjs.com/plugins/diff-highlight/?
We can use ```
diff, which only highlights the added/removed lines marked with +/-, but we would like to use something like
```diff-xml, which would also use the XML syntax highlighting.L
Lucas Picchi
X
Xomega .Net
Lucas Picchi we ended up using magic comments for this, but thanks for working on this.