#1168 PHP Synstax Highlighting in Trac
Closed: Fixed None Opened 15 years ago by mbutcher.

I would like to be able to write code samples in PHP and have syntax highlighting:
!{{{
!#!php
<?php

print 'Look, ma! I'm highlighted!';

?>
!}}}

(Note: Leading ! have been added to escape wiki text. Those would obviously not be present normally.)

Already, I can do this with HTML using a similar syntax... I guess that the PHP highlighter is not enabled.

HTML example:

!{{{
!#!text/html
<html>
<head><title>Test</title></head>
<body>
Test
</body>
</html>
!}}}

For reference, you can see https://fedorahosted.org/querypath

Thanks,

Matt Butcher


Once we upgrade to Trac 0.11, we can install python-pygments and follow the directions at http://trac.edgewall.org/wiki/TracSyntaxColoring.

The two options for Trac 0.10 are:
* Install PHP on hosted1
* Package and install this plugin: http://trac.edgewall.org/wiki/TracSyntaxColoring

It'd probably be easiest to just wait the Trac 0.11 upgrade (but if it's really urgent, I guess we could install PHP on the hosted machines) - any thoughts on this?

I don't have a problem with installing PHP on the hosted machines, but we should disable mod_php if we do so, or at least put it into "safe mode".

Login to comment on this ticket.

Metadata