Template:CodeBlock/doc: Difference between revisions
Jump to navigation
Jump to search
m (→Header) |
|||
Line 11: | Line 11: | ||
|- | |- | ||
| align=center | {{Code|{{param|tag=kbd|1}}}} | | align=center | {{Code|{{param|tag=kbd|1}}}} | ||
| Your code. | | Your code.<br>It is recommended to wrap the template content with the {{Code|select=1|<nowiki>}} tag. | ||
| {{CodeBlock|<nowiki>{{CodeBlock|Hello, World!}}</nowiki>}} | | {{CodeBlock|<nowiki>{{CodeBlock|Hello, World!}}</nowiki>}} | ||
| {{Doc/PreviewBlock|{{CodeBlock|margin=0|Hello, World!}}}} | | {{Doc/PreviewBlock|margin=5px|{{CodeBlock|margin=0|Hello, World!}}}} | ||
|- | |||
| align=center | {{Code|{{param|tag=kbd|margin}}}} | |||
| Controls margins. | |||
| {{CodeBlock|<nowiki>{{CodeBlock|margin=0 20px 0 20px|Hello, World!}}</nowiki>}} | |||
| {{Doc/PreviewBlock|margin=5px|{{CodeBlock|margin=0 20px 0 20px|Hello, World!}}}} | |||
|- | |- | ||
| align=center | {{Code|{{param|tag=kbd|style}}}} | | align=center | {{Code|{{param|tag=kbd|style}}}} | ||
| The style of the template. The following styles are available: | | The style of the template. The following styles are available: | ||
:* {{Code|select=1|1}} - Outlined version. | :* {{Code|select=1|1}} - Outlined version. | ||
:* {{Code|style=3|Default}} - the default style is based on Markdown | |||
| {{CodeBlock|<nowiki>{{CodeBlock|style=1|Hello, World!}}</nowiki>}} | | {{CodeBlock|<nowiki>{{CodeBlock|style=1|Hello, World!}}</nowiki>}} | ||
| {{Doc/PreviewBlock|{{CodeBlock|style=1|margin=0|Hello, World!}}}} | | {{Doc/PreviewBlock|margin=5px|{{CodeBlock|style=1|margin=0|Hello, World!}}}} | ||
|- | |||
| align=center | {{Code|{{param|tag=kbd|limited}}}} | |||
| Limits the block height to 400 pixels and enables scrolling. | |||
| {{CodeBlock|<nowiki>{{CodeBlock|limited=1|1. Hello World | |||
2. Hello World | |||
3. Hello World | |||
4. Hello World}}</nowiki>}} | |||
| align=center | See below | |||
|- | |||
| align=center | {{Code|{{param|tag=kbd|height}}}} | |||
| Controls the height of the block.<br>Does not work without {{param|limited}}.<br>The maximum height is 400 pixels. | |||
| {{CodeBlock|<nowiki>{{CodeBlock|limited=1|height=34px|1. Hello World | |||
2. Hello World | |||
3. Hello World | |||
4. Hello World}}</nowiki>}} | |||
| {{Doc/PreviewBlock|margin=5px|{{CodeBlock|limited=1|height=34px|margin=0|<nowiki>1. Hello World | |||
2. Hello World | |||
3. Hello World | |||
4. Hello World</nowiki>}}}} | |||
|} | |} | ||
Line 32: | Line 57: | ||
| Includes a block header to display the source and language name. | | Includes a block header to display the source and language name. | ||
| {{CodeBlock|<nowiki>{{CodeBlock|header=1|Hello, World!}}</nowiki>}} {{CodeBlock|<nowiki>{{CodeBlock|style=1|header=1|Hello, World!}}</nowiki>}} | | {{CodeBlock|<nowiki>{{CodeBlock|header=1|Hello, World!}}</nowiki>}} {{CodeBlock|<nowiki>{{CodeBlock|style=1|header=1|Hello, World!}}</nowiki>}} | ||
| {{Doc/PreviewBlock|{{CodeBlock|header=1|margin=0|Hello, World!}} {{CodeBlock|style=1|header=1|Hello, World!}}}} | | {{Doc/PreviewBlock|margin=5px|{{CodeBlock|header=1|margin=0|Hello, World!}} {{CodeBlock|style=1|header=1|Hello, World!}}}} | ||
|- | |- | ||
| align=center | {{Code|{{param|tag=kbd|src}}}} | | align=center | {{Code|{{param|tag=kbd|src}}}} | ||
| The source of your code. | | The source of your code. | ||
| {{CodeBlock|<nowiki>{{CodeBlock|header=1|src=light.rad|forcetextureshadow props_foliage/urban_tree01.mdl</nowiki>}} | | {{CodeBlock|<nowiki>{{CodeBlock|header=1|src=light.rad|forcetextureshadow props_foliage/urban_tree01.mdl</nowiki>}} | ||
| {{Doc/PreviewBlock|{{CodeBlock|header=1|src=light.rad|margin=0|forcetextureshadow props_foliage/urban_tree01.mdl}}}} | | {{Doc/PreviewBlock|margin=5px|{{CodeBlock|header=1|src=light.rad|margin=0|forcetextureshadow props_foliage/urban_tree01.mdl}}}} | ||
|- | |- | ||
| align=center | {{Code|{{param|tag=kbd|lang}}}} | | align=center | {{Code|{{param|tag=kbd|lang}}}} | ||
Line 53: | Line 78: | ||
} | } | ||
}</nowiki>}} | }</nowiki>}} | ||
| {{Doc/PreviewBlock|{{CodeBlock|header=1|lang=cs|margin=0|<nowiki>using System; | | {{Doc/PreviewBlock|margin=5px|{{CodeBlock|header=1|lang=cs|margin=0|<nowiki>using System; | ||
namespace HelloWorld | namespace HelloWorld |
Revision as of 10:18, 27 January 2023

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 allows text to be formatted as a Markdown-style block of code.
Parameters and Examples
Main
Name | Description | Example | Preview |
---|---|---|---|
{{{1}}}
|
Your code. It is recommended to wrap the template content with the <nowiki> tag.
|
||
{{{margin}}}
|
Controls margins. | ||
{{{style}}}
|
The style of the template. The following styles are available:
|
||
{{{limited}}}
|
Limits the block height to 400 pixels and enables scrolling. | See below | |
{{{height}}}
|
Controls the height of the block. Does not work without {{{limited}}}. The maximum height is 400 pixels. |
Header
Name | Description | Example | Preview |
---|---|---|---|
{{{header}}}
|
Includes a block header to display the source and language name. | ||
{{{src}}}
|
The source of your code. | ||
{{{lang}}}
|
The name of the language displayed on the right side of the header. |