Šablona:Code/doc
| Soubor:OOjs UI icon book-ltr.svg | This is a documentation subpage for Šablona:Code. It contains usage information, categories and other content that is not part of the original Šablona page. |
[[Category:MediaWiki documentation pages{{#translation:}}]]
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|lang=css|font-family: 'Times New Roman', serif;}}
produces:
font-family: 'Times New Roman', serif;
Inline:
{{code|inline=y|lang=css|font-family: 'Times New Roman', serif;}}
produces:
font-family: 'Times New Roman', serif;
and is equivalent to:
<syntaxhighlight inline lang="css">font-family: 'Times New Roman', serif;</syntaxhighlight>
TemplateData
This is the TemplateData documentation for this template used by VisualEditor and other tools.
Code
[[Category:TemplateData documentation{{#translation:}}]]
A block or inline source code string.
| Parametr | Popis | Typ | Stav | |
|---|---|---|---|---|
| Language | lang 2 | The programming language of the source code. List of valid values is at: Extension:SyntaxHighlight#Supported_languages
| Řetězec | doporučený |
| Inline? | inline | Whether to use inline formatting
| Řetězec | nepovinný |
| Class | class | Applies only if `inline=true` | Řetězec | nepovinný |
| ID | id | Applies only if `inline=true` | Řetězec | nepovinný |
| CSS Style | style | Applies only if `inline=true` | Řetězec | nepovinný |
| Header | header | Applies only if `inline` is not set | Řádka | nepovinný |
| Code | 1 code | The code to display. | Řetězec | povinný |
See also
- {{Inline-code}}
- {{MW file}}
- {{Git}}
- {{Codesample}}
- {{Terminal}}