https://t2bwiki.iihe.ac.be/index.php?title=TracSyntaxColoring&feed=atom&action=history
TracSyntaxColoring - Revision history
2024-03-28T15:11:59Z
Revision history for this page on the wiki
MediaWiki 1.41.0
https://t2bwiki.iihe.ac.be/index.php?title=TracSyntaxColoring&diff=325&oldid=prev
Maintenance script: Created page with " == Syntax Coloring of Source Code == Trac supports language-specific syntax highlighting of source code within wiki formatted text in [WikiProcessors#CodeHighlightingSupport ..."
2015-08-26T12:29:22Z
<p>Created page with " == Syntax Coloring of Source Code == Trac supports language-specific syntax highlighting of source code within wiki formatted text in [WikiProcessors#CodeHighlightingSupport ..."</p>
<p><b>New page</b></p><div><br />
== Syntax Coloring of Source Code ==<br />
Trac supports language-specific syntax highlighting of source code within wiki formatted text in [WikiProcessors#CodeHighlightingSupport wiki processors] blocks and in the [TracBrowser repository browser].<br />
<br />
To do this, Trac uses external libraries with support for a great number of programming languages.<br />
<br />
Currently Trac supports syntax coloring using one or more of the following packages:<br />
<br />
*[http://pygments.pocoo.org/ Pygments], by far the preferred system, as it covers a wide range of programming languages and other structured texts and is actively supported<br />
*[http://www.codento.com/people/mtr/genscript/ GNU Enscript], commonly available on Unix but somewhat unsupported on Windows<br />
*[http://silvercity.sourceforge.net/ SilverCity], legacy system, some versions can be [http://trac.edgewall.org/wiki/TracFaq#why-is-my-css-code-not-being-highlighted-even-though-i-have-silvercity-installed problematic]<br />
<br />
<br />
To activate syntax coloring, simply install either one (or more) of these packages (see [#ExtraSoftware] section below).<br />
If none of these packages is available, Trac will display the data as plain text. <br />
<br />
<br />
==== About Pygments ====<br />
<br />
Starting with trac 0.11 [http://pygments.org/ pygments] will be the new default highlighter. It's a highlighting library implemented in pure python, very fast, easy to extend and [http://pygments.org/docs/ well documented].<br />
<br />
The Pygments default style can specified in the [TracIni#mimeviewer-section mime-viewer] section of trac.ini. The default style can be overridden by setting a Style preference on the [/prefs/pygments preferences page]. <br />
<br />
It's very likely that the list below is outdated because the list of supported pygments lexers is growing weekly. Just have a look at the page of [http://pygments.org/docs/lexers/ supported lexers] on the pygments webpage.<br />
<br />
<br />
=== Syntax Coloring Support ===<br />
<br />
=== Known MIME Types<br />
<br />
[[KnownMimeTypes]]<br />
<br />
<br />
=== List of Languages Supported, by Highlighter #language-supported<br />
<br />
This list is only indicative.<br />
<br />
{| border=1 class="simple"<br />
! <br />
!= SilverCity =<br />
!= Enscript =<br />
!= Pygments =<br />
|- <br />
| Ada <br />
| <br />
| ✓ <br />
| <br />
|- <br />
| Asm <br />
| <br />
| ✓ <br />
| <br />
|- <br />
| Apache Conf <br />
| <br />
| <br />
| ✓ <br />
|- <br />
| ASP <br />
| ✓ <br />
| ✓ <br />
| <br />
|- <br />
| C <br />
| ✓ <br />
| ✓ <br />
| ✓ <br />
|- <br />
| C# <br />
| <br />
| ✓ <sup>[#a1 (1)]</sup> <br />
| ✓ <br />
|- <br />
| C++ <br />
| ✓ <br />
| ✓ <br />
| ✓ <br />
|- <br />
| Java <br />
| ✓ <sup>[#a2 (2)]</sup> <br />
| ✓ <br />
| ✓ <br />
|- <br />
| Awk <br />
| <br />
| ✓ <br />
| <br />
|- <br />
| Boo <br />
| <br />
| <br />
| ✓ <br />
|- <br />
| CSS <br />
| ✓ <br />
| <br />
| ✓ <br />
|- <br />
| Python Doctests <br />
| <br />
| <br />
| ✓ <br />
|- <br />
| Diff <br />
| <br />
| ✓ <br />
| ✓ <br />
|- <br />
| Eiffel <br />
| <br />
| ✓ <br />
| <br />
|- <br />
| Elisp <br />
| <br />
| ✓ <br />
| <br />
|- <br />
| Fortran <br />
| <br />
| ✓ <sup>[#a1 (1)]</sup> <br />
| ✓ <br />
|- <br />
| Haskell <br />
| <br />
| ✓ <br />
| ✓ <br />
|- <br />
| Genshi <br />
| <br />
| <br />
| ✓ <br />
|- <br />
| HTML <br />
| ✓ <br />
| ✓ <br />
| ✓ <br />
|- <br />
| IDL <br />
| <br />
| ✓ <br />
| <br />
|- <br />
| INI <br />
| <br />
| <br />
| ✓ <br />
|- <br />
| Javascript <br />
| ✓ <br />
| ✓ <br />
| ✓ <br />
|- <br />
| Lua <br />
| <br />
| <br />
| ✓ <br />
|- <br />
| m4 <br />
| <br />
| ✓ <br />
| <br />
|- <br />
| Makefile <br />
| <br />
| ✓ <br />
| ✓ <br />
|- <br />
| Mako <br />
| <br />
| <br />
| ✓ <br />
|- <br />
| Matlab <sup>[#a3 (3)]</sup> <br />
| <br />
| ✓ <br />
| ✓ <br />
|- <br />
| Mygthy <br />
| <br />
| <br />
| ✓ <br />
|- <br />
| Objective-C <br />
| <br />
| ✓ <br />
| ✓ <br />
|- <br />
| OCaml <br />
| <br />
| <br />
| ✓ <br />
|- <br />
| Pascal <br />
| <br />
| ✓ <br />
| ✓ <br />
|- <br />
| Perl <br />
| ✓ <br />
| ✓ <br />
| ✓ <br />
|- <br />
| PHP <br />
| ✓ <br />
| <br />
| ✓ <br />
|- <br />
| PSP <br />
| ✓ <br />
| <br />
| <br />
|- <br />
| Pyrex <br />
| <br />
| ✓ <br />
| <br />
|- <br />
| Python <br />
| ✓ <br />
| ✓ <br />
| ✓ <br />
|- <br />
| Ruby <br />
| ✓ <br />
| ✓ <sup>[#a1 (1)]</sup> <br />
| ✓ <br />
|- <br />
| Scheme <br />
| <br />
| ✓ <br />
| ✓ <br />
|- <br />
| Shell <br />
| <br />
| ✓ <br />
| ✓ <br />
|- <br />
| Smarty <br />
| <br />
| <br />
| ✓ <br />
|- <br />
| SQL <br />
| ✓ <br />
| ✓ <br />
| ✓ <br />
|- <br />
| Troff <br />
| <br />
| ✓ <br />
| ✓ <br />
|- <br />
| TCL <br />
| <br />
| ✓ <br />
| <br />
|- <br />
| Tex <br />
| <br />
| ✓ <br />
| ✓ <br />
|- <br />
| Verilog <br />
| ✓ <sup>[#a2 (2)]</sup> <br />
| ✓ <br />
| <br />
|- <br />
| VHDL <br />
| <br />
| ✓ <br />
| <br />
|- <br />
| Visual Basic <br />
| <br />
| ✓ <br />
| ✓ <br />
|- <br />
| VRML <br />
| <br />
| ✓ <br />
| <br />
|- <br />
| XML <br />
| ✓ <br />
| <br />
| ✓ <br />
|}<br />
<br />
<br />
<br />
<br />
''[=#a1 (1)] Not included in the Enscript distribution. Additional highlighting rules can be obtained for<br />
[http://neugierig.org/software/ruby/ Ruby],<br />
[http://wiki.hasno.info/index.php/Csharp.st C#],<br />
[http://wiki.hasno.info/index.php/F90.st Fortran 90x/2003]<br />
<br />
''[=#a2 (2)] since Silvercity 0.9.7 released on 2006-11-23<br />
<br />
''[=#a3 (3)] By default <tt>.m</tt> files are considered Objective-C files. In order to treat <tt>.m</tt> files as MATLAB files, add "text/matlab:m" to the "mime_map" setting in the [[TracIni#mimeviewer-section| "[mimeviewer]] section of trac.ini"].<br />
<br />
=== Extra Software ===<br />
*GNU Enscript -- http://directory.fsf.org/GNU/enscript.html<br />
*GNU Enscript for Windows -- http://gnuwin32.sourceforge.net/packages/enscript.htm<br />
*SilverCity -- http://silvercity.sf.net/<br />
*Pygments -- http://pygments.org/<br />
<br />
----<br />
See also: WikiProcessors, WikiFormatting, TracWiki, TracBrowser<br />
<br />
<br />
<br />
{{TracNotice|{{PAGENAME}}}}</div>
Maintenance script