Vorlage:Code/doc
This is [[MediaWiki:Tagline]]. Set to <code>display:none</code> by chameleon skin.
This is a documentation subpage for Vorlage:Code. It contains usage information, categories and other content that is not part of the original vorlage page. |
Description
This is a combination of the templates {{code}} and {{pre2}}. It allows for code coloring depending on programming language conventions (like {{code}}) and inherits {{pre2}}'s ability for creating a horizontal slider if necessary (and requested).
Parameters
- 1
- lang
- The language used for color coding. Consult extension syntaxhighlight's documentation for a list of supported programming languages
- 2
- code
- The actual code displayed in the box. Warning: If your code contains an equal sign (=), you have to specify the parameter name as either
orcode=
, otherwise the display of text will be botched up.2=
- 3
- optional If you don't want a horizontal slider for long text, set this to
no
Usage
{{code|bash|code=#!/bin/bash mysql --defaults-file=/etc/mysql/debian.cnf}}
renders as
#!/bin/bash
mysql --defaults-file=/etc/mysql/debian.cnf
If you omit the paramater name (
), thus writing
code=
{{code|bash|#!/bin/bash mysql --defaults-file=/etc/mysql/debian.cnf}}
your output will look like this:
sample text
See also
- {{code snippet}} for short code text in sentences
- {{pre}} for a pre box with line wraps
- {{pre2}} for a pre box with horizontal slider
<pre>...</pre>