-
-
Notifications
You must be signed in to change notification settings - Fork 362
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
yihui
wants to merge
1
commit into
master
Choose a base branch
from
feature/highlight.js
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was referenced Jun 21, 2017
yihui
changed the title
How to support highlight.js
How to enable highlight.js for syntax highlighting of code blocks
Jun 22, 2017
yihui
force-pushed
the
feature/highlight.js
branch
2 times, most recently
from
July 3, 2017 18:18
8f67c83
to
1d7df7d
Compare
yihui
force-pushed
the
feature/highlight.js
branch
3 times, most recently
from
July 13, 2017 07:08
a9e043a
to
cbc827a
Compare
yihui
force-pushed
the
feature/highlight.js
branch
from
August 14, 2017 20:28
cbc827a
to
258cdb6
Compare
yihui
force-pushed
the
feature/highlight.js
branch
from
August 29, 2017 03:02
258cdb6
to
057e1d8
Compare
yihui
force-pushed
the
feature/highlight.js
branch
from
October 8, 2017 14:24
057e1d8
to
4a094f3
Compare
yihui
force-pushed
the
feature/highlight.js
branch
from
October 27, 2017 03:17
4a094f3
to
6b86ec0
Compare
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 |
yihui
force-pushed
the
feature/highlight.js
branch
from
March 21, 2018 15:39
6b86ec0
to
9ca5ce8
Compare
yihui
force-pushed
the
feature/highlight.js
branch
from
August 30, 2018 15:02
9ca5ce8
to
17ff9dc
Compare
yihui
force-pushed
the
feature/highlight.js
branch
from
October 1, 2018 14:33
17ff9dc
to
f71cd19
Compare
yihui
force-pushed
the
feature/highlight.js
branch
from
March 20, 2019 02:59
f71cd19
to
f408c9c
Compare
yihui
force-pushed
the
feature/highlight.js
branch
from
April 18, 2019 19:01
f408c9c
to
4384fab
Compare
yihui
force-pushed
the
feature/highlight.js
branch
from
March 17, 2020 03:07
4384fab
to
c7d1f49
Compare
yihui
force-pushed
the
feature/highlight.js
branch
from
July 24, 2020 19:48
c7d1f49
to
fe1d630
Compare
yihui
force-pushed
the
feature/highlight.js
branch
2 times, most recently
from
October 11, 2020 20:55
d2ad7e1
to
1fef437
Compare
yihui
force-pushed
the
feature/highlight.js
branch
2 times, most recently
from
June 15, 2022 03:56
5121eca
to
1410032
Compare
yihui
force-pushed
the
feature/highlight.js
branch
from
February 5, 2024 14:58
1410032
to
c842f45
Compare
yihui
force-pushed
the
feature/highlight.js
branch
from
March 4, 2024 02:23
c842f45
to
97c1b05
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add CSS to
<head>
inhead_custom.html
(I'm using thegithub
theme here), and JavaScript tofoot_custom.html
.highlight.min.js
supports common languages here: https://highlightjs.org/download/ As an example, I addedr.min.js
to support R. To add support for any other languages, find their filenames on https://cdnjs.com/libraries/highlight.js.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/