跳转到内容

模板:Code/doc

来自天灾之下:危险连接资料站

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

A block or inline source code string.

模板参数

此模板首选参数换行的代码块格式。

参数描述类型状态
Languagelang 2

The programming language of the source code. List of valid values is at: Extension:SyntaxHighlight#Supported_languages

默认值
  • text (if `inline=true`)
  • bash (if `inline` is not set)
字符串推荐
Inline?inline

Whether to use inline formatting

自动值
1
字符串可选
Classclass

Applies only if `inline=true`

字符串可选
IDid

Applies only if `inline=true`

字符串可选
CSS Stylestyle

Applies only if `inline=true`

字符串可选
Headerheader

Applies only if `inline` is not set

单行文本可选
Code1 code

The code to display.

字符串必需

See also