Home  Home  Home  Contact  Contact  Contact  Stuff  Stuff  Stuff
 Blog  Blog  Blog  FAQ  FAQ  FAQ
 Home  Home  Home  Contact  Contact  Contact  Stuff  Stuff  Stuff
 Blog  Blog  Blog  FAQ  FAQ  FAQ

Hugo - highlight 🎨

 24. November 2017
/hugo-theme-w3css-basic.github.io/resources/images/teaserpics/bitbucket.org/pygments-main-logo_hu18333673464062273115.png

Hugo comes with reallly fast syntax highlighting from Chroma. From Hugo 0.28, the default syntax hightlighter in Hugo is Chroma; it is built in Go and is really, really fast – and for the most important parts compatible with Pygments. See https://gohugo.io/content-management/syntax-highlighting for more.

In this theme we set

config.toml

pygmentsUseClasses = true
demo

and provide static/css/syntax.css which is a copy of: static/css/syntax/syntax.<STYLE>.css

The styles are: autumn borland bw colorful default emacs friendly fruity manni monokai murphy native pastie perldoc rrt tango trac vim vs

These files were created with: hugo gen chromastyles --style=vs > syntax.vs.css Available styles are listed here: https://help.farbox.com/pygments.html

An alternative would be:

config.toml

pygmentsUseClasses = false
# choose one:
#pygmentsStyle = "autumn"
#pygmentsStyle = "borland"
#pygmentsStyle = "bw"
#pygmentsStyle = "colorful"
#pygmentsStyle = "default"
pygmentsStyle = "emacs"
#pygmentsStyle = "friendly"
#pygmentsStyle = "fruity"
#pygmentsStyle = "manni"
#pygmentsStyle = "monokai"
#pygmentsStyle = "murphy"
#pygmentsStyle = "native"
#pygmentsStyle = "pastie"
#pygmentsStyle = "perldoc"
#pygmentsStyle = "rrt"
#pygmentsStyle = "tango"
#pygmentsStyle = "trac"
#pygmentsStyle = "vim"
#pygmentsStyle = "vs"

These are the supported languages:

