Closed markleary closed 3 years ago
same problem, please update to highlight.js 9.10.0
The common configuration of highlight.js misses my beloved YAML :sob:
The language selection in the common configuration is quite limited. The full pack is quite heavy (526kb) though, so I think a selection must be made. The problem is, node is required to build the library and so it might be impossible on most setups to provide a custom selection in the backend of this plugin. One way out of this misery might be to offer a couple of prebuild selections with different amounts of languages build in.
I am willing to help to pick some selections.
For reference, this is the common configuration of highlight.js:
apache
bash
coffeescript
cpp
cs
css
diff
http
ini
java
javascript
json
makefile
markdown
nginx
objectivec
perl
php
python
ruby
shell
sql
xml
And all other languages:
1c
abnf
accesslog
actionscript
ada
applescript
arduino
armasm
asciidoc
aspectj
autohotkey
autoit
avrasm
awk
axapta
basic
bnf
brainfuck
cal
capnproto
ceylon
clean
clojure
clojure-repl
cmake
coq
cos
crmsh
crystal
csp
dart
delphi
django
d
dns
dockerfile
dos
dsconfig
dts
dust
ebnf
elixir
elm
erb
erlang
erlang-repl
excel
fix
flix
fortran
fsharp
gams
gauss
gcode
gherkin
glsl
go
golo
gradle
groovy
haml
handlebars
haskell
haxe
hsp
htmlbars
hy
inform7
irpf90
jboss-cli
julia
julia-repl
kotlin
lasso
ldif
leaf
less
lisp
livecodeserver
livescript
llvm
lsl
lua
mathematica
matlab
maxima
mel
mercury
mipsasm
mizar
mojolicious
monkey
moonscript
n1ql
nimrod
nix
nsis
ocaml
openscad
oxygene
parser3
pf
pony
powershell
processing
profile
prolog
protobuf
puppet
purebasic
q
qml
rib
r
roboconf
routeros
rsl
ruleslanguage
rust
scala
scheme
scilab
scss
smali
smalltalk
sml
sqf
stan
stata
step21
stylus
subunit
swift
taggerscript
tap
tcl
tex
thrift
tp
twig
typescript
vala
vbnet
vbscript-html
vbscript
verilog
vhdl
vim
x86asm
xl
xquery
yaml
zephir
How can one compile a new library with Node?
Building a custom version of highlightjs is rather simple. It is described in the documentation of highlightjs.
For my purposes I used:
node tools/build.js -t webbrowser :common arduino asciidoc cmake django dockerfile fortran fsharp gcode go haskell julia kotlin lua mathematica matlab openscad powershell qml rust scheme scilab scss tex twig vala vbnet yaml
resulting filesize: 161.1 kB
I just stumbled on the CDN option for building the library
node tools/build.js -t cdn -
This will produce a highlight.min.js
(7.9 kB) and seperate files for every language e.g languages/yaml.min.js
. This way languages can be added individually with <script src=".../languages/yaml.min.js"></script>
. I guess a custom selection of languages in the configuration of this plugin can be implemented upon this.
You can download your languages of choice from the official Homepage. Just use the checkboxes. In the downloaded zip file you will find a highlight.pack.js
Just copy it to your Grav installation to user/plugins/highlight/js/highlight.pack.js and overwrite the one which came with the plugin
For what it's worth, with #24 we would update to latest version of highlight.js which does support more languages as part of its common group:
See the source here: https://highlightjs.org/download/
I also manually enabled Twig support.
This has been merged
It seems the bundled highlight.pack.js only has the base set of languages. There were several additional ones I needed, so I downloaded a new highlight.pack.js. But I believe this will be overwritten if I update the plugin. For performance reasons, maybe it is not a good idea to bundle all languages, but it would be nice to be able to set a custom js file in the theme config.