Customizing the rendering results
PhD lets you specify a number of options to customize the generated documentation files. The following sections describe some of them.
Source code highlighter
Part of the documentation of programming languages is source code examples. PhD is able to colorize the source code of many types of source code with the help of highlighters.
To utilize syntax highlighting, your opening <programlisting> tags need a role attribute describing the type of source code. Examples are php, html and python.
PhD currently only highlights the code if it is embedded in a CDATA section.
Example #1 A programlisting tag with a role
<programlisting role="php"><![CDATA[ <?php echo "Hello world!"; ?>
By default, PhD uses the source code highlighter that is built into PHP itself. It is only able to highlight PHP code and nothing else.
Install GeSHi from the MediaWiki PEAR channel:
$ pear channel-discover mediawiki.googlecode.com/svn $ pear install mediawiki/geshi
Use the GeSHi syntax highlighting class when rendering your documentation:
$ phd -g 'phpdotnet\phd\Highlighter_GeSHi' -d phd-guide.xml
If you have GeSHi version 1.1.x installed, you should use the phpdotnet\phd\Highlighter_GeSHi11x highlighter, which is adapted to GeSHi's new API.
Apart from using the highlighter shipped with PhD, you can build your own highlighters.