Merge pull request #1597 from ehuss/update-hightlight.js

Update to highlight.js 11.0.
This commit is contained in:
Eric Huss 2021-07-26 13:22:42 -07:00 committed by GitHub
commit 2cf00d0880
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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.
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
- perl
- php
- php-template
- plaintext
- properties
- python
- python-repl
- r
- ruby
- rust
@ -59,6 +61,7 @@ your own `highlight.js` file:
- sql
- swift
- typescript
- vbnet
- x86asm
- xml
- yaml

View File

@ -169,9 +169,9 @@ function playground_text(playground) {
Array
code_nodes
.filter(function (node) {return !node.classList.contains("editable"); })
.forEach(function (block) { hljs.highlightBlock(block); });
.forEach(function (block) { hljs.highlightElement(block); });
} 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

File diff suppressed because one or more lines are too long