Extensions Wiki » Extensions » Code Macro

Code Macro

Last modified by Vincent Massol on 2013/03/11 18:51
cogUsed to highlight code
TypeJAR
Developed by

XWiki Development Team

LicenseGNU Lesser General Public License 2.1
Bundled With

XWiki Enterprise, XWiki Enterprise Manager

View Source

Description

See http://pygments.org/languages/ for the list of all supported languages.

See also the Highlight Macro.

Usage

{{code language=<providedlanguage>}}
... code here...
{{/code}}

Parameters definition

NameOptionalAllowed valuesDefault valueDescription
languageyesa stringthe macro tries to determine the syntaxthe language identifier of the provided code snippet. If no language identifier is specified then the macro will try to determine the syntax. To avoid highlight you can use "none" language identifier.

This macro also support all Box Macro parameters.

Configuration

It's possible to set some configuration for this macro in the xwiki.properties file:

NameOptionalAllowed valuesDefault valueDescription
rendering.macro.code.pygments.style (since 2.4M1)yesa string"default"the name of the Pygments style to use. See http://pygments.org/docs/styles/ for more about styles.

Adding new languages

Anyone can add a new language support by:

Example

{{code language="html"}}
<html>
  <head>Cool!</head>
</html>
{{/code}}

Result

<html>
 <head>Cool!</head>
</html>
Tags: presentation
Created by Thomas Mortagne on 2008/12/02 15:02

Download XWiki