Template:Code: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (Protected "Template:Code" ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only autoconfirmed users] (indefinite)))
No edit summary
Line 2: Line 2:


<includeonly><onlyinclude><span style="font-family:monospace, monospace; border-radius:3px; background:{{#switch:{{{p|{{{preset|}}}}}}
<includeonly><onlyinclude><span style="font-family:monospace, monospace; border-radius:3px; background:{{#switch:{{{p|{{{preset|}}}}}}
|#default = rgba(0,0,0,.26); padding:2px 3px
|#default = rgb(0 0 0 / 26%); padding:2px 3px
|0 = unset; padding:0
|0 = unset; padding:0
|1 = rgba(0,0,0,.16); padding:2px 3px
|1 = rgb(0 0 0 / 16%); padding:2px 3px
|2 = rgba(0,0,0,.16); border:1px solid rgba(255,255,255,.1); padding:1px 3px
|2 = rgb(0 0 0 / 16%); border:1px solid rgb(255 255 255 / 10%); padding:1px 3px
|3 = rgba(255,255,255,.05); border:1px solid rgba(255,255,255,.1); padding:1px 3px
|3 = rgb(255 255 255 / 5%); border:1px solid rgb(255 255 255 / 10%); padding:1px 3px
}}; user-select:{{{select|unset}}}; {{{style|}}}">{{#if:{{{highlight|}}}|{{#tag:syntaxhighlight|{{{1}}}|lang={{{highlight}}}|inline=1}}|{{{1}}}}}</span></onlyinclude></includeonly>
}}; user-select:{{{select|unset}}}; {{{style|}}}">{{#if:{{{highlight|}}}|{{#tag:syntaxhighlight|{{{1}}}|lang={{{highlight}}}|inline=1}}|{{{1}}}}}</span></onlyinclude></includeonly>


[[Category:Formatting templates]]
[[Category:Formatting templates]]

Revision as of 09:07, 12 May 2025

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
Page history

This template will allow you to format text as a one-line code.

Usage

This template prefers inline formatting of parameters
Parameters Description Preview
| <Text>
| 1 = <Text>
The text that will be displayed. Can contain links, templates and raw html, except when the {{{lang}}} parameter is used. Hello, World!
| lang = <Option> Adds syntax highlighting for the language specified using syntaxhighlight tag with inline attribute.
List of Supported languages.
int main() { return 0; }
| style = <CSS> CSS styles. Note that some styles require !important to be specified. Colored text

See Also