Template:CodeBlock/doc: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 3: Line 3:


== Usage ==
== Usage ==
Just insert {{MdCode|outline|<nowiki>{{MdCodeBlock|YourText}}</nowiki>}} into the page and replace '''YourText''' with your content to make the code block styling work.
Just insert {{MdCode|outline|<nowiki>{{CodeBlock|YourText}}</nowiki>}} into the page and replace '''YourText''' with your content to make the code block styling work.


<br>'''Manage Wiki Formatting:'''<br>
<br>'''Manage Wiki Formatting:'''<br>
Line 9: Line 9:


<br>'''Switching Styles:'''<br>
<br>'''Switching Styles:'''<br>
Insert {{MdCode|outline|<nowiki>style|</nowiki>}} after {{MdCode|outline|<nowiki>{{MdCodeBlock|</nowiki>}} and replace '''stylename''' with the name of an existing style.
Insert {{MdCode|outline|<nowiki>style|</nowiki>}} after {{MdCode|outline|<nowiki>{{CodeBlock|</nowiki>}} and replace '''stylename''' with the name of an existing style.


<br>'''Using Modifiers:'''<br>
<br>'''Using Modifiers:'''<br>
Line 15: Line 15:


<br>'''Adding a Block Header:'''<br>
<br>'''Adding a Block Header:'''<br>
A description of including a header in a block can be found [[Template:MdCodeBlock/Header|here]].
A description of including a header in a block can be found [[Template:CodeBlock/Header|here]].


== Styles ==
== Styles ==
Line 42: Line 42:


== Examples ==
== Examples ==
{{MdCodeBlock|outline|<nowiki>{{MdCodeBlock|margin=0|Hello World}}</nowiki>}}
{{CodeBlock|style=1|<nowiki>{{CodeBlock|margin=0|Hello World}}</nowiki>}}
{{Documentation/PreviewBlock|{{MdCodeBlock|margin=0|Hello World}}}}
{{Doc/PreviewBlock|{{CodeBlock|margin=0|Hello World}}}}




{{MdCodeBlock|outline|<nowiki>{{MdCodeBlock|limited|height=50px|margin=0|1. Hello World
{{CodeBlock|style=1|<nowiki>{{CodeBlock|limited=1|height=50px|margin=0|1. Hello World
2. Hello World
2. Hello World
3. Hello World
3. Hello World
4. Hello World}}</nowiki>
4. Hello World}}</nowiki>
}}
}}
{{Documentation/PreviewBlock|{{MdCodeBlock|limited|height=50px|margin=0|<nowiki>1. Hello World
{{Documentation/PreviewBlock|{{CodeBlock|limited=1|height=50px|margin=0|<nowiki>1. Hello World
2. Hello World
2. Hello World
3. Hello World
3. Hello World

Revision as of 09:03, 22 January 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)
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.

Usage

Just insert {{CodeBlock|YourText}} into the page and replace YourText with your content to make the code block styling work.


Manage Wiki Formatting:
You can use <nowiki>YourText</nowiki> to disable processing of various commands that allow the wiki to style your text. Also, it can disable the template style.


Switching Styles:
Insert style| after {{CodeBlock| and replace stylename with the name of an existing style.


Using Modifiers:
Insert modifier=YourText| after {{MdCode| or style| and replace "modifier" with the name of an existing modifier. After the equal sign, you need to write the properties corresponding to the modifier.


Adding a Block Header:
A description of including a header in a block can be found here.

Styles

Name Description
default enabled by default, but disabled if other styles are activated
limited default design with limited height (after reaching the maximum, scrolling will be activated)
outline less saturated version with outline
outline-limited same as outline, but with a limited height (after reaching the maximum, scrolling will be activated)

Modifiers

Name Description
height controls the height of styles with limited height (default auto)
margin controls margin (default 5px 0 0 0)

Examples

{{CodeBlock|margin=0|Hello World}}
Hello World


{{CodeBlock|limited=1|height=50px|margin=0|1. Hello World 2. Hello World 3. Hello World 4. Hello World}}
1. Hello World 2. Hello World 3. Hello World 4. Hello World