Template:Code

Use this template when you want to display a block of code.

This template should not be used to contain verbatim macro code in the Macros recipes pages. Macro code must be plain, free of any syntax highlight. For this, please use Template:MacroCode.

Since content that includes an equals sign (=) is interpreted as a variable, you must specify the  parameter explicitly to avoid issues.

Example:

Result:

If the block of code contains the characters:  (vertical bar) or   (closing brace or opening brace) do not use this template, as the template won't be parsed correctly. In this cases, you must use the HTML tags ... .

import FreeCAD, Draft Draft.makeLine(FreeCAD.Vector(0,0,0), FreeCAD.Vector(2,0,0))

import FreeCAD, Draft Draft.makeLine(FreeCAD.Vector(0,0,0), FreeCAD.Vector(2,0,0))

(2018) Note: This template was modified in the past because the wiki software couldn't handle syntax highlighting correctly. The following information refers to that older template. If the wiki software supports it once more, the template may be redefined to support syntax highlighting again.

Simplest template:

This template gives a different coloration depending on the option passed to the template. The default option is.

Other options are be supported.

The template is a simple wrapper around the  tags to show highlighted text. Unlike, text that does not fit on the screen will be wrapped. See Extension:SyntaxHighlight for a complete list of supported languages.

Warning: The Extension:SyntaxHighlight was disabled because it didn't work anymore on our host.

Original template:

26/09/2016 Mario52 The template was modified because the colour gives one inappropriate tab