HowTo: add highlightjs syntax highlighting to fossil without new grey hair
(1) By Stephan Beal (stephan) on 2019-12-17 17:27:28 [source]
HighlightJS is a fairly lightweight1 syntax-highlighting library for JS which is, it turns out, quite easy to integrate with fossil. Here's a HowTo which i wrote primarily so that i don't have to re-learn it from scratch next time:
https://fossil.wanderinghorse.net/r/cwal/doc/trunk/doc/highlightjs/README.md
That doc is far longer than it needs to be - the process is boils down to:
Add 1 line to the skin header (which, however, requires that one override the
<HEAD>
element which fossil normally injects and doesn't come pre-installed in the skins).Add 2-5 lines of JS (depending on how you'd like to wrap it) to the page footer.
That page demonstrates not only the process of integrating it, but also the highlighting itself, using their "AndroidStudio" color scheme (they've got tons and tons of color schemes to choose from, but apparently not a single line of documentation for how to install one).
- ^ i'm using a custom build of highlightjs, generated directly from their website (see the README for the link), to pare it down to the syntax highlighting sets the sight "might" use. The JS file is 42kb, and only 17kb after fossil compresses it for HTTP transport. The single CSS file is less than 1kb.