-
Notifications
You must be signed in to change notification settings - Fork 582
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace prettify.js with highlight.js #1578
Conversation
The commit history is all messed up. Ideally we want one squashed commit for the whole feature. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blocked until the commit history is fixed.
@kraih thanks, I rebased against latest master now and squashed it all to a single commit 💪 |
lib/Mojolicious/resources/public/mojo/highlight.js/highlight-mojo-light.css
Outdated
Show resolved
Hide resolved
lib/Mojolicious/resources/public/mojo/highlight.js/highlight-mojo-dark.css
Show resolved
Hide resolved
lib/Mojolicious/resources/public/mojo/highlight.js/highlight-mojo-dark.css
Outdated
Show resolved
Hide resolved
80ae299
to
b857dde
Compare
lib/Mojolicious/resources/public/mojo/highlight.js/highlight-mojo-dark.css
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That looks much better now.
lib/Mojolicious/resources/public/mojo/highlight.js/highlight-mojo-dark.css
Outdated
Show resolved
Hide resolved
This pull request is now in conflicts. Could you fix it @zakame? 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a good change in general, but I am curious if we need to support all the languages in highlight.js/highlight.js.min. Limiting the supported languages to bash, css, diff, http, javascript, json, makefile, xml, perl, plaintext, shell, and sql slims down the file from 100k to 45k. Maybe we can limit it even further?
Good idea, we can probably start from that set then drill down further if need? Maybe we can trim Makefile and diff out as well (since I suspect we won't be able to see these under debug.html anyway?) I'll also update again to latest version, 10.3.1 was just released. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a fan of highlight.js and use it in other things.
Originally based from work by @dotandimet. Additional changes: * highlight.js: Update to latest (10.3.1) Install custom build limiting highlights for diff, plaintext, makefile, bash, html/xml, sql, css, and perl only, to reduce from the normal common pack size (100k to just 40k.) This also adds the Mojolicious language plugin for highlight.js. * debug.html.ep: Simplifiy highlight.js loading Follow https://highlightjs.org/usage for this case, it seems more reliable to let it highlight as well as determine the language to be highlighted on its own. * highlight-mojo-dark.css: Remake based on newer upstream dark theme * Drop highligh-mojo-light.css No longer needed here. * Mojolicious.pm: Add license section for highlight.js * Remove prettify.js highlight.js now replaces it. Thanks for the service, prettify.js!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the new slimmed down version of the language pack is great, so I'm in favor of this change now.
Thanks again everyone! 🎉 |
Summary
This replaces the old prettify.js highlighter with highlight.js.
Motivation
prettify.js has long been abandoned by Google so we need to replace it.
That said, highlight.js is also somewhat dormant (highlightjs/highlight.js#1678) but still sees enough activity to get around.
References
This is an update of #737, fixes #1544.
Most of the work was already done by @dotandimet, please give credit where due. I just updated it for latest Mojo and highlight.js 💪