Changes

Jump to: navigation, search

Template:Markup

3,199 bytes removed, 22:31, 31 March 2015
fixed (wrong copy/paste)
{{Documentation subpage}}<!-- Categories where indicated at the bottom of this page, please. --includeonly>{{TOC right |limitstyle=2}} This template is used to present markup or code side by side with the output it renders. <templatedata>{ "description"table-layout:fixed; width: " ", "paramOrder"{{{width|100%}}}; margin-top: [ "0;margin-left", ":{{{margin-left|{{{margin|0}}}}}}; border-width", ":medium; padding:0; {{{style|}}}", "noheaders", "{{#if:{{{title", "colheaderstyle",|}}} |{{!}}+ '''{{{title}}}'''}} "col1headerstyle",{{#if:{{{noheaders|}}}{{{notitle|}}} | |! scope="col1col", style="col2headerstylewidth:50%;{{{colheaderstyle|}}}{{{col1headerstyle|}}}", "col2", "codestyle", "outputstyle", "1", "2",{{!}} {{{col1|{{{t1|Markup}}}}}} {{!!}}<!-- -->scope="3col", "4", "39", "40" ], "paramsstyle="width: 50%;{{ "1": { "description": "row 1, first column (markup/code)'s content.", "type": "string" colheaderstyle|}}}{{{col2headerstyle|}}}, "2": { "description": "row 1, second column (output)'s content.", "type": "string" {!}}, "3": {{{col2|{{{t2|Renders as}}}}}} "description": "row 2, first column's content (etc).", "type": "string" }, "4"}<!---->{{#if: { "description": "row 2, second column's content (etc).", "type": "string" }, "39": { "description": "First column's content in last possible {1|}}} |{{Markup/row.", "type": "string" }, "40": |c1style={{{col1style|{{{codestyle|{{ "description": "Second column's content in last possible row.", "type": "string" {markupstyle|}}}}}}}}, "width": { "description": "To set the table's overall width.", "type": "string", "default": "100%" }, "margin-left": |c1={{{1|}}} |c2style={{ "description": "To set a margin on the table's lefthand side.", "type": "string", "default": "0" {col2style|{{{outputstyle|}}}}}, "style": { "description": "For CSS styles amending the table's overall appearance.", "type": "string" }, "title": |c2={{{ "description": "Title above table.", "type": "string" 2|}}} }} }},<!-- "noheaders"-->{{#if: { "description": "Set (as e.g. noheaders{{3|}}} |{{Markup/row |c1style=on) to suppress the columns' headings and table's title.", "type": "string" }, "col1": { "description": "First column (markup/code)'s heading.", "type": "string", "default": "\"Markup\"" {{col1style|{{{codestyle|{{{markupstyle|}}, "col2": }}}}}}}|c1={{{3|}}} |c2style={{ "description": "Second column (output)'s heading.", "type": "string", "default": "\"Renders as\"" }, "codestyle": {col2style|{{{outputstyle|}}}}}}|c2={{{4|}}} }} }}<!-- "description": "For CSS styles amending the presentation of the first column (markup/code)'s content (e.g. a smaller font-size).", "type": "string", "aliases"-->{{#if: [ "markupstyle" ] {{{5|}}}, "outputstyle": |{{Markup/row |c1style={{{col1style|{{{codestyle|{{ "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" markupstyle|}}}}}}}}}, "col2headerstyle": |c1={ "description": "For CSS styling to amend the appearance of the second column's heading. Overrides (but does not replace) colheaderstyle.", "type": "string" {{5|}}}, "colheaderstyle": |c2style={ "description": "For CSS styling to amend the appearance of each column's heading.", "type": "string" {{col2style|{{{outputstyle|}}} }}</templatedata> }|c2===Usage===Each cell in the first ("Markup") column uses {{tag{6|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:* If the first line includes wikimarkup that must start on a new line such as #, * or ; then use {{tag{7|nowiki|s}} before the first line; see examples below.* Header markup such as } |{{codeMarkup/row |1c1style===}} will show in the page table of contents; use {{tlx{col1style|fake heading}}.* Some templates will place the page in a maintenance category, which is usually undesired:** Instead of {{tlx{codestyle|citation needed}}, use {{tlx{markupstyle|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======}}}|c1={{xtag{7|nowiki}}} |c2style====If you don't wrap the content of the markup cell in {{xtag{col2style|nowiki{{{outputstyle|}}}}}}, then any template markup will not be escaped, it will be expanded. This example shows the markup for <nowiki>|c2={{{tl8|tag}}} }} }}</nowiki>:{!---->{{#if:{Markup|t1=Renders as |t2=Expected rendering| {{tl9|tag}} } | <nowiki>{{tlMarkup/row |c1style={{{col1style|{{{codestyle|{{{markupstyle|tag}}</nowiki>}} ===}}}}}|c1=HTML entities====HTML entities are parsed in the markup cell:{{Markup{9|t1=Nowikied markup shows as }}} |t2c2style=Expected markup{{{col2style| <nowiki>&nbsp;&ndash;</nowiki> {{{outputstyle| &amp;nbsp;&amp;ndash;}} To work around this, replace the <code>&</code> with }}}}|c2={{{10|}}} }} }}<code!---->&amp;amp;</code> thus <code>&amp;amp;nbsp;<{{#if:{{{11|}}} |{{Markup/code> will show as <code>&amp;nbsp;</code> row |c1style====List and indent markup====If the first line includes wikimarkup that must start on a new line such as #, * or ; then use {{tag{col1style|nowiki|s}}: {{Markup {codestyle|title=Without {{tag{markupstyle|nowiki|s}}}}}}}}}| <nowiki># Item 1# Item 2# Item 3# Item 4</nowiki>c1={{{11|# Item 1# Item 2# Item 3# Item 4}} } |c2style={{{Markup col2style|title=With {{tag{outputstyle|nowiki|s}}}}}}| &lt;nowiki />c2={{{12|}}} }} }}<!--<nowiki-->{{# Item 1# Item 2# Item 3# Item 4<if:{{{13|}}} |{{Markup/nowiki>row | <nowiki /># Item 1# Item 2# Item 3# Item 4c1style={{{col1style|{{{codestyle|{{{markupstyle|}}}} }}}}}|c1===Examples=== ====Simple===={{Markup{13| <nowiki>'''Bold text'''</nowiki> }}} | '''Bold text'''c2style={{{col2style| <nowiki>''Italic text''</nowiki> {{{outputstyle| ''Italic text''}} ====More complex}}}}|c2====Note that {{tl2{14|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.{{#tagif:ref{{{15|A footnote.<ref>A reference for the footnote.<}}} |{{Markup/ref>row |groupc1style=nb}} The cow jumped over the moon.{{fact}}  == Notes == {col1style|{{{reflistcodestyle|group=nb{{{markupstyle|}}}}}}}}  }|c1== References == {{reflist{15|}}} </nowiki>| The quick brown fox jumps over the lazy dog.c2style={{{col2style|{{{#tag:refoutputstyle|A footnote.<ref>A reference for the footnote.</ref>|group=nb}} The cow jumped over the moon.{{fake citation needed}} }}|c2={{{fake heading16|sub=3|Notes}}{{reflist|group=nb}}} }}<!-- -->{{fake heading|sub=3|References}}#if:{{{reflist17|close}}}} ====Multiple rows====|{{Markup/row | The quick brown fox jumps over the lazy dog. c1style={{{col1style| The quick brown fox jumps over the lazy dog.{{{codestyle| The quick brown fox jumps over the lazy dog. | The quick brown fox jumps over the lazy dog.{{{markupstyle| The quick brown fox jumps over the lazy dog. }}}}}}}}}| The quick brown fox jumps over the lazy dog.c1={{{17| 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.}} } |c2style====With title===={{Markup {col2style|title=Foxes and dogs{{{outputstyle| The quick brown fox jumps over the lazy dog. | The quick brown fox jumps over the lazy dog.}} }}}}|c2====Showing rendered HTML====When a template is enclosed within {{tl{{18|code}}, it shows the rendered HTML:} }} }}<!-- {{Markup | <nowiki-->{{cite book #if:{{{19|last=White |first=T. H. |title=The Book of Merlyn |year=1977}}</nowiki> } | {{cite book Markup/row |lastc1style=White {{{col1style|first=T. H. {{{codestyle|title=The Book of Merlyn {{{markupstyle|year=1977}}  }}}}}}}| <nowiki>{c1={code|{{cite book 19|last=White }}} |firstc2style=T. H. {{{col2style|title=The Book of Merlyn {{{outputstyle|year=1977}}}}</nowiki> }}| c2={{code|{{cite book |last=White |first=T. H. 20|title=The Book of Merlyn |year=1977}}}}}}}<!-- ===See also===* -->{{#if:{{{tl21|Markup2}} for bulleted and indented markup.* } |{{tlMarkup/row |Markupvc1style={{{col1style|{{{codestyle|{{{markupstyle|}}}}}}}}} for the vertical presentation (above/below) of markup/code and its output. <includeonly>|c1={{{21|}}} |c2style={{{col2style|{{{{#ifeq:{{SUBPAGENAMEoutputstyle|}}}}}}|c2={{{22|}}} }} }}<!---->{{#if:{{{23|}}} |{{Markup/row |c1style={{{col1style|{{{codestyle|{{{markupstyle|}}}}}}}}}|c1={{{23|}}} |c2style={{{col2style|{{{outputstyle|}}}}}}|c2={{{24|}}} }} }}<!---->{{#if:{{{25|}}} |{{Markup/row |c1style={{{col1style|{{{codestyle|{{{markupstyle|}}}}}}}}}|c1={{{25|}}} |c2style={{{col2style|{{{outputstyle|}}}}}}|c2={{{26|}}} }} }}<!---->{{#if:{{{27|}}} |{{Markup/row |c1style={{{col1style|{{{codestyle|{{{markupstyle|}}}}}}}}}|c1={{{27|}}} |c2style={{{col2style|{{{outputstyle|}}}}}}|c2={{{28|}}} }} }}<!---->{{#if:{{{29|}}} |{{Markup/row |c1style={{{col1style|{{{codestyle|{{{markupstyle|}}}}}}}}}|c1={{{29|}}} |c2style={{{col2style|{{{outputstyle|}}}}}}|c2={{{30|}}} }} }}<!---->{{#if:{{{31|}}} |{{Markup/row |c1style={{{col1style|{{{codestyle|{{{markupstyle|}}}}}}}}}|c1={{{31|}}} |c2style={{{col2style|{{{outputstyle|}}}}}}|c2={{{32|}}} }} }}<!---->{{#if:{{{33|}}} |{{Markup/row |c1style={{{col1style|{{{codestyle|{{{markupstyle|}}}}}}}}}|c1={{{33|}}} |c2style={{{col2style|{{{outputstyle|}}}}}}|c2={{{34|}}} }} }}<!---->{{#if:{{{35|}}} |{{Markup/row |c1style={{{col1style|{{{codestyle|{{{markupstyle|}}}}}}}}}|c1={{{35|}}} |c2style={{{col2style|{{{outputstyle|}}}}}}|c2={{{36|}}} }} }}<!---->{{#if:{{{37|}}} |{{Markup/row |c1style={{{col1style|{{{codestyle|{{{markupstyle|}}}}}}}}}|c1={{{37|}}} |c2style={{{col2style|{{{outputstyle|}}}}}}|c2={{{38|}}} }} }}<!---->{{#if:{{{39|}}} |{{Markup/row |c1style={{{col1style|{{{codestyle|{{{markupstyle|}}}}}}}}}|c1={{{39|}}} |c2style={{{col2style|{{{outputstyle|}}}}}}|c2={{{40|}}} }} }}|-|style="width:50%; border-width:1px;border-style:solid none none none;border-color:#ddd; padding:5px; vertical-align:top;"| |style="width:50%; border-width:1px;border-style:solid none none none;border-color:#ddd; padding:5px; vertical-align:top;"| |}</includeonly><noinclude>{{Documentation}}|sandbox || <!-- Categories below this line, please: -->[[Category:Documentation assistance templates]][[Category:Template namespace templates]][[Category:Template test cases| ]]}}</includeonlynoinclude>

Navigation menu