ASAP Framework has a follow-up: go to ASAP Library for our AS3 framework!

DpSyntaxHighlighterPlugin

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.

Syntax Rules

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.
nogutter="on" Will not display the gutter.
nocontrols="on" Will not display controls at the top.
collapse="on" Will collapse the block by default.
firstline="value" Will begin line count at value. Default value is 1.
showcolumns="on" Will show row columns in the first line.
el="..." HTML element to display the code in. Can be pre or textarea. Default is pre. See #Pre_vs_Textarea.
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.

Pre vs Textarea

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.

Supported Languages

The following languages are supported:

  • css
  • c#, c-sharp, csharp
  • c, cpp, c++
  • vb, vb.net
  • delphi, pascal
  • js, jscript, javascript
  • php
  • py, python
  • ruby
  • sql
  • xml, xhtml, xslt, html, xhtml

Any of these can be used in the lang parameter.

Examples

Below is a screen shot of how the rendered code will look.

screenshot of plugin

Installation Instructions

%$INSTALL_INSTRUCTIONS%

If the plugin is installed correcty, the following should be rendered:

function hello () {
    alert('hello // world');
}

Plugin Info

Plugin Author(s): TWiki:Main.AndrewRJones
Plugin Version: %$VERSION%
Dp Syntax Highlighter Version: 1.5.1 (5 Aug 2007)
Copyright: © 2007 TWiki:Main.AndrewRJones
License: GPL (Gnu General Public License)
Dp Syntax Highlighter License: LGPL (Gnu Lesser General Public License)
Change History:  
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

Topic revision: r1 - 07 Sep 2007 - 14:13:59 - TWikiGuest
 
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding ASAP? Send feedback
Note: Please contribute updates to this topic on TWiki.org at TWiki:TWiki.DpSyntaxHighlighterPlugin