|
|
Line 1: |
Line 1: |
− | <noinclude>{{doc|0}}</noinclude>__NOTOC__
| + | {{delete}} |
− | This template formats the text as a block of code.
| |
− | | |
− | ==Parameters and Examples==
| |
− | ===Main===
| |
− | The main parameters are described below.
| |
− | {| class=standard-table width=100%
| |
− | ! style=width:10% | Name
| |
− | ! style=width:30% | Description
| |
− | ! Example
| |
− | ! style=width:27% | Preview
| |
− | |-
| |
− | | align=center | {{Code|{{Param|1}}}}
| |
− | | Your code.<br>It is recommended to wrap the template content with the {{Code|select=1|<nowiki>}} tag.
| |
− | | {{CodeBlock|margin=5px|<nowiki>{{CodeBlock|Hello, World!}}</nowiki>}}
| |
− | | {{Capsule|margin=5px|{{CodeBlock|margin=0|Hello, World!}}}}
| |
− | |-
| |
− | | align=center | {{Code|{{Param|margin}}}}
| |
− | | Controls margins.
| |
− | | {{CodeBlock|margin=5px|<nowiki>{{CodeBlock|margin=0 20px 0 20px|Hello, World!}}</nowiki>}}
| |
− | | {{Capsule|margin=5px|{{CodeBlock|margin=0 20px 0 20px|Hello, World!}}}}
| |
− | |-
| |
− | | align=center | {{Code|{{Param|style}}}}
| |
− | | The style of the template. The following styles are available:
| |
− | :* {{Code|1}} - Outlined version;
| |
− | :* {{Code|style=3|Default}} - Default style that is based on Markdown.
| |
− | | {{CodeBlock|margin=5px|<nowiki>{{CodeBlock|style=1|Hello, World!}}</nowiki>}}
| |
− | | {{Capsule|margin=5px|{{CodeBlock|margin=0|style=1|Hello, World!}}}}
| |
− | |-
| |
− | | align=center | {{Code|{{Param|height}}}}
| |
− | | Controls the height of the block.
| |
− | | {{CodeBlock|margin=5px|<nowiki>{{CodeBlock|height=52px|<nowiki>1. Hello World
| |
− | 2. Hello World
| |
− | 3. Hello World
| |
− | 4. Hello World</nowiki>}}</nowiki>}}
| |
− | | {{Capsule|margin=5px|{{CodeBlock|height=52px|margin=0|<nowiki>1. Hello World
| |
− | 2. Hello World
| |
− | 3. Hello World
| |
− | 4. Hello World</nowiki>}}}}
| |
− | |-
| |
− | | align=center | {{Code|{{Param|lines}}}}
| |
− | | ''Manual:'' Numbered lines.
| |
− | | {{CodeBlock|margin=5px|<nowiki>{{CodeBlock|lines=4|<nowiki>Hello World
| |
− | Hello World
| |
− | Hello World
| |
− | Hello World</nowiki>}}</nowiki>}}
| |
− | | {{Capsule|margin=5px|{{CodeBlock|lines=4|margin=0|<nowiki>Hello World
| |
− | Hello World
| |
− | Hello World
| |
− | Hello World</nowiki>}}}}
| |
− | |-
| |
− | | align=center | {{Code|{{Param|start}}}}
| |
− | | What number to start numbering from (default value is 1). The value can be negative.
| |
− | | {{CodeBlock|margin=5px|<nowiki>{{CodeBlock|start=12|lines=5|<nowiki>Hello World
| |
− | Hello World
| |
− | Hello World
| |
− | Hello World
| |
− | Hello World</nowiki>}}</nowiki>}}
| |
− | | {{Capsule|margin=5px|{{CodeBlock|start=12|lines=5|<nowiki>Hello World
| |
− | Hello World
| |
− | Hello World
| |
− | Hello World
| |
− | Hello World</nowiki>}}}}
| |
− | |}
| |
− | | |
− | ===Header===
| |
− | The parameters for adding a header with the code source and the name of the programming language are described below.
| |
− | {{ModernNote|The header is enabled automatically when you enter one of the following parameters.}}
| |
− | {| class=standard-table width=100%
| |
− | ! style=width:10% | Name
| |
− | ! style=width:30% | Description
| |
− | ! Example
| |
− | ! style=width:27% | Preview
| |
− | |-
| |
− | | align=center | {{Code|{{Param|src}}}}
| |
− | | The source of your code.
| |
− | | {{CodeBlock|margin=5px|<nowiki>{{CodeBlock|src=light.rad|forcetextureshadow props_foliage/urban_tree01.mdl}}</nowiki>}}
| |
− | | {{Capsule|margin=5px|{{CodeBlock|src=light.rad|margin=0|forcetextureshadow props_foliage/urban_tree01.mdl}}}}
| |
− | |-
| |
− | | align=center | {{Code|{{Param|lang}}}}
| |
− | |The name of the language displayed on the right side of the header.
| |
− | | {{CodeBlock|margin=5px|<nowiki>{{CodeBlock|lang=cs
| |
− | |<nowiki>using System;
| |
− | | |
− | namespace HelloWorld
| |
− | {
| |
− | internal class Program
| |
− | {
| |
− | static void Main(string[] args)
| |
− | {
| |
− | Console.WriteLine("Hello World");
| |
− | }
| |
− | }
| |
− | }</nowiki>}}</nowiki>}}
| |
− | | {{Capsule|margin=5px|{{CodeBlock|lang=cs|margin=0|<nowiki>using System;
| |
− | | |
− | namespace HelloWorld
| |
− | {
| |
− | internal class Program
| |
− | {
| |
− | static void Main(string[] args)
| |
− | {
| |
− | Console.WriteLine("Hello World");
| |
− | }
| |
− | }
| |
− | }</nowiki>}}}}
| |
− | |}
| |
− | | |
− | <includeonly>[[Category:Templates]] [[Category:Formatting templates]]</includeonly>
| |