@mrbbot/hilite v1.2.0
Hilite
Highlights code in bulk, and then exports an HTML and a PDF file.
Installation
Install it globally using npm or Yarn.
npm i -g @mrbbot/hilite
yarn global add @mrbbot/hiliteUsage
To highlight all files in the src directory, and output index.html and index.pdf in the current directory run the
following command:
hilite srcYou can specify as many locations to highlight so if you also wanted to highlight files in the dist directory:
hilite src distYou can also specify globs to match:
hilite src/**/*.jsIf you want to change the output file names, you can use the --output (-o) flag. For example, the following command
will output to code.html and code.pdf instead of the normal index:
hilite src -o codeAdditionally, if you're just looking for HTML output, you can disable the PDF export with the --pdf (-p) flag:
hilite src -p falseThis will only generate an index.html file.
Customisation
Prism Theme
Hilite uses Prism for code highlighting, so if you don't like the default theme, you can easily change it using the --theme (-t) flag to either one of the
presets, or your own custom one.
If you wanted to change the output to use the funky theme:
hilite src -t funkyOther available presets are:
- default (this is the actual default prism theme, Hilite uses its own simplified version normally)
- dark
- okaidia
- twilight
- coy
- solarized-light
- tomorrow-night
If you had a custom theme stored in theme.css, you could use it with the following command:
hilite src -t theme.cssHeading Level
You can change the level of the code filename headings with the --level (-l) flag. For instance to use <h2> tags
instead of the default <h1>s:
hilite src -l 2Margin
Finally, you can also change the amount of margin in the PDF export using the --margin (-m) flag.
hilite src -m 1inYou must include the unit in your value.