Loading...
 
Skip to main content
Display code with syntax highlighting and line numbering

Plugin Code

This wiki plugin is used to display any source code (including wiki syntax) on a page without it being processed. The code is displayed in a gray box in a fixed-width monospaced font. A title can be added to the box and line numbers added. Syntax highlighting is also available, since Tiki7 using CodeMirror and using GeSHi before that.

Parameters

Plugin PluginTikiDocFromCode failed : Either the module, plugin, preferences, tracker field or prefsexport parameter must be set, but not two or more.

Syntax highlighting

To activate syntax highlighting and enjoy most of the options (lines number, colors, etc), the Code editor (CodeMirror) feature must be enabled at Control Panels > Editing and Plugins > General Settings (tab) > Features (pane).

See the list of CodeMirror supported languages that can be used for the colors parameter.

Example

PHP with line numbers

This code:

Copy to clipboard
{CODE(colors="php")} <?php $menu = $menubar->getHomeMenu(); if($menu->link != "") { print "\t<td width=\"7%\" valign=\"top\">\n"; $menu->printMenu(); print "\t</td>\n"; } {CODE}

Would produce:

Copy to clipboard
<?php $menu = $menubar->getHomeMenu(); if($menu->link != "") { print "\t<td width=\"7%\" valign=\"top\">\n"; $menu->printMenu(); print "\t</td>\n"; }

Tiki syntax highlighting

Tiki syntax is supported too.
This code:

Copy to clipboard
{CODE(colors="tiki")} {img attId="57|58|59" desc="desc" alt="Sample Images" thumb="y" stylebox="float: left; margin-right:10px"} {CODE}

Would produce:

Copy to clipboard
{img attId="57|58|59" desc="desc" alt="Sample Images" thumb="y" stylebox="float: left; margin-right:10px"}

Legacy GeSHi Documentation (deprecated in Tiki8)

[+]

Aliases

Plugin Code

Attached files

ID Name Comment Uploaded Size Downloads
49 codenogeshi.png Code no geshi lindon 20.39 Kb 9574