Template:CodeBlock

From Valve Developer Community
Revision as of 18:37, 8 August 2023 by Pee (talk | contribs) (added automatic syntax highlighting! (also had to change cs to csharp for this purpose))
Jump to navigation Jump to search
Todo: Add syntax highlighting for relevant languages such as C, C++, Squirrel, Lua, AngelScript, Python, and QuakeC, as well as common non-code syntax, such as VMT, VMF, Soundscapes/scripts, RAD files, Studiomdl QC/QCI, etc.
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)
Curly brackets white.pngTemplate Documentation [view] [edit]
Icon-translate.png Available doc translations
View
Page history

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:
  • 1 - Outlined version;
  • Default - Default style that is based on Markdown.
{{{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.
Icon-Bug.pngBug:Condenses code into one line.  [todo tested in ?]

Header

The parameters for adding a header with the code source and the name of the programming language are described below.

Note.pngNote:The header is enabled automatically when you enter one of the following parameters.
Name Description Example Preview
{{{src}}} The source of your code.
{{{lang}}} The name of the language displayed on the right side of the header.
The source was not specified
C#