Difference between revisions of "Template:Code"
Jump to navigation
Jump to search
(Update from sandbox) |
Mediawiki>Seb35 (added the same alias parameters in both modes (inline/block); added an optional header in block mode) |
||
Line 1: | Line 1: | ||
− | {{#tag:syntaxhighlight|{{{code|{{{1}}}}}}|lang={{{lang|{{{2|text}}}}}}| | + | {{#if:{{{inline|}}}|<code {{#if:{{{class|}}}|class="{{{class}}}"}} {{#if:{{{id|}}}|id="{{{id}}}"}} {{#if:{{{style|}}}|style="{{{style}}}"}}>{{#tag:syntaxhighlight|{{{code|{{{1}}}}}}|lang="{{{lang|{{{2|text}}}}}}"|enclose="none"}}</code>|{{#if:{{{header|}}}|<u><small>{{{header}}}</small></u>}}{{#tag:syntaxhighlight |
+ | |{{{code|{{{1}}}}}} | ||
+ | |lang={{{lang|{{{2|bash}}}}}} | ||
+ | }}}}<noinclude> | ||
{{documentation}} | {{documentation}} | ||
</noinclude> | </noinclude> |
Revision as of 08:24, 16 October 2019
{{{1}}}
Usage
This is a semantic markup wrapper template for the HTML element <code>...</code>
. It can be used without a parameter to wrap code in a formatted block, with syntax highlighting, or with |inline=
for a leaner presentation.
Example:
{{code|font-family: 'Times New Roman', serif;}}
produces:
font-family: 'Times New Roman', serif;
Inline:
{{code|inline
produces:
Template loop detected: Template:Documentationy|font-family: 'Times New Roman', serif;}}
font-family: 'Times New Roman', serif;
and is equivalent to:
<code>font-family: 'Times New Roman', serif;</code>
See also
- {{inline-code}}