Syntax Highlighting for HTML5
You can set up syntax highlighting for HTML5 outputs so that code samples use colors for the syntax.
To set up syntax highlighting for HTML5 outputs, use the settings on an HTML5 layout, and add attributes to the code sample if required:
-
Select Layout in the top menu.
-
Select the Layout you want to update or Create a Layout.
Tip
You can copy the URL of the Layout Editor and paste it into a new tab in your browser. This can be useful if you frequently switch between your Paligo content and the Layout settings.
-
Select Verbatim (code and software) in the sidebar.
-
Use the settings to set up syntax highlighting:
-
Highlight verbatim elements - Set the syntax highlighting feature to Enable (on) or Disable (off).
-
Highlight theme - Choose a theme. Each theme provides a different color scheme for syntax highlighting and may highlight different parts of the code. There are many different themes to choose from and we recommend that you experiment until you find the theme that best meets your requirements.
-
-
Select Save.
-
Paligo will usually be able to recognize the language in a code sample automatically and will apply the chosen theme for syntax highlighting. If Paligo is not recognizing your code sample, you can give the sample a
language
attribute. Paligo will then be able to identify the sample by the value that's set for thelanguage
attribute.To set the
language
for a code sample:-
Edit the topic that contains the code sample and select the verbatim element for the sample, for example, the
programlisting
element. -
In the Element attributes section, add the
language
attribute and enter a supported language as the value. For example, javascript. To find out what values are acceptable, see Syntax Highlighting Languages for HTML5.
-
-
Select Save.
You can use the language
attribute to give code samples a specific programming language. For example, you could give a programlisting
element the language
attribute and set its value to javascript.
To find out how to add the language
attribute, see Syntax Highlighting for HTML5.
The following table shows the values that you can set for the language
attribute. For some languages, you can use one of several values, and these are separated by a comma in the table. You should only enter one of the values, for example, for JavaScript you can enter either js or
javascript or jsx.
Programming language |
Value for the language attribute |
---|---|
1C |
1c |
4D |
4d |
ABNF |
abnf |
Access logs |
accesslog |
ActionScript |
actionscript, as |
Ada |
ada |
Alan |
alan, i |
AngelScript |
angelscript, asc |
Apache |
apache, apacheconf |
AppleScript |
applescript, osascript |
Arcade |
arcade |
ARM assembler |
armasm, arm |
AsciiDoc |
asciidoc, adoc |
AspectJ |
aspectj |
AutoHotkey |
autohotkey |
AutoIt |
autoit |
AVR assembler |
avrasm |
Awk |
awk, mawk, nawk, gawk |
Axapta |
axapta |
Bash |
bash, sh, zsh |
Basic |
basic |
BNF |
bnf |
Brainfuck |
brainfuck, bf |
C |
h |
C# |
csharp, cs |
C++ |
cpp, hpp, cc, hh, c++, h++, cxx, hxx |
Cache Object Script |
cos, cls |
C/AL |
cal |
Cap’n Proto |
capnproto, capnp |
Clojure |
clojure, clj |
CMake |
cmake, cmake.in |
CoffeeScript |
coffeescript, coffee, cson, iced |
Coq |
coq |
Crmsh |
crmsh, crm, pcmk |
Crystal |
crystal, cr |
CSP |
csp |
CSS |
css |
Cypher (Neo4j) |
cypher |
D |
d |
Dart |
dart |
Delphi |
delphi, dpr, dfm, pas, pascal, freepascal, lazarus, lpr, lfm |
Diff |
diff, patch |
Django |
django, jinja |
DNS Zone file |
dns, zone, bind |
Dockerfile |
dockerfile, docker |
DOS |
dos, bat, cmd |
dsconfig |
dsconfig |
DTS (Device Tree) |
dts |
Dust |
dust, dst |
Dylan |
dylan |
EBNF |
ebnf |
Elixir |
elixir |
Elm |
elm |
Erlang |
erlang, erl |
Excel |
excel, xls, xlsx |
Extempore |
extempore, xtlang, xtm |
F# |
fsharp, fs |
FIX |
fix |
Fortran |
fortran, f90, f95 |
Gams |
gams, gms |
GAUSS |
gauss, gss |
G-Code |
gcode, nc |
GDScript |
godot, gdscript |
Gherkin |
gherkin |
GN for Ninja |
gn, gni |
Go |
go, golang |
Golo |
golo, gololang |
Gradle |
gradle |
Grammatical Framework |
gf |
Groovy |
groovy |
Haml |
haml |
Handlebars |
handlebars, hbs, html.hbs, html.handlebars |
Haskell |
haskell, hs |
Haxe |
haxe, hx |
HTML, XML |
xml, html, xhtml, rss, atom, xjb, xsd, xsl, plist, svg |
HTTP |
http, https |
Hy |
hy, hylang |
Inform7 |
inform7, i7 |
Ini, TOML |
ini, toml |
IRPF90 |
irpf90 |
Java |
java, jsp |
JavaScript |
javascript, js, jsx |
JSON |
json |
Kotlin |
kotlin, kt |
Lasso |
lasso, ls, lassoscript |
LaTeX |
tex |
LDIF |
ldif |
Leaf |
leaf |
Less |
less |
Lisp |
lisp |
LiveCode Server |
livecodeserver |
LiveScript |
livescript, ls |
Lua |
lua |
Makefile |
makefile, mk, mak |
Markdown |
markdown, md, mkdown, mkd |
Mathematica |
mathematica, mma, wl |
Matlab |
matlab |
Maxima |
maxima |
Maya Embedded Language |
mel |
Mercury |
mercury |
mIRC Scripting Language |
mirc, mrc |
Mizar |
mizar |
Mojolicious |
mojolicious |
Monkey |
monkey |
Moonscript |
moonscript, moon |
N1QL |
n1ql |
Nginx |
nginx, nginxconf |
Nim |
nimrod |
Nix |
nix |
NSIS |
nsis |
Objective C |
objectivec, mm, objc, obj-c |
OCaml |
ocaml, ml |
OpenGL Shading Language |
glsl |
OpenSCAD |
openscad, scad |
Oracle Rules Language |
ruleslanguage |
Oxygene |
oxygene |
Parser3 |
parser3 |
Perl |
perl, pl, pm |
PF |
pf, pf.conf |
PHP |
php, php3, php4, php5, php6, php7 |
Plaintext |
plaintext, txt, text |
Pony |
pony |
PostgreSQL & PL/pgSQL |
pgsql, postgres, postgresql |
PowerShell |
powershell, ps, ps1 |
Processing |
processing |
Prolog |
prolog |
Properties |
properties |
Protocol Buffers |
protobuf |
Puppet |
puppet, pp |
Python |
python, py, gyp |
Python profiler results |
profile |
Q |
k, kdb |
QML |
qml |
R |
r |
Razor CSHTML |
cshtml, razor, razor-cshtml |
ReasonML |
reasonml, re |
RenderMan RIB |
rib |
RenderMan RSL |
rsl |
Roboconf |
graph, instances |
Robot Framework |
robot, rf |
RPM spec files |
rpm-specfile, rpm, spec, rpm-spec, specfile |
Ruby |
ruby, rb, gemspec, podspec, thor, irb |
Rust |
rust, rs |
SAS |
SAS, sas |
Scala |
scala |
Scheme |
scheme |
Scilab |
scilab, sci |
SCSS |
scss |
Shape Expressions |
shexc |
Shell |
shell, console |
Smali |
smali |
Smalltalk |
smalltalk, st |
Solidity |
solidity, sol |
SQL |
sql |
Stan |
stan, stanfuncs |
Stata |
stata |
STEP Part 21 |
p21, step, stp |
Structured Text |
iecst, scl, stl, structured-text |
Stylus |
stylus, styl |
SubUnit |
subunit |
Supercollider |
supercollider, sc |
Swift |
swift |
Tcl |
tcl, tk |
Terraform (HCL) |
terraform, tf, hcl |
Test Anything Protocol |
tap |
Thrift |
thrift |
TP |
tp |
Twig |
twig, craftcms |
TypeScript |
typescript, ts |
Vala |
vala |
VB.Net |
vbnet, vb |
VBScript |
vbscript, vbs |
Verilog |
verilog, v |
VHDL |
vhdl |
Vim Script |
vim |
x86 Assembly |
x86asm |
XL |
xl, tao |
XQuery |
xquery, xpath, xq |
YAML |
yml, yaml |
Zephir |
zephir, zep |