Consider using lowlight
wooorm opened this issue · comments
Titus commented
Hi! 👋 I actually don’t use Swift, or this project, but I have spent time thinking about a similar problem: how to use highlight.js if not compiling to HTML.
Highlight.js (and Prism, another popular highlighter in JS) rely heavily on HTML, but I built lowlight and refractor to work around that. Instead, they return JSON, which you could use to create NS strings instead so you don’t need an HTML parser!
This is also what’s used in react-syntax-highlighter and react-native-syntax-highlighter
Anyway, just an idea, feel free to close!
J.P. Illanes commented
That is actually really interesting, I will try to find some time to play with it.