Template:CodeBlock
Innen: Valve Developer Community
Ugrás a navigációhoz
Ugrás a kereséshez

…

The Template:CodeBlock/doc/hu documentation page does not exist.
English documentation will be displayed instead, which you can translate using Google Translate (or similar software). If there is nothing after this message, most likely the documentation does not exist even in English.
English documentation will be displayed instead, which you can translate using Google Translate (or similar software). If there is nothing after this message, most likely the documentation does not exist even in English.
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. |
{{CodeBlock|Hello, World!}} |
Hello, World! |
{{{margin}}} | Controls margins. | {{CodeBlock|margin=0 20px 0 20px|Hello, World!}} |
Hello, World! |
{{{style}}} | The style of the template. The following styles are available:
|
{{CodeBlock|style=1|Hello, World!}} |
Hello, World! |
{{{height}}} | Controls the height of the block. | {{CodeBlock|height=52px|<nowiki>1. Hello World
2. Hello World
3. Hello World
4. Hello World</nowiki>}} |
1. Hello World
2. Hello World
3. Hello World
4. Hello World |
{{{lines}}} | Manual: Numbered lines. | {{CodeBlock|lines=4|<nowiki>Hello World
Hello World
Hello World
Hello World</nowiki>}} |
Hello World
Hello World
Hello World
Hello World |
{{{start}}} | What number to start numbering from (default value is 1). The value can be negative. | {{CodeBlock|start=12|lines=5|<nowiki>Hello World
Hello World
Hello World
Hello World
Hello World</nowiki>}} |
Hello World
Hello World
Hello World
Hello World
Hello World |
{{{highlight}}} | Adds syntax highlighting for the language specified. ![]() |
{{CodeBlock|highlight=c|int main() {return 0;} }} |
int main() { return 0; } |
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. | {{CodeBlock|src=light.rad|forcetextureshadow props_foliage/urban_tree01.mdl}} |
light.rad forcetextureshadow props_foliage/urban_tree01.mdl |
{{{lang}}} | The name of the language displayed on the right side of the header. | {{CodeBlock|lang=csharp
|<nowiki>using System;
namespace HelloWorld
{
internal class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World");
}
}
}</nowiki>}} |
The source was not specified C# using System;
namespace HelloWorld
{
internal class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World");
}
}
} |
A lap eredeti címe: „https://developer.valvesoftware.com/w/index.php?title=Template:CodeBlock&oldid=412538”