Difference: DpSyntaxHighlighterPlugin (1 vs. 2)

Revision 22007-12-04 - TWikiAdminGroup

 

DpSyntaxHighlighterPlugin

<--
One line description, required for extensions repository catalog.
    * Set SHORTDESCRIPTION = Client side syntax highlighting using the dp.SyntaxHighlighter
-->

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

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.

  • If you have TWiki 4.1 or later, you can install from the configure interface (Go to Plugins->Find More Extensions)
    • The webserver user has to have permission to write to all areas of your installation for this to work.
  • If you have a permanent connection to the internet, you are recommended to use the automatic installer script
    • Just download the DpSyntaxHighlighterPlugin_installer perl script and run it.
  • Notes:
    • The installer script will:
      • Automatically resolve dependencies,
      • Copy files into the right places in your local install (even if you have renamed data directories),
      • check in new versions of any installed files that have existing RCS histories files in your existing install (such as topics).
      • If the $TWIKI_PACKAGES environment variable is set to point to a directory, the installer will try to get archives from there. Otherwise it will try to download from twiki.org or cpan.org, as appropriate.
      • (Developers only: the script will look for twikiplugins/DpSyntaxHighlighterPlugin/DpSyntaxHighlighterPlugin.tgz before downloading from TWiki.org)
    • If you don't have a permanent connection, you can still use the automatic installer, by downloading all required TWiki archives to a local directory.
      • Point the environment variable $TWIKI_PACKAGES to this directory, and the installer script will look there first for required TWiki packages.
        • $TWIKI_PACKAGES is actually a path; you can list several directories separated by :
      • If you are behind a firewall that blocks access to CPAN, you can pre-install the required CPAN libraries, as described at http://twiki.org/cgi-bin/view/TWiki/HowToInstallCpanModules
  • If you don't want to use the installer script, or have problems on your platform (e.g. you don't have Perl 5.8), then you can still install manually:
    1. Download and unpack one of the .zip or .tgz archives to a temporary directory.
    2. Manually copy the contents across to the relevant places in your TWiki installation.
    3. Check in any installed files that have existing ,v files in your existing install (take care not to lock the files when you check in)
    4. Manually edit LocalSite.cfg to set any configuration variables.
    5. Run configure and enable the module, if it is a plugin.
    6. Repeat from step 1 for any missing dependencies.

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

%CODE{ lang="javascript" }% function hello () { alert('hello // world'); } %ENDCODE%

Plugin Info

Plugin Author(s): TWiki:Main.AndrewRJones
Plugin Version: 14647 (28 Aug 2007)
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:
<-- versions below in reverse order -->
 
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

<-- Do not attempt to edit this topic; it is auto-generated. Please add comments/questions/remarks to the Dev topic instead. -->

Revision 12007-12-04 - TWikiAdminGroup

 

DpSyntaxHighlighterPlugin

<--
One line description, required for extensions repository catalog.
    * Set SHORTDESCRIPTION = Client side syntax highlighting using the dp.SyntaxHighlighter
-->

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

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.

  • If you have TWiki 4.1 or later, you can install from the configure interface (Go to Plugins->Find More Extensions)
    • The webserver user has to have permission to write to all areas of your installation for this to work.
  • If you have a permanent connection to the internet, you are recommended to use the automatic installer script
    • Just download the DpSyntaxHighlighterPlugin_installer perl script and run it.
  • Notes:
    • The installer script will:
      • Automatically resolve dependencies,
      • Copy files into the right places in your local install (even if you have renamed data directories),
      • check in new versions of any installed files that have existing RCS histories files in your existing install (such as topics).
      • If the $TWIKI_PACKAGES environment variable is set to point to a directory, the installer will try to get archives from there. Otherwise it will try to download from twiki.org or cpan.org, as appropriate.
      • (Developers only: the script will look for twikiplugins/DpSyntaxHighlighterPlugin/DpSyntaxHighlighterPlugin.tgz before downloading from TWiki.org)
    • If you don't have a permanent connection, you can still use the automatic installer, by downloading all required TWiki archives to a local directory.
      • Point the environment variable $TWIKI_PACKAGES to this directory, and the installer script will look there first for required TWiki packages.
        • $TWIKI_PACKAGES is actually a path; you can list several directories separated by :
      • If you are behind a firewall that blocks access to CPAN, you can pre-install the required CPAN libraries, as described at http://twiki.org/cgi-bin/view/TWiki/HowToInstallCpanModules
  • If you don't want to use the installer script, or have problems on your platform (e.g. you don't have Perl 5.8), then you can still install manually:
    1. Download and unpack one of the .zip or .tgz archives to a temporary directory.
    2. Manually copy the contents across to the relevant places in your TWiki installation.
    3. Check in any installed files that have existing ,v files in your existing install (take care not to lock the files when you check in)
    4. Manually edit LocalSite.cfg to set any configuration variables.
    5. Run configure and enable the module, if it is a plugin.
    6. Repeat from step 1 for any missing dependencies.

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

%CODE{ lang="javascript" }% function hello () { alert('hello // world'); } %ENDCODE%

Plugin Info

Plugin Author(s): TWiki:Main.AndrewRJones
Plugin Version: 14647 (28 Aug 2007)
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:
<-- versions below in reverse order -->
 
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

<-- Do not attempt to edit this topic; it is auto-generated. Please add comments/questions/remarks to the Dev topic instead. -->
 
This site is powered by the TWiki collaboration platform Powered by Perl 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 KoreaCmsWiki? Send feedback
Note: Please contribute updates to this topic on TWiki.org at TWiki:TWiki.DpSyntaxHighlighterPlugin