wooorm / refractor

Lightweight, robust, elegant virtual syntax highlighting using Prism

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to use Prism’s `diff` plugin?

ysuzuki19 opened this issue · comments

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!

commented

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 #8 (comment).