2
2
============================
4
4
The AsciiDoc distribution includes a source code syntax highlight
5
filter (`source-highlight-filter.conf`). It uses
6
http://www.gnu.org/software/src-highlite/[GNU source-highlight] to
7
highlight HTML outputs; DocBook outputs are highlighted by toolchains
8
that have `programlisting` element highlight support, for example
11
TIP: If the source 'language' attribute has been set (using an
12
'AttributeEntry' or from the command-line) you don't have to specify
13
it in each source code block.
5
filter (`source-highlight-filter.conf`).
10
The highlighter uses http://www.gnu.org/software/src-highlite/[GNU
11
source-highlight] to highlight 'html4' and 'xhtml11' outputs. You also
12
have the option of using the http://pygments.org/[Pygments] syntax
13
highlighter for 'xhtml11' outputs.
15
To use Pygments you need to define an AsciiDoc attribute named
16
'pygments' (either from the command-line or in the global
17
`asciidoc.conf` configuration file) and you will also need to have
18
Pygments installed and the 'pygmentize' command in your PATH.
20
- You can customize Pygments CSS styles by editing
21
`./stylesheets/pygments.css`.
22
- To make Pygments your default highlighter put the following line
23
your `~/.asciidoc/asciidoc.conf` file:
27
- The AsciiDoc 'encoding' attribute is passed to Pygments as a `-O`
33
DocBook outputs are highlighted by toolchains that have
34
`programlisting` element highlight support, for example 'dblatex'.
18
40
Source code paragraphs
19
41
~~~~~~~~~~~~~~~~~~~~~~
20
42
The `source` paragraph style will highlight a paragraph of source
166
188
<1> First callout.
167
189
<2> Second callout.
193
- If the source 'language' attribute has been set (using an
194
'AttributeEntry' or from the command-line) you don't have to specify
195
it in each source code block.
196
- You may need to place callout markers inside source code comments to
197
ensure they are not misinterpreted and mangled by the highlighter.
174
205
If you want to syntax highlight AsciiDoc HTML outputs (`html4` and
175
`xhtml11` backends) you need to
176
install http://www.gnu.org/software/src-highlite/[GNU
177
source-highlight] (most distributions have this package).
206
`xhtml11` backends) you need to install
207
http://www.gnu.org/software/src-highlite/[GNU source-highlight] or
208
http://pygments.org/[Pygments] (most distributions have these