Skip to content

Commit b29532c

Browse files
committed
Update to highlight.js 11.0.
1 parent 56652e8 commit b29532c

File tree

4 files changed

+1350
-7
lines changed

4 files changed

+1350
-7
lines changed

CONTRIBUTING.md

+13
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,16 @@ and [rustfmt](https://github.com/rust-lang/rustfmt) on the code first.
106106
This is not a requirement though and will never block a pull-request from being merged.
107107
108108
That's it, happy contributions! :tada: :tada: :tada:
109+
110+
## Updating higlight.js
111+
112+
The following are instructions for updating [highlight.js](https://highlightjs.org/).
113+
114+
1. Clone the repository at <https://github.com/highlightjs/highlight.js>
115+
1. Check out a tagged release (like `11.0.0`).
116+
1. Run `npm install`
117+
1. Run `node tools/build.js :common apache armasm coffeescript d handlebars haskell http julia nginx properties r scala x86asm yaml`
118+
1. Compare the language list that it spits out to the one in [`syntax-highlighting.md`](https://github.com/camelid/mdBook/blob/master/guide/src/format/theme/syntax-highlighting.md). If any are missing, add them to the list and rebuild (and update these docs). If any are added to the common set, add them to `syntax-highlighting.md`.
119+
1. Copy `build/highlight.min.js` to mdbook's directory [`highlight.js`](https://github.com/rust-lang/mdBook/blob/master/src/theme/highlight.js).
120+
1. Be sure to check the highlight.js [CHANGES](https://github.com/highlightjs/highlight.js/blob/main/CHANGES.md) for any breaking changes. Breaking changes that would affect users will need to wait until the next major release.
121+
1. Build mdbook with the new file and build some books with the new version and compare the output with a variety of languages to see if anything changes. (TODO: It would be nice to have a demo file in the repo to help with this.)

guide/src/format/theme/syntax-highlighting.md

+3
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ your own `highlight.js` file:
4747
- objectivec
4848
- perl
4949
- php
50+
- php-template
5051
- plaintext
5152
- properties
5253
- python
54+
- python-repl
5355
- r
5456
- ruby
5557
- rust
@@ -59,6 +61,7 @@ your own `highlight.js` file:
5961
- sql
6062
- swift
6163
- typescript
64+
- vbnet
6265
- x86asm
6366
- xml
6467
- yaml

src/theme/book.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,9 @@ function playground_text(playground) {
160160

161161
Array
162162
.from(document.querySelectorAll('code:not(.editable)'))
163-
.forEach(function (block) { hljs.highlightBlock(block); });
163+
.forEach(function (block) { hljs.highlightElement(block); });
164164
} else {
165-
code_nodes.forEach(function (block) { hljs.highlightBlock(block); });
165+
code_nodes.forEach(function (block) { hljs.highlightElement(block); });
166166
}
167167

168168
// Adding the hljs class gives code blocks the color css

src/theme/highlight.js

+1,332-5
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)