Posted by Toby A Inkster on 04/03/07 02:31
Christoph Burschka wrote:
> Are there any free PHP libraries/utility functions that can color the
> syntax of various programming languages (eg. Java and C++)?
GeSHi and PEAR Text_Highlighter each cover plenty of languages. There's
significant overlap between them; when a language is covered by both, the
Text_Highlighter output is usually a bit nicer.
> I am posting code snippets on my site and would like to know if there is
> a way to easily give them syntax highlighting automatically.
Take a look at my demitextile class <http://demiblog.org/etc/demitextile/>.
It combines syntax highlighting (via GeSHi, Text_Highlighter and some
built-in) with smart quotes and the Textile markup language
<http://textism.com/tools/textile/>.
Example:
http://examples.tobyinkster.co.uk/demitextile-usage1
http://examples.tobyinkster.co.uk/demitextile-output1
Note that it's smart enough to detect when you've embedded CSS, Javascript
and PHP within some HTML, and switches syntax highlighting mode
accordingly.
--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux
* = I'm getting there!
[Back to original message]
|