Editing Template:Markup

Jump to: navigation, search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 1: Line 1:
<includeonly>{| style="table-layout:fixed; width:{{{width|100%}}}; margin-top:0;margin-left:{{{margin-left|{{{margin|0}}}}}}; border-width:medium; padding:0; {{{style|}}}"
+
{{Documentation subpage}}
{{#if:{{{title|}}} |{{!}}+ '''{{{title}}}'''}}
+
<!-- Categories where indicated at the bottom of this page, please. -->
{{#if:{{{noheaders|}}}{{{notitle|}}} |
+
{{TOC right |limit=2}}
|!  scope="col" style="width:50%;{{{colheaderstyle|}}}{{{col1headerstyle|}}}"{{!}} {{{col1|{{{t1|Markup}}}}}} {{!!}}<!--
+
 
  -->scope="col" style="width:50%;{{{colheaderstyle|}}}{{{col2headerstyle|}}}"{{!}} {{{col2|{{{t2|Renders as}}}}}}
+
This template is used to present markup or code side by side with the output it renders.
}}<!--
+
 
-->{{#if:{{{1|}}}  |{{Markup/row |c1style={{{col1style|{{{codestyle|{{{markupstyle|}}}}}}}}}|c1={{{1|}}}  |c2style={{{col2style|{{{outputstyle|}}}}}}|c2={{{2|}}}  }} }}<!--
+
<templatedata>
-->{{#if:{{{3|}}}  |{{Markup/row |c1style={{{col1style|{{{codestyle|{{{markupstyle|}}}}}}}}}|c1={{{3|}}}  |c2style={{{col2style|{{{outputstyle|}}}}}}|c2={{{4|}}}  }} }}<!--
+
{
-->{{#if:{{{5|}}} |{{Markup/row |c1style={{{col1style|{{{codestyle|{{{markupstyle|}}}}}}}}}|c1={{{5|}}}  |c2style={{{col2style|{{{outputstyle|}}}}}}|c2={{{6|}}} }} }}<!--
+
"description": " ",
-->{{#if:{{{7|}}}  |{{Markup/row |c1style={{{col1style|{{{codestyle|{{{markupstyle|}}}}}}}}}|c1={{{7|}}}  |c2style={{{col2style|{{{outputstyle|}}}}}}|c2={{{8|}}} }} }}<!--
+
"paramOrder": [
-->{{#if:{{{9|}}}  |{{Markup/row |c1style={{{col1style|{{{codestyle|{{{markupstyle|}}}}}}}}}|c1={{{9|}}|c2style={{{col2style|{{{outputstyle|}}}}}}|c2={{{10|}}} }} }}<!--
+
"margin-left",
-->{{#if:{{{11|}}} |{{Markup/row |c1style={{{col1style|{{{codestyle|{{{markupstyle|}}}}}}}}}|c1={{{11|}}} |c2style={{{col2style|{{{outputstyle|}}}}}}|c2={{{12|}}} }} }}<!--
+
"width",
-->{{#if:{{{13|}}} |{{Markup/row |c1style={{{col1style|{{{codestyle|{{{markupstyle|}}}}}}}}}|c1={{{13|}}} |c2style={{{col2style|{{{outputstyle|}}}}}}|c2={{{14|}}} }} }}<!--
+
"style",
-->{{#if:{{{15|}}} |{{Markup/row |c1style={{{col1style|{{{codestyle|{{{markupstyle|}}}}}}}}}|c1={{{15|}}} |c2style={{{col2style|{{{outputstyle|}}}}}}|c2={{{16|}}} }} }}<!--
+
"noheaders",
-->{{#if:{{{17|}}} |{{Markup/row |c1style={{{col1style|{{{codestyle|{{{markupstyle|}}}}}}}}}|c1={{{17|}}} |c2style={{{col2style|{{{outputstyle|}}}}}}|c2={{{18|}}} }} }}<!--
+
"title",
-->{{#if:{{{19|}}} |{{Markup/row |c1style={{{col1style|{{{codestyle|{{{markupstyle|}}}}}}}}}|c1={{{19|}}} |c2style={{{col2style|{{{outputstyle|}}}}}}|c2={{{20|}}} }} }}<!--
+
"colheaderstyle",
-->{{#if:{{{21|}}} |{{Markup/row |c1style={{{col1style|{{{codestyle|{{{markupstyle|}}}}}}}}}|c1={{{21|}}} |c2style={{{col2style|{{{outputstyle|}}}}}}|c2={{{22|}}} }} }}<!--
+
"col1headerstyle",
-->{{#if:{{{23|}}} |{{Markup/row |c1style={{{col1style|{{{codestyle|{{{markupstyle|}}}}}}}}}|c1={{{23|}}} |c2style={{{col2style|{{{outputstyle|}}}}}}|c2={{{24|}}} }} }}<!--
+
"col1",
-->{{#if:{{{25|}}} |{{Markup/row |c1style={{{col1style|{{{codestyle|{{{markupstyle|}}}}}}}}}|c1={{{25|}}} |c2style={{{col2style|{{{outputstyle|}}}}}}|c2={{{26|}}} }} }}<!--
+
"col2headerstyle",
-->{{#if:{{{27|}}} |{{Markup/row |c1style={{{col1style|{{{codestyle|{{{markupstyle|}}}}}}}}}|c1={{{27|}}} |c2style={{{col2style|{{{outputstyle|}}}}}}|c2={{{28|}}} }} }}<!--
+
"col2",
-->{{#if:{{{29|}}} |{{Markup/row |c1style={{{col1style|{{{codestyle|{{{markupstyle|}}}}}}}}}|c1={{{29|}}} |c2style={{{col2style|{{{outputstyle|}}}}}}|c2={{{30|}}} }} }}<!--
+
"codestyle",
-->{{#if:{{{31|}}} |{{Markup/row |c1style={{{col1style|{{{codestyle|{{{markupstyle|}}}}}}}}}|c1={{{31|}}} |c2style={{{col2style|{{{outputstyle|}}}}}}|c2={{{32|}}} }} }}<!--
+
"outputstyle",
-->{{#if:{{{33|}}} |{{Markup/row |c1style={{{col1style|{{{codestyle|{{{markupstyle|}}}}}}}}}|c1={{{33|}}} |c2style={{{col2style|{{{outputstyle|}}}}}}|c2={{{34|}}} }} }}<!--
+
"1",
-->{{#if:{{{35|}}} |{{Markup/row |c1style={{{col1style|{{{codestyle|{{{markupstyle|}}}}}}}}}|c1={{{35|}}} |c2style={{{col2style|{{{outputstyle|}}}}}}|c2={{{36|}}} }} }}<!--
+
"2",
-->{{#if:{{{37|}}} |{{Markup/row |c1style={{{col1style|{{{codestyle|{{{markupstyle|}}}}}}}}}|c1={{{37|}}} |c2style={{{col2style|{{{outputstyle|}}}}}}|c2={{{38|}}} }} }}<!--
+
"3",
-->{{#if:{{{39|}}} |{{Markup/row |c1style={{{col1style|{{{codestyle|{{{markupstyle|}}}}}}}}}|c1={{{39|}}} |c2style={{{col2style|{{{outputstyle|}}}}}}|c2={{{40|}}} }} }}
+
"4",
|-
+
"39",
|style="width:50%; border-width:1px;border-style:solid none none none;border-color:#ddd; padding:5px; vertical-align:top;"|  
+
"40"
|style="width:50%; border-width:1px;border-style:solid none none none;border-color:#ddd; padding:5px; vertical-align:top;"|
+
],
|}</includeonly><noinclude>
+
"params": {
{{Documentation}}
+
"1": {
</noinclude>
+
"description": "row 1, first column (markup/code)'s content.",
 +
"type": "string"
 +
},
 +
"2": {
 +
"description": "row 1, second column (output)'s content.",
 +
"type": "string"
 +
},
 +
"3": {
 +
"description": "row 2, first column's content (etc).",
 +
"type": "string"
 +
},
 +
"4": {
 +
"description": "row 2, second column's content (etc).",
 +
"type": "string"
 +
},
 +
"39": {
 +
"description": "First column's content in last possible row.",
 +
"type": "string"
 +
},
 +
"40": {
 +
"description": "Second column's content in last possible row.",
 +
"type": "string"
 +
},
 +
"width": {
 +
"description": "To set the table's overall width.",
 +
"type": "string",
 +
"default": "100%"
 +
},
 +
"margin-left": {
 +
"description": "To set a margin on the table's lefthand side.",
 +
"type": "string",
 +
"default": "0"
 +
},
 +
"style": {
 +
"description": "For CSS styles amending the table's overall appearance.",
 +
"type": "string"
 +
},
 +
"title": {
 +
"description": "Title above table.",
 +
"type": "string"
 +
},
 +
"noheaders": {
 +
"description": "Set (as e.g. noheaders=on) to suppress the columns' headings and table's title.",
 +
"type": "string"
 +
},
 +
"col1": {
 +
"description": "First column (markup/code)'s heading.",
 +
"type": "string",
 +
"default": "\"Markup\""
 +
},
 +
"col2": {
 +
"description": "Second column (output)'s heading.",
 +
"type": "string",
 +
"default": "\"Renders as\""
 +
},
 +
"codestyle": {
 +
"description": "For CSS styles amending the presentation of the first column (markup/code)'s content (e.g. a smaller font-size).",
 +
"type": "string",
 +
"aliases": [
 +
"markupstyle"
 +
]
 +
},
 +
"outputstyle": {
 +
"description": "For CSS styles amending the presentation of the second column (output)'s content.",
 +
"type": "string"
 +
},
 +
"col1headerstyle": {
 +
"description": "For CSS styling to amend the appearance of the first column's heading. Overrides (but does not replace) colheaderstyle.",
 +
"type": "string"
 +
},
 +
"col2headerstyle": {
 +
"description": "For CSS styling to amend the appearance of the second column's heading. Overrides (but does not replace) colheaderstyle.",
 +
"type": "string"
 +
},
 +
"colheaderstyle": {
 +
"description": "For CSS styling to amend the appearance of each column's heading.",
 +
"type": "string"
 +
}
 +
}
 +
}
 +
</templatedata>
 +
 
 +
===Usage===
 +
Each cell in the first ("Markup") column uses {{tag|pre|o}} to retain newlines and spaces but styled to allow content to wrap within it. It is usually desirable to escape the content of these cells 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.
 +
 
 +
Each cell in the second ("Renders as") column is usually the unescaped markup copied from the corresponding "Markup" cell before it. 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; see examples below.
 +
* Header markup such as {{code|1===}} will show in the page table of contents; use {{tlx|fake heading}}.
 +
* 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}}.
 +
 
 +
===Limitations===
 +
===={{xtag|nowiki}}====
 +
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>:
 +
{{Markup
 +
|t1=Renders as |t2=Expected rendering
 +
| {{tl|tag}} | <nowiki>{{tl|tag}}</nowiki>
 +
}}
 +
 
 +
====HTML entities====
 +
HTML entities are parsed in the markup cell:
 +
{{Markup
 +
|t1=Nowikied markup shows as |t2=Expected markup
 +
| <nowiki>&nbsp;&ndash;</nowiki> | &amp;nbsp;&amp;ndash;
 +
}}
 +
 
 +
To work around this, replace the <code>&</code> with <code>&amp;amp;</code> thus <code>&amp;amp;nbsp;</code> will show as <code>&amp;nbsp;</code>
 +
 
 +
====List and indent markup====
 +
If the first line includes wikimarkup that must start on a new line such as #, * or ; then use {{tag|nowiki|s}}:
 +
 
 +
{{Markup |title=Without {{tag|nowiki|s}}
 +
| <nowiki># Item 1
 +
# Item 2
 +
# Item 3
 +
# Item 4</nowiki>
 +
|
 +
# Item 1
 +
# Item 2
 +
# Item 3
 +
# Item 4
 +
}}
 +
 
 +
{{Markup |title=With {{tag|nowiki|s}}
 +
| &lt;nowiki />
 +
<nowiki># Item 1
 +
# Item 2
 +
# Item 3
 +
# Item 4</nowiki>
 +
| <nowiki />
 +
# Item 1
 +
# Item 2
 +
# Item 3
 +
# Item 4
 +
}}
 +
 
 +
===Examples===
 +
 
 +
====Simple====
 +
{{Markup
 +
| <nowiki>'''Bold text'''</nowiki> | '''Bold text'''
 +
| <nowiki>''Italic text''</nowiki> | ''Italic text''
 +
}}
 +
 
 +
====More complex====
 +
Note that {{tl2|Markup}}'s second argument here uses {{tl2|fake heading}} and {{tl2|fake citation needed}}.
 +
{{Markup
 +
| <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>
 +
| 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}}
 +
}}
 +
 
 +
====Multiple rows====
 +
{{Markup
 +
| The quick brown fox jumps over the lazy dog. | The quick brown fox jumps over the lazy dog.
 +
| The quick brown fox jumps over the lazy dog. | The quick brown fox jumps over the lazy dog.
 +
| The quick brown fox jumps over the lazy dog. | The quick brown fox jumps over the lazy dog.
 +
| The quick brown fox jumps over the lazy dog. | The quick brown fox jumps over the lazy dog.
 +
| The quick brown fox jumps over the lazy dog. | The quick brown fox jumps over the lazy dog.
 +
}}
 +
 
 +
====With title====
 +
{{Markup |title=Foxes and dogs
 +
| The quick brown fox jumps over the lazy dog. | The quick brown fox jumps over the lazy dog.
 +
}}
 +
 
 +
====Showing rendered HTML====
 +
When a template is enclosed within {{tl|code}}, it shows the rendered HTML:
 +
 
 +
{{Markup
 +
| <nowiki>{{cite book |last=White |first=T. H. |title=The Book of Merlyn |year=1977}}</nowiki>
 +
| {{cite book |last=White |first=T. H. |title=The Book of Merlyn |year=1977}}
 +
 
 +
| <nowiki>{{code|{{cite book |last=White |first=T. H. |title=The Book of Merlyn |year=1977}}}}</nowiki>
 +
| {{code|{{cite book |last=White |first=T. H. |title=The Book of Merlyn |year=1977}}}}
 +
}}
 +
 
 +
===See also===
 +
* {{tl|Markup2}} for bulleted and indented markup.
 +
* {{tl|Markupv}} for the vertical presentation (above/below) of markup/code and its output.
 +
 
 +
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox |
 +
| <!-- Categories below this line, please: -->
 +
[[Category:Documentation assistance templates]]
 +
[[Category:Template namespace templates]]
 +
[[Category:Template test cases| ]]
 +
}}</includeonly>

Please note that all contributions to OpenVZ Virtuozzo Containers Wiki may be edited, altered, or removed by other contributors. If you don't want your writing to be edited mercilessly, then don't submit it here.
If you are going to add external links to an article, read the External links policy first!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)