Шаблон:Код

Матеріал з Terraria Wiki
Перейти до навігації Перейти до пошуку
Template-info.svg Документація Наведена нижче документація запозичена з «Шаблон:Код/doc». (редагувати | історія)
Для більш повної чи актуальної інформації ви можете переглянути документацію англійською.

This template displays some short code in a monospace font to make it stand out from surrounding text. It is similar to the <code></code> tags, except that it has a grey background. The template is based on Template:Code from Wikipedia.

Usage

{{ code | <code to display> | class = <CSS class> | style = <custom styling> | id = <ID attribute> | lang = <programming language> }}

First unnamed parameter

The code to display.

class

Additional class or classes for styling the resulting element via CSS.

style

Custom inline styling of the resulting element.

id

ID attribute of the resulting element.

lang

Programming language of the code. The code will be highlighted accordingly, using the Pygments syntax highlighter. A full list of available languages can be found in the Pygments documentation. The values listed under "Short names" for each of the languages there are the values that can be used for this parameter. For example, to highlight the code according to C# syntax, the possible values are csharp, c#, and cs.

Examples

Code Result
{{code|Hello world}} Hello world
{{code|lang=css|border:1px solid #fff}} border:1px solid #fff