Template:CodeBlock/doc: Difference between revisions
Jump to navigation
Jump to search
Note:The header is enabled automatically when you enter one of the following parameters.
mNo edit summary |
(added width attribute) |
||
Line 17: | Line 17: | ||
|- | |- | ||
| align=center | {{Code|{{Param|margin}}}} | | align=center | {{Code|{{Param|margin}}}} | ||
| Controls margins. | | Controls margins. Goes clockwise. | ||
| {{CodeBlock|margin=5px|<nowiki>{{CodeBlock|margin=0 | | {{CodeBlock|margin=5px|<nowiki>{{CodeBlock|margin=5px 30px 0 10px|Hello, World!}}</nowiki>}} | ||
| {{Capsule|margin=5px|{{CodeBlock|margin=0 | | {{Capsule|margin=5px|{{CodeBlock|margin=5px 30px 0 10px|Hello, World!}}}} | ||
|- | |- | ||
| align=center | {{Code|{{Param|style}}}} | | align=center | {{Code|{{Param|style}}}} | ||
Line 38: | Line 38: | ||
3. Hello World | 3. Hello World | ||
4. Hello World</nowiki>}}}} | 4. Hello World</nowiki>}}}} | ||
|- | |||
| align=center | {{Code|{{Param|width}}}} | |||
| Controls the width of the block. | |||
| {{CodeBlock|margin=5px|<nowiki>{{CodeBlock|width=50%|<nowiki>1. Hello World | |||
2. Hello World | |||
3. Hello World | |||
4. Hello World | |||
5. Hello World </nowiki>}}</nowiki>}} | |||
| {{Capsule|margin=5px|{{CodeBlock|width=30%|margin=0|<nowiki>1. Hello World | |||
2. Hello World | |||
3. Hello World | |||
4. Hello World | |||
5. Hello World </nowiki>}}}} | |||
|- | |- | ||
| align=center | {{Code|{{Param|lines}}}} | | align=center | {{Code|{{Param|lines}}}} |
Latest revision as of 15:35, 17 August 2025

This is a documentation subpage for Template:CodeBlock.
Don't forget to purge the contents of the base page upon creating or editing this subpage.
Don't forget to purge the contents of the base page upon creating or editing this subpage.
This template formats the text as a block of code.
Parameters and Examples
Main
The main parameters are described below.
Name | Description | Example | Preview |
---|---|---|---|
{{{1}}} | Your code. It is recommended to wrap the template content with the <nowiki> tag. |
||
{{{margin}}} | Controls margins. Goes clockwise. | ||
{{{style}}} | The style of the template. The following styles are available:
|
||
{{{height}}} | Controls the height of the block. | ||
{{{width}}} | Controls the width of the block. | ||
{{{lines}}} | Manual: Numbered lines. | ||
{{{start}}} | What number to start numbering from (default value is 1). The value can be negative. | ||
{{{highlight}}} | Adds syntax highlighting for the language specified. ![]() |
Header
The parameters for adding a header with the code source and the name of the programming language are described below.

Name | Description | Example | Preview |
---|---|---|---|
{{{src}}} | The source of your code. | ||
{{{lang}}} | The name of the language displayed on the right side of the header. |