模板:Markup
This template is used to present markup or code side by side with the output it renders.
Usage
[kói ngièn-sṳ́-mâ]Each pair of {{Markup}}'s arguments should be two copies of some wikitext markup, with the first of the pair enclosed in 模板:Xtag tags. The template produces output in two columns, the first showing the markup and the second showing how it is rendered. The template accepts up to 40 unnamed parameters, resulting in up to 20 rows of examples.
This:
{{markup|<nowiki>'''Bold text'''</nowiki>|'''Bold text'''}}
Produces this:
Markup | Renders as |
---|---|
'''Bold text''' |
Bold text |
In many cases, the markup for both columns are identical, but there are instances where this may need to differ. If none of these issues apply, then you may use {{mra}} to save yourself from copying the code twice.
- Header markup such as
==
will show in the page table of contents; to avoid this, use {{fake heading}} in the markup for the second column (see example below). - Some templates will place the page in a maintenance category, which is usually undesired. For example.
- Instead of {{citation needed}}, use {{fake citation needed}} in the second column.
- Some templates may have error checking that places the page in a maintenance category.
模板:Cs1 templates with errors: add|template doc demo=true
to the template in the second column.- To avoid this and the associated red error messages make sure that each example on the page uses different sources.
- HTML entities are parsed in the first cell, even with 模板:Xtag tags. To work around this, replace the
&
with&
in the first column (see example below).
It is advisable to begin both copies of the markup with a newline; this is necessary if the first line of the markup must start on a new line (such as #, * or ;).
Examples
[kói ngièn-sṳ́-mâ]Multiple rows
[kói ngièn-sṳ́-mâ]Markup | Renders as |
---|---|
'''Bold text''' |
Bold text |
''Italic text'' |
Italic text |
[[Internal link]] |
|
{{cite book|ref=none|last=Smith|year=2021|title=Smith's book}} |
Smith (2021). Smith's book. |
<score>\relative c' { c( b~ c b c b c b c~ c)}</score> |
|
With custom title and column headers
[kói ngièn-sṳ́-mâ]Write this in wikitext | and this will appear in the article. |
---|---|
The quick brown [[fox]] jumps over the lazy [[dog]]. |
|
A complex example
[kói ngièn-sṳ́-mâ]In this example, 模板:Tl2's second argument here uses 模板:Tl2 (to avoid headings appearing in the table of contents) and 模板:Tl2 (to avoid adding this page to the maintenance list).
Markup | Renders as |
---|---|
The quick brown fox jumps over the lazy dog.{{#tag:ref|A footnote.<ref>A reference for the footnote.</ref>|group=nb}} The cow jumped over the moon.{{fact}} == Notes == {{reflist|group=nb}} == References == {{reflist}} |
The quick brown fox jumps over the lazy dog.[nb 1] The cow jumped over the moon.模板:Fake citation needed
|
With HTML entities
[kói ngièn-sṳ́-mâ]HTML entities are parsed in the markup cell. To work around this, replace the &
with &
in the first column.
Markup | Renders as |
---|---|
– |
– |
More examples
[kói ngièn-sṳ́-mâ]Markup | Renders as |
---|---|
{{cite book |last=White |first=T. H. |title=The Book of Merlyn |year=1977}} |
White, T. H. (1977). The Book of Merlyn. |
{{code|lang=html|{{cite book |last=White |first=T. H. |title=The Book of Merlyn |year=1977}}}} |
|
Typing aid: template {{mra}}
[kói ngièn-sṳ́-mâ]{{mra}} will duplicate the source text automatically, saving you the trouble of copying the text and adding 模板:Xtag tags to the first case.
This:
{{subst:mra|'''Bold text'''|''Italic text''}}
Will produce this:
{{markup| <nowiki>'''Bold text'''</nowiki>|'''Bold text'''| <nowiki>''Italic text''</nowiki>|''Italic text''}}
Which renders as:
Markup | Renders as |
---|---|
'''Bold text''' |
Bold text |
''Italic text'' |
Italic text |
See also
[kói ngièn-sṳ́-mâ]- {{Markup2}} for bulleted and indented markup.
- {{Markupv}} for the vertical presentation (above/below) of markup/code and its output.
- {{Automarkup}} does not require to write the code samples twice.
TemplateData
[kói ngièn-sṳ́-mâ]See the monthly error report for this template.
TemplateData for Markup
參數 | 描述 | 類型 | 狀態 | |
---|---|---|---|---|
margin-left | margin-left | To set a margin on the table's lefthand side.
| 字串 | 非必填 |
width | width | To set the table's overall width.
| 字串 | 非必填 |
style | style | For CSS styles amending the table's overall appearance. | 字串 | 非必填 |
noheaders | noheaders | Set (as e.g. noheaders=on) to suppress the columns' headings and table's title. | 字串 | 非必填 |
title | title | Title above table. | 字串 | 非必填 |
colheaderstyle | colheaderstyle | For CSS styling to amend the appearance of each column's heading. | 字串 | 非必填 |
col1headerstyle | col1headerstyle | For CSS styling to amend the appearance of the first column's heading. Overrides (but does not replace) colheaderstyle. | 字串 | 非必填 |
col1 | col1 | First column (markup/code)'s heading.
| 字串 | 非必填 |
col2headerstyle | col2headerstyle | For CSS styling to amend the appearance of the second column's heading. Overrides (but does not replace) colheaderstyle. | 字串 | 非必填 |
col2 | col2 | Second column (output)'s heading.
| 字串 | 非必填 |
Column 1 style | codestyle markupstyle | Use CSS style code to change the look of content in the Markup column.
| 字串 | 非必填 |
Column 2 style | outputstyle | Use CSS style code to change the look of content in the Renders-as column. | 字串 | 非必填 |
1 | 1 | row 1, first column (markup/code)'s content. | 字串 | 非必填 |
2 | 2 | row 1, second column (output)'s content. | 字串 | 非必填 |
3 | 3 | row 2, first column's content (etc). | 字串 | 非必填 |
4 | 4 | row 2, second column's content (etc). | 字串 | 非必填 |
39 | 39 | First column's content in last possible row. | 字串 | 非必填 |
40 | 40 | Second column's content in last possible row. | 字串 | 非必填 |