
Introduces the gr-syntax-layer element. This element works as an annotation layer that is configured with the diff and asynchronously computes/applies syntax for the diff. Introduces a custom build of Highlight.js which gr-syntax-layer makes use of. Building the script is documented in scripts/vendor/highlight/building.md. The layer is connected to the annotation pipeline in gr-diff-builder as the lowest layer and syntax processing is triggered only after a diff has been completely rendered. A number of styles are added to the gr-diff element for syntax markers. Tests added for gr-syntax-layer. Bug: Issue 3916 Change-Id: Ic33e40f4fe39dfce1a62de133cfaf32be5e3f25a
46 lines
1.4 KiB
Markdown
46 lines
1.4 KiB
Markdown
# Building Highlight.js for Gerrit
|
|
|
|
Highlight JS needs to be built with specific language support. Here are the
|
|
steps to build the minified file that appears here.
|
|
|
|
NOTE: If you are adding support for a language to Highlight.js make sure to add
|
|
it to the list of languages in the build command below.
|
|
|
|
## Prerequisites
|
|
|
|
You will need:
|
|
|
|
* nodejs
|
|
* closure-compiler
|
|
* git
|
|
|
|
## Steps to Create the Pack File
|
|
|
|
The packed version of Highlight.js is an un-minified JS file with all of the
|
|
languages included. Build it with the following:
|
|
|
|
$> # start in some temp directory
|
|
$> git clone https://github.com/isagalaev/highlight.js.git
|
|
$> cd highlight.js
|
|
$> node tools/build.js -n json css xml html javascript cpp go haskell \
|
|
markdown perl python bash sql scala prolog java objectivec
|
|
|
|
The resulting JS file will appear in the "build" directory of the Highlight.js
|
|
repo under the name "highlight.pack.js".
|
|
|
|
## Minification
|
|
|
|
Minify the file using closure-compiler using the command below. (Modify
|
|
`/path/to` with the path to your compiler jar.)
|
|
|
|
$> java -jar /path/to/closure-compiler.jar \
|
|
--js build/highlight.pack.js \
|
|
--js_output_file build/highlight.min.js
|
|
|
|
Copy the header comment that appears on the first line of
|
|
build/highlight.pack.js and add it to the start of build/highlight.min.js.
|
|
|
|
## Finish
|
|
|
|
Copy the resulting build/highlight.min.js file to lib/highlightjs
|