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

How to enable highlight.js for syntax highlighting of code blocks #5

Open
wants to merge 2 commits into
base: master
from

Conversation

2 participants
@yihui
Owner

yihui commented Jun 21, 2017

Add CSS to <head> in head_custom.html (I'm using the github theme here), and JavaScript to foot_custom.html.

hljs.configure({languages: []}); means highlight.js should not automatically detect languages in <pre>. I set this option because I found the automatic detection was often more annoying than useful, e.g. your R code chunk output could be syntax highlighted, which really should not be.

Preview: https://deploy-preview-5--hugo-xmin.netlify.com/

@yihui yihui added the feature label Jun 22, 2017

@yihui yihui changed the title from How to support highlight.js to How to enable highlight.js for syntax highlighting of code blocks Jun 22, 2017

@dracodoc

This comment has been minimized.

dracodoc commented Mar 20, 2018

I want to add some examples of using different styles. Here are some styles hosted in cdn. And here are some demos.

I just replaced the line in layout/partials/head_custom.html to a different css and it worked.

yihui added some commits Jun 21, 2017

match the background of pre with code (the github theme of highlight.…
…js defined the background of code to be #f8f8f8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment