TracSyntaxColoring - Zipedia - Trac

Syntax Coloring of Source Code

Trac supports language-specific syntax highlighting of source code in wiki formatted text and the repository browser.

To do this, Trac uses external libraries with support for a great number of programming languages.

Currently Trac supports syntax coloring using one or more of the following packages:

To activate syntax coloring, simply install either one (or more) of these packages. No additional configuration is required, however to modify the colors, have a look at trac/htdocs/css/code.css.

When in use, Trac will automatically prioritize SilverCity highlighting over Enscript if possible, (see note below).

If neither package is available, Trac will display the data as plain text.

Note: Enscript supports a greater number of languages, however SilverCity is generally faster since it is a library and isn't executed in an external process.

About SilverCity?

SilverCity uses the lexer from Scintilla. Scintilla supports more languages than SilverCity implements. If you want to add a language to SilverCity supported by Scintilla, it's not very difficult. See SilverCityAddLanguage for some information how.

Syntax Coloring Support

SilverCityEnscript
AdaX
AsmX
* ASPXX
* CXX
* C++XX
* JavaX
AwkX
CSSX
DiffX
EiffelX
ElispX
FortranX
HaskellX
HTMLXX
IDLX
JavascriptXX
m4X
MakefileX
MatlabX
Objective-CX
PascalX
* PerlXX
* PHPXX
PSPX
PyrexX
* PythonXX
* RubyXX (1)
SchemeX
ShellX
SQLXX
TroffX
TCLX
TexX
VerilogX
VHDLX
Visual BasicX
VRMLX
XMLXX

(*) Supported as inline code blocks in Wiki text using WikiProcessors.

(1) Ruby highlighting is not included in the Enscript distribution. Highlighting rules for Ruby can be obtained from: http://neugierig.org/software/ruby/

Extra Software


See also: WikiProcessors, WikiFormatting, TracWiki, TracBrowser