ABNF
abnf
ANTLR
antlr
APL
apl
ActionScript
actionscript, as
ActionScript 3
actionscript3, as, as3
Ada
ada, ada2005, ada95, adb, ads
Angular2
ng2
ApacheConf
aconf, apache, apacheconf, conf, htaccess
AppleScript
applescript
Awk
awk, gawk, mawk, nawk
BNF
bnf
Base Makefile
bsdmake, mak, make, makefile, mf, mk
Bash
bash, bashrc, ebuild, eclass, exheres-0, exlib, ksh, sh, shell, zsh, zshrc
Batchfile
bat, batch, cmd, dosbatch, winbatch
BlitzBasic
b3d, bb, blitzbasic, bplus, decls
Brainfuck
b, bf, brainfuck
C
c, h, idc
C#
c#, cs, csharp
C++
C, CPP, H, c++, cc, cp, cpp, cxx, h++, hh, hpp, hxx
CFEngine3
cf, cf3, cfengine3
CMake
cmake, txt
COBOL
COB, CPY, cob, cobol, cpy
CSS
css
Cap'n Proto
capnp
Ceylon
ceylon
ChaiScript
chai, chaiscript
Cheetah
cheetah, spitfire, spt, tmpl
Clojure
clj, clojure
CoffeeScript
coffee, coffee-script, coffeescript
Common Lisp
cl, common-lisp, lisp
Coq
coq, v
Crystal
cr, crystal
Cython
cython, pxd, pxi, pyrex, pyx
DTD
dtd
Dart
dart
Diff
diff, patch, udiff
Django/Jinja
django, jinja
Docker
docker, dockerfile
EBNF
ebnf
Elixir
elixir, ex, exs
Elm
elm
EmacsLisp
el, elisp, emacs, emacs-lisp
Erlang
erl, erlang, es, escript, hrl
FSharp
fs, fsharp, fsi
Factor
factor
Fish
fish, fishshell, load
Forth
forth, frt, fs
Fortran
F03, F90, f03, f90, fortran
GAS
S, asm, gas, s
GDScript
gd, gdscript
GLSL
frag, geo, glsl, vert
Genshi
genshi, kid, xml+genshi, xml+kid
Genshi HTML
html+genshi, html+kid
Genshi Text
genshitext
Gnuplot
gnuplot, plot, plt
Go
go, golang
Go HTML Template
go-html-template
Go Text Template
go-text-template
Groovy
gradle, groovy
HTML
htm, html, xhtml, xslt
HTTP
http
Handlebars
handlebars
Haskell
haskell, hs
Haxe
haxe, hx, hxsl
Hexdump
hexdump
Hy
hy, hylang
INI
cfg, dosini, inf, ini
Idris
idr, idris
Io
io
JSON
json
JSX
jsx, react
Java
java
JavaScript
javascript, js, jsm
Julia
jl, julia
Kotlin
kotlin, kt
LLVM
ll, llvm
Lighttpd configuration file
lighttpd, lighty
Lua
lua, wlua
Mako
mako, mao
Mason
m, mason, mc, mhtml, mi
Mathematica
cdf, ma, mathematica, mma, nb, nbp
MiniZinc
MZN, dzn, fzn, minizinc, mzn
Modula-2
def, m2, mod, modula2
MorrowindScript
morrowind, mwscript
MySQL
mysql, sql
Myghty
myghty, myt
NASM
ASM, asm, nasm
Newspeak
newspeak, ns2
Nginx configuration file
conf, nginx
Nim
nim, nimrod
Nix
nix, nixos
OCaml
ml, mli, mll, mly, ocaml
Objective-C
h, m, obj-c, objc, objective-c, objectivec
Octave
m, octave
PHP
inc, php, php3, php4, php5, php[345]
PL/pgSQL
plpgsql
POVRay
inc, pov
PacmanConf
conf, pacmanconf
Perl
perl, pl, pm, t
Pig
pig
PkgConfig
pc, pkgconfig
PostScript
eps, postscr, postscript, ps
PostgreSQL SQL dialect
postgres, postgresql
PowerShell
posh, powershell, ps1, psm1
Prolog
ecl, pl, pro, prolog
Protocol Buffer
proto, protobuf
Puppet
pp, puppet
Python
py, python, pyw, sage, sc, tac
Python 3
py3, python3
QBasic
BAS, bas, basic, qbasic
R
R, Renviron, Rhistory, Rprofile, S, r, s, splus
Racket
racket, rkt, rktd, rktl
Ragel
ragel
Rexx
arexx, rex, rexx, rx
Ruby
duby, gemspec, rake, rb, rbw, rbx, ruby
Rust
in, rs, rust
SCSS
scss
SPARQL
rq, sparql
SQL
sql
Sass
sass
Scala
scala
Scheme
scheme, scm, ss
Scilab
sce, sci, scilab, tst
Smalltalk
smalltalk, squeak, st
Smarty
smarty, tpl
Snobol
snobol
Solidity
sol, solidity
SquidConf
conf, squid, squid.conf, squidconf
Swift
swift
TASM
ASM, asm, tasm
TOML
toml
Tcl
rvt, tcl
Tcsh
csh, tcsh
TeX
aux, latex, tex, toc
Termcap
src, termcap
Terminfo
src, terminfo
Terraform
terraform, tf
Thrift
thrift
Transact-SQL
t-sql, tsql
Turtle
ttl, turtle
Twig
twig
TypeScript
ts, tsx, typescript
TypoScript
ts, txt, typoscript
TypoScriptCssData
typoscriptcssdata
TypoScriptHtmlData
typoscripthtmldata
VHDL
vhd, vhdl
VimL
exrc, gvimrc, vim, vimrc
WDTE
wdte
XML
rss, svg, wsdl, wsf, xml, xsd, xsl, xslt
Xorg
conf, xorg.conf
YAML
yaml, yml
cfstatement
cfs
markdown
markdown, md, mkd
reStructuredText
rest, restructuredtext, rst
reg
reg, registry
systemverilog
sv, svh, systemverilog
verilog
v, verilog

Check https://github.com/alecthomas/chroma for more information.