Changes
Jump to navigation
Jump to search
no edit summary
{{Documentation subpage}}
<!-- Categories and interwikis go at the bottom of this page. -->
==Usage==
This template is used to present markup or code in a vertical format above the rendered output.
Parameters:
* '''markup''' or '''m''': Content of ''Markup'' cell
* '''renders''' or '''r''': Content of ''Renders as'' cell
* '''title''' or '''t''': Title of table; defaults to none
* '''margin''': Set table left margin in em
* '''width''': Table width; defaults to 90%
* '''style''': Additional CSS for the table
The ''Markup'' cell is pre-formatted with {{tag|pre|o}} to retain newlines and spaces, but styled to allow content to wrap within the cell. It is usually desirable to escape the content of the ''Markup'' cell so that the markup is displayed by wrapping the markup in {{xtag|nowiki}}. It is technically not possible to add this feature to the template.
In the ''Renders as'' cell, the content is usually the unescaped markup copied from the ''Markup'' cell. There are instances where this may differ:
* If the first line includes wikimarkup that must start on a new line such as #, * or ; then use {{tag|nowiki|s}} before the first line.
* Header markup such as {{code|1===}} will show in the page table of contents; use {{tlx|fake heading}}.
* When using {{tlx|reflist}} with no other parameters, use {{tlx|reflist|2=close=1}} to ensure that the reference list is closed.
* Some templates will place the page in a maintenance category, which is usually undesired:
** Instead of {{tlx|citation needed}}, use {{tlx|fake citation needed}}.
* Some templates may have error checking that places the page in a maintenance category. Suppress the category as possible:
** {{cs1}} templates can suppress the maintenance category by setting {{para|template doc demo|true}}.
==Example==
The following meta-example uses {{tlf|markupv}} to create an example of using {{tag|score}}:
<pre>
{{markupv|title=Example:
|markup=<nowiki><nowiki><score>\relative c' { c( b~ c b c b c b c~ c)}</score></nowiki></nowiki>
|renders=<score>\relative c' { c( b~ c b c b c b c~ c)}</score>
}}
</pre>
It generates:
{{markupv|title=Example:
|markup=<nowiki><score>\relative c' { c( b~ c b c b c b c~ c)}</score></nowiki>
|renders=<score>\relative c' { c( b~ c b c b c b c~ c)}</score>
}}
==Limitations==
If you don't wrap the content of the markup cell in {{xtag|nowiki}}, then any template markup will not be escaped, it will be expanded.
This example shows the markup for <nowiki>{{tl|tag}}</nowiki>:
{{markupv|t1=Renders as|t2=Expected rendering
|m={{tl|tag}}
|r=<nowiki>{{tl|tag}}</nowiki>
}}
HTML entities are parsed in the markup cell
{{markupv|t1=Nowikied markup shows as |t2=Expected markup
|m=<nowiki> –</nowiki>
|r=&nbsp;&ndash;
}}
To work around this, replace the <code>&</code> with <code>&amp;</code> thus <code>&amp;nbsp;</code> will show as <code>&nbsp;</code>
==Examples==
'''Simple examples:'''
{{markupv
|m=<nowiki>'''Bold text'''</nowiki>|r='''Bold text'''
}}{{markupv
|m=<nowiki>''Italic text''</nowiki>|r=''Italic text''
}}
'''Complex example:'''
Note that the second argument to {{tl2|markupv}} uses {{tl2|fake heading}} and {{tl2|fake citation needed}}.
{{markupv
|m=<nowiki>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}}
</nowiki>
|r=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.{{fake citation needed}}
{{fake heading|sub=3|Notes}}
{{Reflist|group=nb}}
{{fake heading|sub=3|References}}
{{Reflist|close}}
}}
'''With title:'''
{{markupv|title=Foxes and dogs
|m=The quick brown fox jumps over the lazy dog.
|r=The quick brown fox jumps over the lazy dog.
}}
When a template is enclosed within {{tl|code}}, it shows the rendered HTML:
{{markupv
|m=<nowiki>{{cite book |last=White |first=T. H. |title=The Book of Merlyn |year=1977}}</nowiki>
|r={{cite book |last=White |first=T. H. |title=The Book of Merlyn |year=1977}}
}}{{markupv
|m=<nowiki>{{code|{{cite book |last=White |first=T. H. |title=The Book of Merlyn |year=1977}}}}</nowiki>
|r={{code|{{cite book |last=White |first=T. H. |title=The Book of Merlyn |year=1977}}}}
}}
== See also ==
* {{tl|markup}}: side by side markup
* {{tl|markup2}}: bulleted and indented markup
* {{tl|markupv}}: above and below markup
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox||
<!-- Categories go here and interwikis go in Wikidata. -->
[[Category:Template test cases| ]]
[[Category:Template namespace templates]]
[[Category:Documentation assistance templates]]
}}</includeonly>
<!-- Categories and interwikis go at the bottom of this page. -->
==Usage==
This template is used to present markup or code in a vertical format above the rendered output.
Parameters:
* '''markup''' or '''m''': Content of ''Markup'' cell
* '''renders''' or '''r''': Content of ''Renders as'' cell
* '''title''' or '''t''': Title of table; defaults to none
* '''margin''': Set table left margin in em
* '''width''': Table width; defaults to 90%
* '''style''': Additional CSS for the table
The ''Markup'' cell is pre-formatted with {{tag|pre|o}} to retain newlines and spaces, but styled to allow content to wrap within the cell. It is usually desirable to escape the content of the ''Markup'' cell so that the markup is displayed by wrapping the markup in {{xtag|nowiki}}. It is technically not possible to add this feature to the template.
In the ''Renders as'' cell, the content is usually the unescaped markup copied from the ''Markup'' cell. There are instances where this may differ:
* If the first line includes wikimarkup that must start on a new line such as #, * or ; then use {{tag|nowiki|s}} before the first line.
* Header markup such as {{code|1===}} will show in the page table of contents; use {{tlx|fake heading}}.
* When using {{tlx|reflist}} with no other parameters, use {{tlx|reflist|2=close=1}} to ensure that the reference list is closed.
* Some templates will place the page in a maintenance category, which is usually undesired:
** Instead of {{tlx|citation needed}}, use {{tlx|fake citation needed}}.
* Some templates may have error checking that places the page in a maintenance category. Suppress the category as possible:
** {{cs1}} templates can suppress the maintenance category by setting {{para|template doc demo|true}}.
==Example==
The following meta-example uses {{tlf|markupv}} to create an example of using {{tag|score}}:
<pre>
{{markupv|title=Example:
|markup=<nowiki><nowiki><score>\relative c' { c( b~ c b c b c b c~ c)}</score></nowiki></nowiki>
|renders=<score>\relative c' { c( b~ c b c b c b c~ c)}</score>
}}
</pre>
It generates:
{{markupv|title=Example:
|markup=<nowiki><score>\relative c' { c( b~ c b c b c b c~ c)}</score></nowiki>
|renders=<score>\relative c' { c( b~ c b c b c b c~ c)}</score>
}}
==Limitations==
If you don't wrap the content of the markup cell in {{xtag|nowiki}}, then any template markup will not be escaped, it will be expanded.
This example shows the markup for <nowiki>{{tl|tag}}</nowiki>:
{{markupv|t1=Renders as|t2=Expected rendering
|m={{tl|tag}}
|r=<nowiki>{{tl|tag}}</nowiki>
}}
HTML entities are parsed in the markup cell
{{markupv|t1=Nowikied markup shows as |t2=Expected markup
|m=<nowiki> –</nowiki>
|r=&nbsp;&ndash;
}}
To work around this, replace the <code>&</code> with <code>&amp;</code> thus <code>&amp;nbsp;</code> will show as <code>&nbsp;</code>
==Examples==
'''Simple examples:'''
{{markupv
|m=<nowiki>'''Bold text'''</nowiki>|r='''Bold text'''
}}{{markupv
|m=<nowiki>''Italic text''</nowiki>|r=''Italic text''
}}
'''Complex example:'''
Note that the second argument to {{tl2|markupv}} uses {{tl2|fake heading}} and {{tl2|fake citation needed}}.
{{markupv
|m=<nowiki>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}}
</nowiki>
|r=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.{{fake citation needed}}
{{fake heading|sub=3|Notes}}
{{Reflist|group=nb}}
{{fake heading|sub=3|References}}
{{Reflist|close}}
}}
'''With title:'''
{{markupv|title=Foxes and dogs
|m=The quick brown fox jumps over the lazy dog.
|r=The quick brown fox jumps over the lazy dog.
}}
When a template is enclosed within {{tl|code}}, it shows the rendered HTML:
{{markupv
|m=<nowiki>{{cite book |last=White |first=T. H. |title=The Book of Merlyn |year=1977}}</nowiki>
|r={{cite book |last=White |first=T. H. |title=The Book of Merlyn |year=1977}}
}}{{markupv
|m=<nowiki>{{code|{{cite book |last=White |first=T. H. |title=The Book of Merlyn |year=1977}}}}</nowiki>
|r={{code|{{cite book |last=White |first=T. H. |title=The Book of Merlyn |year=1977}}}}
}}
== See also ==
* {{tl|markup}}: side by side markup
* {{tl|markup2}}: bulleted and indented markup
* {{tl|markupv}}: above and below markup
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox||
<!-- Categories go here and interwikis go in Wikidata. -->
[[Category:Template test cases| ]]
[[Category:Template namespace templates]]
[[Category:Documentation assistance templates]]
}}</includeonly>