refractor
Closed this issue · 4 comments
a lot of the work you’re doing in this plugin is already done by refractor, you might want to check that out! https://github.com/wooorm/refractor
that is really helpful, will definitely test a change to take advantage the work done by refractor 👌
I do notice that refractor does not support plugins, so I'll either try a PR on it to support plugins or will have to understand if that can done on this side. Will evaluate all options ;)
It indeed doesn’t, the reason is that prism plugins are highly coupled to the DOM. Most folks can do without them, and then it’s much faster with refractor. Although, as you know, refractor results in an AST, so there could be alternatives built on the AST instead of DOM level!
After looking at refractor and it's trade-offs I still wanted to be able to use plugins in a safe way. I did like that returns a tree rather than strings (like I was mostly doing).
So I re-wrote large chunks of this module to work more like refractor, but still allow to use plugins: 6f5da71
Again, thank you for your suggestion 👍