Loading...
 
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.

 Note about Wiki Argument Variables
Wiki argument variables like {{page}} will be interpreted inside any wiki plugin or wiki syntax. To display a wiki argument variable you can escape the first bracket using the np (non parseable) tag: ~np~{~/np~{page}}.

Parameters

Display code with syntax highlighting and line numbering.
Introduced in Tiki 1.
Go to the source code
Preferences required: wikiplugin_code

Parameters Accepted Values Description Default Since
(body of plugin) Code to be displayed
caption text Code snippet label. 1
colors text Any supported language listed at http://codemirror.net/mode/. Pref feature_syntax_highlighter must be true for this to have any effect 17
wrap (blank)
1
0
Wrap lines of code which do not fit in the display box's width. Enabling avoids overflow or hidden line ends. 1
theme default| 3024-day| 3024-night| abcdef| ambiance-mobile| ambiance| base16-dark| base16-light| bespin| blackboard| cobalt| colorforth| dracula| eclipse| elegant| erlang-dark| hopscotch| icecoder| isotope| lesser-dark| liquibyte| material| mbo| mdn-like| midnight| monokai| neat| neo| night| panda-syntax| paraiso-dark| paraiso-light| pastel-on-dark| railscasts| rubyblue| seti| solarized| the-matrix| tomorrow-night-bright| tomorrow-night-eighties| ttcn| twilight| vibrant-ink| xq-dark| xq-light| yeti| zenburn Any supported theme listed at https://codemirror.net/demo/theme.html 17
ln (blank)
1
0
Show line numbers for each line of code. 1
rtl (blank)
1
0
Switch the text display from left to right, to right to left (left to right by default) 1
mediawiki (blank)
1
0
Encloses the code in an HTML code tag, for example: <code>user input<code> 0 8.3

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.

 Tip
If you need a mode that keeps tab spacing, you can use, for instance, mode scss.

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 9255

doc.tiki.org

Get Started

Admin Guide User Guide

Keywords

Keywords serve as "hubs" for navigation within the Tiki documentation. They correspond to development keywords (bug reports and feature requests):

Accessibility (WAI and 508)
Accounting
Articles and Submissions
Backlinks
Banners
Batch
BigBlueButton audio/video/chat/screensharing
Blog
Bookmark
Browser Compatibility
Link Cache
Calendar
Category
Chat
Clean URLs
Comments
Communication Center
Compression (gzip)
Contacts (Address Book)
Contact us
Content Templates
Contribution
Cookie
Copyright
Credit
Custom Home and Group Home Page
Date and Time
Debugger Console
Directory of hyperlinks
Documentation link from Tiki to doc.tiki.org (Help System)
Docs
Draw
Dynamic Content
Dynamic Variable
External Authentication
FAQ
Featured links
File Gallery
Forum
Friendship Network (Community)
Gmap Google maps
Groups
Hotword
HTML Page
i18n (Multilingual, l10n)
Image Gallery
Import-Export
Install
Integrator
Interoperability
Inter-User Messages
InterTiki
Kaltura video management
Karma
Live Support
Login
Logs (system & action)
Look and Feel
Mail-in
Map with Mapserver
Menu
Meta Elements
Mobile Tiki and Voice Tiki
Module
MultiTiki
MyTiki
Newsletter
Notepad
Payment
Performance Speed / Load
Permissions
Platform independence (Linux-Apache, Windows/IIS, Mac, BSD)
Polls
Profiles
Profile Manager
Report
Toolbar
Quiz
Rating
Feeds
Score
Search engine optimization
Search
Search and Replace
Security
Semantic links
Shadowbox
Shadow Layers
Share
Shopping cart
Shoutbox
Slideshow
Smiley
Social Networks
Spam protection (Anti-bot CATPCHA)
Spellcheck
Spreadsheet
Stats
Surveys
Tags
Task
Tell a Friend, alert + Social Bookmarking
TikiTests
Theme CSS & Smarty
Tiki Manager
Trackers
Transitions
User Administration including registration and banning
User Files
User Menu
Watch
WebDAV
Webmail
Web Services
Wiki History, page rename, etc
Wiki Syntax
Wiki structure (book and table of content)
Workspace
WSOD
WYSIWYCA
WYSIWYG
XMLRPC

Tiki Newsletter

Delivered fresh to your email inbox!
Newsletter subscribe icon
Don't miss major announcements and other news!
Contribute to Tiki