Switch to Highlight.js - #149
Conversation
As discussed in nevir#134
|
Just to mention: the figures from “pygments takes 9.5s ” are the result of forking one process per source-file in groc. 😏 |
Just add `"highlighter": "pygments"` to your `.groc.json` or use the `--highlighter=pygments` flag.
|
Voilá, I would like to refactor the highlighting stylesheets next, but it's not really important and also a whole other issue. Ideally, I'd like to try to create one for all highlighters, just by using SASS variables. (It would also be nice if there was more than one design and if one could compile the SASS sources using libsass.) |
|
love the cli option. also like not depending on python 😄 |
|
Any news when this will be merged? I'd really like to tell npm to use |
|
+1 |
|
For all those who are waiting on this PR: Over the last week or so I've been writing an alternative implementation of groc. The main differences are that it
It's quite stable right now but probably hasn't been tested enough. You can find the project at https://github.com/killercup/grock. I want to thank the groc authors very much -- some of the "hard parts" (splitting code and comments, list doc tags and languages) are borrowed code groc. Without those it wouldn't have been possible to implement any of this functionality this quickly. |
|
+1 for this |
|
👍 |
1 similar comment
|
+1 |
|
Months late, but thanks for this - merged :) |
As discussed in #134.
I chose to switch to highlight.js because I dislike the python dependency and how slow the invocation of child processes is. To render groc's own documentation, groc with pygments takes 9.5s on my machine, whereas groc with highlight only needs 3s (medium of 5 tests).
This pull request also includes my crude attempt at converting the original stylesheet to a highlight-compatible format (in SCSS) and adds the
highlightJSkey to some language definitions where the name highlight uses differs from pygment's.In general, I'm only changing thehighlightCodemethod inutils.coffee. If you want to keep pygments available, I suggest you changehighlightCodeto call specific methods depending on an option, e.g.highlightCodeHighlightJSandhighlightCodePygments.I've replaced
highlightCodewithhighlightCodeUsingHighlighJSandhighlightCodeUsingPygments. You can set your highlighter preference using the 'highlighter' CLI option or.groc.jsonproperty.Stay tuned for my next PR to switch to marked.js.