summaryrefslogtreecommitdiff
path: root/js/README.duck
blob: dadb6507fd793be156b3ec6731db626ad5e41650 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
= How to build highlight.pack.js

yelp-xsl includes a pre-built copy of highlight.pack.js that includes many
common languages. The default languages are those for which we have test
files. If you want to add to the default languages in yelp-xsl, add a test
code snippet under test/syntax/code, then XInclude it into the test files
for Mallard, DocBook, and DITA under test/syntax. A good place to get test
files is the live demo on highlightjs.org.

[steps]
. Get prerequisites:
* dnf install nodejs
* npm install commander

yelp-xsl also ships with a language definition for Ducktype, which is not
included in the highlight.js repository at this time. It is in the same
directory as this README. You will need to copy it into your clone of the
highlight.js repository.

[steps]
. Build highlight.pack.js with the default yelp-xsl languages:
* git clone https://github.com/highlightjs/highlight.js.git
* cp ducktype.js highlight.js/src/languages/
* cd highlight.js
* node tools/build.js $(find /path/to/yelp-xsl/test/syntax/code/* -exec basename {} \;)
* cp build/highlight.pack.js /path/to/yelp-xsl/js/

You might want to add a language for your local site, keeping all of the
default languages as well.

[steps]
. Build highlight.pack.js with language foo plus the default languages:
* git clone https://github.com/highlightjs/highlight.js.git
* cp ducktype.js highlight.js/src/languages/
* cd highlight.js
* node tools/build.js foo $(find /path/to/yelp-xsl/test/syntax/code/* -exec basename {} \;)
* cp build/highlight.pack.js /path/to/yelp-xsl/js/

Or you might want to trim highlight.pack.js down to just the languages
you know you use.

[steps]
. Build hightlight.pack.js with just languages foo and bar:
* git clone https://github.com/highlightjs/highlight.js.git
* cp ducktype.js highlight.js/src/languages/
* cd highlight.js
* node tools/build.js foo bar
* cp build/highlight.pack.js /path/to/yelp-xsl/js/

[note]
  As of 2016-01-03, highlight.pack.js uses the new anonymous function syntax,
  which may not be supported by the version of node.js on your system. If you
  get an error, look for anonymous functions using the => syntax, and replace
  them like so:

  [code]
  // return del(directories).then(() => done(null, blobs));
  return del(directories).then(function() { done(null, blobs) });