This plugin provides client side syntax highlighting using the dp.SyntaxHighlighter by Alex Gorbatchev. JavaScript needs to be enabled on the clients web browser for this to work.
The code goes between the tags %CODE{...}%
and %ENDCODE%
.
%CODE{...}%
can have the following parameters:
Parameter![]() |
Description |
---|---|
"..." or lang="..." |
The programming language to be highlighted. See Supported Languages. |
collapse="on" |
Will collapse the block by default. |
el="..." |
HTML element to display the code in. Can be pre or textarea . Default is pre . See #Pre_vs_Textarea. |
firstline="value" |
Will begin line count at value. Default value is 1. |
nocontrols="on" |
Will not display controls at the top. |
nogutter="on" |
Will not display the gutter. |
rows="value" cols="value" |
Sets the rows and columns attributes. Recommend if using textarea so the code can be seen clearly when JavaScript is not available. |
showcolumns="on" |
Will show row columns in the first line. |
There are known problems when displaying XML (and HTML) in a pre
element. See http://code.google.com/p/syntaxhighlighter/wiki/PreAndTextarea for more information.
The following languages are supported:
Any of these can be used in the lang
parameter.
Below is a screen shot of how the rendered code will look.
You do not need to install anything in the browser to use this extension. The following instructions are for the administrator who installs the extension on the server where TWiki is running.
Like many other TWiki extensions, this module is shipped with a fully automatic installer script written using the BuildContrib.
configure
interface (Go to Plugins->Find More Extensions) .zip
or .tgz
archives
perl <module>_installer
)
configure
and enable the module, if it is a plugin.
,v
files in your existing install (take care not to lock the files when you check in)
If the plugin is installed correcty, the following should be rendered:
function hello () { alert('hello // world'); }
Plugin Author: | TWiki:Main.AndrewRJones![]() |
Copyright: | © 2007 TWiki:Main.AndrewRJones![]() © 2007-2011 TWiki:TWiki.TWikiContributor ![]() |
License: | GPL (GNU General Public License![]() |
Dp Syntax Highlighter Version: | 1.5.2 (25 Mar 2008) |
Dp Syntax Highlighter License: | LGPL (Gnu Lesser General Public License)![]() |
Plugin Version: | 2011-01-17 |
Change History: | |
2011-01-17: | TWikibug:Item6530![]() ![]() |
25 Mar 2008 | 1.5.2 -- Arthur Clemens: Added support for ActionScript 3. Thanks to Mark Walters![]() |
14646 | Bugs:Item4460: Fixed adding JS into highlighted HTML (#3) |
14642 | Bugs:Item4516: Upgrade highlighter to 1.5.1 |
14046 | Bugs:Item4215: Initial version |
TWiki Dependency: | $TWiki::Plugins::VERSION 1.1 |
Dp Syntax Highlighter Home | http://code.google.com/p/syntaxhighlighter![]() |
Plugin Home: | http://twiki.org/cgi-bin/view/Plugins/DpSyntaxHighlighterPlugin![]() |
Feedback: | http://twiki.org/cgi-bin/view/Plugins/DpSyntaxHighlighterPluginDev![]() |
Appraisal: | http://twiki.org/cgi-bin/view/Plugins/DpSyntaxHighlighterPluginAppraisal![]() |
Related Topics: TWikiPreferences, TWikiPreferences, TWikiPlugins