If you’re a programmer, chances are that you’re going to include some source code in your articles and
books. Glyph offers two ways to format code blocks effortlessly: the codeblock macro, which simply wraps text
into <pre> and <code> tags, or the highlight macro. The last one requires
either Coderay or Ultraviolet, but it provides syntax highlighting for the most common
programming languages.
Cosider the following piece of ruby code:
It can be wrapped in a highlight macro, like so:
...to produce the following, using the coderay highlighter:
Some Remarks
- Highlighters require some configuration. For more information on relevant configuration settings, see the filters.* configuration settings.
- If you’re using the
highlightmacro together within thetextilemacro, you must wrap the macro call within<notextile>tags. - You must always escape pipes (
|) with the code or the highlight macro.