Template:Mono/doc
This is a documentation subpage for Template:Mono. It may contain usage information, categories and other content that is not part of the original template page. |
This template is used on approximately 30,000 pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them. |
This template uses TemplateStyles: |
This template should not be used in citation templates such as Citation Style 1 and Citation Style 2, because it includes markup that will pollute the COinS metadata they produce; see Wikipedia:COinS. |
Usage
{{mono|text to format here}}
renders as:
Template:Ifsubsttext to format here
This template is for formatting short bits of content (the only parameter) as monospaced (nonproportional) text. It is simply a quick shorthand for the necessary CSS code. It is a replacement for <tt>...</tt>
, which is an obsolete element under HTML5. (Non-conforming features)
This template Template:Em be used where the content is being rendered in monospaced text for purely stylistic/display reasons, where this display has no particular semantic significance.
It Template:Em be used to indicate information with these semantics:
- source code, use {{code}} or
<code>...</code>
instead - variables or variable input, use {{var}} or
<var>...</var>
instead - keyboard input, use {{kbd}} or
<kbd>...</kbd>
instead - sample output, use {{samp}} or
<samp>...</samp>
instead
It Template:Em be used to mark up multiple paragraphs, sections or other block elements, as it uses <span>
, which is an inline element. Use {{monodiv}} and {{pre}} for multiple blocks of text, or use multiple instances of {{Mono}} for each individual line.
When the content ends with a single closing curly brace (}
), the content should be followed by <nowiki/>
, for example, to mark up {foo}
, use {{mono|{foo}<nowiki/>}}
or {{mono|<nowiki>{foo}</nowiki>}}
.
If the content contains pipe characters (|
) not surrounded by <nowiki>...</nowiki>
, they must be escaped with |
or {{!}}
.
Parameters
There are two parameters:
|1=
or unnamed- The content to format as monospaced. If the content contains a
=
character, the parameter must be numbered or the template will break. (The parameter does not need to be numbered if the=
character is surrounded by<nowiki>...</nowiki>
, or if it is escaped as=
.) For backward compatibility with an old, merged-in template, this parameter can also be called|2=
. |needs_review=yes
- Used (e.g. by bots or AWB scripts) to indicate replacement of now-obsolete
<tt>...</tt>
markup with Template:Tnull markup. This template displays nothing and presently does no categorization, though a cleanup category can be created if necessary. It indicates that the markup may need to be changed to something more semantically meaningful, such as<code>...</code>
,<samp>...</samp>
, or<kbd>...</kbd>
.
TemplateData
See also
- {{pre}}
- {{code}}
- {{kbd}}
- {{syntaxhighlight}}
- {{samp}}
- {{var}}
- {{param value}}
Template:Semantic markup templates