Template: Code Block/doc

From Valve Developer Community
Jump to navigation Jump to search
English (en)Deutsch (de)Esperanto (eo)Español (es)Français (fr)Suomi (fi)Hrvatski (hr)Magyar (hu)Italiano (it)日本語 (ja)한국어 (ko)Nederlands (nl)Polski (pl)Português (pt)Português do Brasil (pt-br)Русский (ru)Slovenčina (sk)Svenska (sv)Türkçe (tr)Українська (uk)Tiếng Việt (vi)中文 (zh)中文(臺灣) (zh-tw)
Edit-copy.png
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.

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.
{{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:
  • 1 - Outlined version.
  • Default - the default style is based on Markdown
{{CodeBlock|style=1|Hello, World!}}
Hello, World!
{{{limited}}} Limits the block height to 400 pixels and enables scrolling.
{{CodeBlock|limited=1|1. Hello World 2. Hello World 3. Hello World 4. Hello World}}
See below
{{{height}}} Controls the height of the block.
Does not work without {{{limited}}}.
The maximum height is 400 pixels.
{{CodeBlock|limited=1|height=34px|1. Hello World 2. Hello World 3. Hello World 4. Hello World}}
1. Hello World 2. Hello World 3. Hello World 4. Hello World

Header

Name Description Example Preview
{{{header}}} Includes a block header to display the source and language name.
{{CodeBlock|header=1|Hello, World!}}
{{CodeBlock|style=1|header=1|Hello, World!}}
Hello, World!
Hello, World!
{{{src}}} The source of your code.
{{CodeBlock|header=1|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|header=1|lang=cs|using System; namespace HelloWorld { internal class Program { static void Main(string[] args) { Console.WriteLine("Hello World"); } } }
The source was not specified
cs
using System; namespace HelloWorld { internal class Program { static void Main(string[] args) { Console.WriteLine("Hello World"); } }