To prepare for a series of posts here on server configuration tricks, I’ve installed one of the WordPress SyntaxHighlighter plugins to my blog. This is a good choice as it exposes the most options from the SyntaxHighlighter JS library.
Simply create a preformatted paragraph and enter the text to be highlighted. Top and tail this with
[brush] tags like so:
The value of the brush in the class is the SyntaxHighlighter Brush alias. This can be followed by various rendering options:
Below are the parameters you can pass and what they do. For the booleans (i.e. on/off), pass
languageâ€” The language syntax to highlight with.
autolinksâ€” Toggle automatic URL linking.
classnameâ€” Add an additional CSS class to the code box.
collapseâ€” Toggle collapsing the code box by default
firstlineâ€” What number the first line should be.
gutterâ€” Toggle the left-side line numbering.
highlightâ€” Line numbers to highlight such as:
htmlscriptâ€” Toggle highlighting any extra HTML/XML.
lightâ€” Toggle light mode which disables the gutter and toolbar all at once.
padlinenumbersâ€” Controls line number padding (
true, or an integer).
title(v3 only) â€” Sets some text to show up before the code.
toolbarâ€” Toggle the toolbar (buttons in v2, the about question mark in v3)
wraplines(v2 only) â€” Toggle line wrapping.
[tags] as I have done above without having them interpreted by the plugin, make use of the fact that you can use both the
[brush][/brush] form (as above) and a more verbose alternative: