-
Notifications
You must be signed in to change notification settings - Fork 19
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 #22
Conversation
ec6fdd5
to
43c1e46
Compare
Will this change how things look at all? Any chance of a screenshot? The markup looks cleaner to me. |
There's a few here:
I can add a few more here, hold on. |
So the diagrams are broken now, that's unfortunate. |
Let me check on fixing those diagrams. Here's the (unstyled) current prettify version of https://docs.mojolicious.org/Mojolicious/Guides/Cookbook for reference: |
Updated, this also bumps highlight.js to 10.3.2 per https://github.com/highlightjs/highlight.js/releases/tag/10.3.2 and also adding some plugins for Cookbook listings (e.g. Apache/Nginx/Systemd/YAML configs.) |
%= javascript '/mojolicious/highlight.js/nginx.min.js' | ||
%= javascript '/mojolicious/highlight.js/yaml.min.js' | ||
%= stylesheet '/mojolicious/highlight.js/highlight-mojo-light.css' | ||
<script>hljs.initHighlightingOnLoad();</script> |
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 it’s better to start highlighting right before instead of onload()
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.
Just following what's on the tin: https://highlightjs.org/usage/
There's also option for customizing the load, but it still attaches to DOMContentLoaded
; let me know if you have a better suggestion.
* Add highlight.js, highlight-mojo-light.css and plugins Start of try replacing prettify.js with highlight.js * Update templates for highlight.js * Mojolicious::Plugin::MojoDocs: Revise highlighting logic for code blocks Filter out code blocks we want highlighted, then apply "nohighlight" to those we don't, while preserving existing CSS classes (if any.) * Remove prettify.js and css Thanks for the service!
Updated to rebundle highlight + plugins used here as one file and rebased to latest. |
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.
LGTM
Thanks again everyone! 🎉 |
Thank you. |
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.
References
mojolicious/mojo#1544
mojolicious/mojo#1578