Template:Code/doc

From Computernewb Wiki
Revision as of 11:23, 3 July 2021 by mediawiki>ExE Boss (→‎TemplateData: Update TemplateData)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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 Template:Para 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 for this template used by TemplateWizard, VisualEditor and other tools. Click here to see a monthly parameter usage report for this template in articles based on this TemplateData.

TemplateData for Code

A block or inline source code string.

Template parameters

This template prefers block formatting of parameters.

ParameterDescriptionTypeStatus
Languagelang 2

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

Default
  • text (if `inline=true`)
  • bash (if `inline` is not set)
Stringsuggested
Inline?inline

Whether to use inline formatting

Auto value
1
Stringoptional
Classclass

Applies only if `inline=true`

Stringoptional
IDid

Applies only if `inline=true`

Stringoptional
CSS Stylestyle

Applies only if `inline=true`

Stringoptional
Headerheader

Applies only if `inline` is not set

Lineoptional
Code1 code

The code to display.

Stringrequired

See also