Update to highlight.js 11.0.

This commit is contained in:
Eric Huss 2021-07-06 11:38:27 -07:00
parent 8d131b4310
commit 6dd785ea6c
4 changed files with 1350 additions and 7 deletions

View File

@ -115,3 +115,16 @@ If possible, do your best to avoid breaking older browser releases.
Any change to the HTML or styling is encouraged to manually check on as many browsers and platforms that you can. Any change to the HTML or styling is encouraged to manually check on as many browsers and platforms that you can.
Unfortunately at this time we don't have any automated UI or browser testing, so your assistance in testing is appreciated. Unfortunately at this time we don't have any automated UI or browser testing, so your assistance in testing is appreciated.
## Updating higlight.js
The following are instructions for updating [highlight.js](https://highlightjs.org/).
1. Clone the repository at <https://github.com/highlightjs/highlight.js>
1. Check out a tagged release (like `11.0.0`).
1. Run `npm install`
1. Run `node tools/build.js :common apache armasm coffeescript d handlebars haskell http julia nginx properties r scala x86asm yaml`
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`.
1. Copy `build/highlight.min.js` to mdbook's directory [`highlight.js`](https://github.com/rust-lang/mdBook/blob/master/src/theme/highlight.js).
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.
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.)

View File

@ -47,9 +47,11 @@ your own `highlight.js` file:
- objectivec - objectivec
- perl - perl
- php - php
- php-template
- plaintext - plaintext
- properties - properties
- python - python
- python-repl
- r - r
- ruby - ruby
- rust - rust
@ -59,6 +61,7 @@ your own `highlight.js` file:
- sql - sql
- swift - swift
- typescript - typescript
- vbnet
- x86asm - x86asm
- xml - xml
- yaml - yaml

View File

@ -169,9 +169,9 @@ function playground_text(playground) {
Array Array
code_nodes code_nodes
.filter(function (node) {return !node.classList.contains("editable"); }) .filter(function (node) {return !node.classList.contains("editable"); })
.forEach(function (block) { hljs.highlightBlock(block); }); .forEach(function (block) { hljs.highlightElement(block); });
} else { } else {
code_nodes.forEach(function (block) { hljs.highlightBlock(block); }); code_nodes.forEach(function (block) { hljs.highlightElement(block); });
} }
// Adding the hljs class gives code blocks the color css // Adding the hljs class gives code blocks the color css

File diff suppressed because one or more lines are too long