-
Notifications
You must be signed in to change notification settings - Fork 1
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
Switch to Highlight.js syntax highlighting #230
Switch to Highlight.js syntax highlighting #230
Conversation
The one caveat to this is that Highlight.js doesn't seem to support Nunjucks (see supported languages). For the Nunjucks code snippets I’ve set it to use the javascript syntax highlighting, which is what the NHS Service Manual website does too, and that seems to work ok. However, mixed HTML + Nunjucks code doesn’t work that well at all: ![]() There’s possibly a plugin out there that adds proper Nunjucks support though? |
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.
Excellent work, massive improvement 🎉
Added some comments but please don't treat them as blockers
Can easily follow them up another day
Well spotted! I, error, introduced a typo. 😊 Fixed in e0744b5. |
Follow-up issue created in the backlog for exploring a fix for examples that mix HTML and Nunjucks: #231 |
This removes the existing syntax highlighting which uses Prism, which runs client-side, and swaps it for Highlight.js, which runs server-side.
It copies across the colours and styling for both inline code examples and longer code blocks from the NHS Service manual (where they’ve been tweaked to ensure a good colour contrast).
The longer code blocks use a new
codeSnippet
macro, which also takes alanguage
parameter that is passed to Highlight.js and used for syntax highlighting.Resolves #21
Screenshots