Template:CodeBlock: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
(whoops)
Line 36: Line 36:
                             --><div style="width:100%;background:rgba(255,128,0,0.1);margin-top:calc((1.6em * ({{{lightstart4|4}}} - 1)) + .45em);margin-bottom:.45em;height:calc(1.6em * {{{lightamount4|1}}});position:absolute;left:0;user-select:none;pointer-events:none"><!--
                             --><div style="width:100%;background:rgba(255,128,0,0.1);margin-top:calc((1.6em * ({{{lightstart4|4}}} - 1)) + .45em);margin-bottom:.45em;height:calc(1.6em * {{{lightamount4|1}}});position:absolute;left:0;user-select:none;pointer-events:none"><!--
                             --></div><!--
                             --></div><!--
                         --></div>}}<div style="padding:.45em .5em;position:relative">{{Highlighting supported|{{{lang}}}|{{#tag:syntaxhighlight|{{{1}}}|lang=c|inline=1|style="background-color:#00000000;"}}|{{{1|}}}}}</div><!--
                         --></div>}}<div style="padding:.45em .5em;position:relative">{{Highlighting supported|{{{lang}}}|{{#tag:syntaxhighlight|{{{1}}}|lang={{{lang}}}|inline=1|style="background-color:#00000000;"}}|{{{1|}}}}}</div><!--
                     --></div><!--
                     --></div><!--
--><!--
--><!--

Revision as of 19:05, 8 August 2023

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#