slap-editor / editor-widget

Editor widget used by slap-editor/slap
MIT License
23 stars 14 forks source link

Consider lowlight for syntax highlighting #134

Open marionebl opened 8 years ago

marionebl commented 8 years ago

I noticed the rather involved code in the syntax highlighting server using cheerio to extract information from plain highlightjs output. I wonder if it would help code readability and performance to switch to lowlight or even emphasize, if possible.

Do you have interest in a change of this sort? I'd prepare a PR in the course of this week then.

dbkaplun commented 8 years ago

This has been in my mind for some time (slap-editor/slap#117). I think this is a much-needed improvement, and will gladly accept a PR for this if it means we can stop manipulating HTML (read: remove cheerio as a dependency) in order to highlight a file. Although, if it ends up being slower, (which I would find very surprising), then we might have to reconsider.

I'm open to whatever library as long as it's relatively fast. I have not tried lowlight but it looks the best so far. I don't know if we can use emphasize here but you are free to try. Here are some other highlighting libraries I've found: atom/highlights, PrismJS, rse/syntax. Note that some of them also produce HTML so may not be acceptable as alternatives depending on rendering performance.