wooorm / refractor

Lightweight, robust, elegant virtual syntax highlighting using Prism
MIT License
722 stars 33 forks source link

How to use Prism’s `diff` plugin? #60

Closed ysuzuki19 closed 2 years ago

ysuzuki19 commented 2 years ago

Thank you for implement great library!

I use this library within @mapbox/rehype-prism.

I want to multiple syntax highlight like as diff-typescript or typescript-diff, but it is unavailable. the log is following message.

Error: Unknown language: `diff-typescript` is not registered

In @mapbox/rehype-prism, run following line with diff-typescript.

      result = refractor.highlight(nodeToString(node), lang);

Is there a way to solve this issue like piping multiple syntax (difftypescript)?

Thanks!

wooorm commented 2 years ago

You link to a Prism plugin. This project does not support Prism plugins: https://github.com/wooorm/refractor#compatibility.

You can do similar things on the AST though. Something like https://github.com/wooorm/refractor/issues/8#issuecomment-852788226.