Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
doc,tools: properly syntax highlight API ref docs
Prior to this commit, all <pre> tags were being
highlighted as JavaScript. This has been corrected
to syntax highlight all languages appearing in the
API reference docs. This was accomplished by using
highlight.js instead of SHJS for the frontend lib.

* remove SHJS JavaScript code
* add highlight.js bundle
* fix script tags to reflect replacement
* migrate CSS to use highlight.js classes
* add appropriate documentation
* ensure api_assets README.md stays interal

Fixes: #33363
  • Loading branch information
Derek Lewis committed May 17, 2020
commit 0bc8b9af44a06bf4b92b065bcc1af4934bde6735
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ out/doc/api/assets:

# If it's not a source tarball, we need to copy assets from doc/api_assets
out/doc/api/assets/%: doc/api_assets/% out/doc/api/assets
@cp $< $@
@cp $< $@ ; $(RM) out/doc/api/assets/README.md


run-npm-ci = $(PWD)/$(NPM) ci
Expand Down
27 changes: 27 additions & 0 deletions doc/api_assets/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# API Reference Document Assets

## highlight.pack.js

_Generated by [highlightjs.org/download][] on 2020-05-16._

Grammars included in the custom bundle:

* Bash
* C
* C++
* CoffeeScript
* JavaScript
* JSON
* Markdown
* Plaintext
* Shell Session

## sh.css

The syntax theme for code snippets in API reference documents.

## style.css

The main stylesheet for API reference documents.

[highlightjs.org/download]: https://highlightjs.org/download/
6 changes: 6 additions & 0 deletions doc/api_assets/highlight.pack.js

Large diffs are not rendered by default.

16 changes: 7 additions & 9 deletions doc/api_assets/sh.css
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
.sh_sourceCode {
.hljs {
Comment thread
DerekNonGeneric marked this conversation as resolved.
font-weight: normal;
font-style: normal;
}

.sh_sourceCode .sh_symbol,
.sh_sourceCode .sh_cbracket {
.hljs-symbol {
color: #333;
}

.sh_sourceCode .sh_keyword {
.hljs-keyword {
color: #338;
}

.sh_sourceCode .sh_string,
.sh_sourceCode .sh_regexp,
.sh_sourceCode .sh_number,
.sh_sourceCode .sh_specialchar {
.hljs-string,
.hljs-regexp,
.hljs-number {
color: #E54305;
}

.sh_sourceCode .sh_comment {
.hljs-comment {
color: #666;
font-weight: lighter;
}
1 change: 0 additions & 1 deletion doc/api_assets/sh_javascript.min.js

This file was deleted.

Loading