Compatible with DokuWiki
2009-02-14
Similar to code, code2, code3, syntaxhighlighter, syntaxhighlighter3
Plugin is not actively maintained (unless someone else takes over), please use SyntaxHighlighter 3 instead.
Download and install the plugin using the Plugin Manager using the URL given above. Refer to Plugins on how to install plugins manually.
The subfolder sxh2 contains a complete (and untouched) distribution of SyntaxHighlighter 2.1.364.
screenshot
Client side syntax highlighter (with copy to clipboard functionality) based on SyntaxHighlighter Plugin by David Shin. Main differences:
Usage:
<sxh [brush alias][; options for SyntaxHighlighter]> ... code/text ... </sxh>
brush alias - The brush alias (language) that SyntaxHighlighter should use. Defaults to “text” if none is provided. See SyntaxHighlighter Brushes for a complete list of available brushes. Add new brushes to the scripts directory and the file name to $brushes in action.php, see plugin structure.
options - Semicolon separated options for SyntaxHighlighter, see SyntaxHighlighter Configuration.
Example:
<sxh php; first-line: 5; highlight: [10,11,12,13]; wrap-lines: true>
function render($mode, &$renderer, $data) {
if ($mode == 'xhtml') {
if (count($data) == 3) {
list($syntax, $attr, $content) = $data;
if ($syntax == 'sxh')
$renderer->doc .= "<pre class=\"brush: ".$attr."\">".$renderer->_xmlEntities($content)."</pre>";
else
$renderer->file($content);
}
return true;
}
return false;
}
</sxh>
Hover mouse pointer over the code, a toolbar pops up with four buttons, the second is “copy to clipboard”.
Tool tips and dialog texts can be modified but require code changes, see SyntaxHighlighter strings.
These files and directories are included in the plugin:
syntaxhighlighter2/
|-- action.php
|-- sxh2
| |-- LGPLv3.txt
| |-- scripts
| | |-- clipboard.swf
| | |-- shBrushAS3.js
| | |-- shBrushBash.js
| | |-- shBrushCSharp.js
| | |-- shBrushColdFusion.js
| | |-- shBrushCpp.js
| | |-- shBrushCss.js
| | |-- shBrushDelphi.js
| | |-- shBrushDiff.js
| | |-- shBrushErlang.js
| | |-- shBrushGroovy.js
| | |-- shBrushJScript.js
| | |-- shBrushJava.js
| | |-- shBrushJavaFX.js
| | |-- shBrushPerl.js
| | |-- shBrushPhp.js
| | |-- shBrushPlain.js
| | |-- shBrushPowerShell.js
| | |-- shBrushPython.js
| | |-- shBrushRuby.js
| | |-- shBrushScala.js
| | |-- shBrushSql.js
| | |-- shBrushVb.js
| | |-- shBrushXml.js
| | |-- shCore.js
| | `-- shLegacy.js
| |-- src
| | |-- shCore.js
| | `-- shLegacy.js
| |-- styles
| | |-- help.png
| | |-- magnifier.png
| | |-- page_white_code.png
| | |-- page_white_copy.png
| | |-- printer.png
| | |-- shCore.css
| | |-- shThemeDefault.css
| | |-- shThemeDjango.css
| | |-- shThemeEclipse.css
| | |-- shThemeEmacs.css
| | |-- shThemeFadeToGrey.css
| | |-- shThemeMidnight.css
| | `-- shThemeRDark.css
| `-- test.html
`-- syntax
`-- code.php