Template:Markup HTML Rendered/doc: Difference between revisions

Content deleted Content added
Fix example link target
Remove complex use cases, instead referring readers to Template:Markup/doc
Line 16:
{{Markup HTML Rendered|<nowiki>'''Bold text'''</nowiki>|<nowiki><b>Bold text</b></nowiki>|'''Bold text'''}}
 
In many cases, the markup for both columns are identical, but there are instances where this may need to differ. For guidance and examples of more complex usage, see [[Template:Markup/doc]].
 
* Header markup such as {{code|1===}} will show in the page table of contents; to avoid this, use {{tlx|fake heading}} in the markup for the third column (see example [[#A complex example|below]]).
* Some templates will place the page in a maintenance category, which is usually undesired. For example.
** Instead of {{tlx|citation needed}}, use {{tlx|fake citation needed}} in the third column.
* Some templates may have error checking that places the page in a maintenance category.
** <s>{{cs1}} templates with errors: add {{para|template doc demo|true}} to the template in the second column.</s>
** 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|nowiki}} tags. To work around this, replace the <code>&</code> with <code>&amp;amp;</code> in the first column (see example [[#With HTML entities|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==
Line 43 ⟶ 33:
| The quick brown [[fox]] jumps over the lazy [[dog]]. | The quick brown [[fox]] jumps over the lazy [[dog]].
}}
 
===A complex example===
 
In this example, {{tl2|Markup}}'s second argument here uses {{tl2|fake heading}} (to avoid headings appearing in the table of contents) and {{tl2|fake citation needed}} (to avoid adding this page to the maintenance list).
 
{{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=2|Notes}}
{{reflist|group=nb}}
 
{{fake heading|sub=2|References}}
{{reflist|close}}
}}
 
===With HTML entities===
HTML entities are parsed in the markup cell. To work around this, replace the <code>&</code> with <code>&amp;amp;</code> in the first column.
<pre>
{{Markup| &lt;nowiki>&amp;amp;ndash;</nowiki> | &amp;ndash;}}
</pre>
renders as:
{{Markup| <nowiki>&amp;ndash;</nowiki> | &ndash;}}
 
===With the glyphs "|" and "="===
If the markup contains the [[Glyph|glyph]]s <code>[[Vertical bar{{!}}|]]</code> or <code>[[Equals sign|=]]</code> they need to be replaced by the [[Help:Magic words#Other|magic words]] <code>[[:mw:Help:Magic_words#Other|<nowiki>{{!}}</nowiki>]]</code> or <code>[[:mw:Help:Magic_words#Other|<nowiki>{{=}}</nowiki>]]</code>. If not they are being interpreted for the Template:Markup itself as a separator between the parameters or between the parameter name and value! So as an example use:
<pre>
{{markup
|&lt;nowiki>use <code>|lang = en</code></nowiki>
|use <code>{{!}}lang {{=}} en</code>
}}
</pre>
which renders as:
{{markup
|<nowiki>use <code>|lang = en</code></nowiki>
|use <code>{{!}}lang {{=}} en</code>
}}
 
===More examples===
 
{{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|lang=html|{{cite book |last=White |first=T. H. |title=The Book of Merlyn |year=1977}}}}
</nowiki>|
{{code|lang=html|{{cite book |last=White |first=T. H. |title=The Book of Merlyn |year=1977}}}}
}}
 
==Typing aid: template {{tl|mra}}==
{{tl|mra}} will duplicate the source text automatically, saving you the trouble of copying the text and adding {{xtag|nowiki}} tags to the first case.
 
This:
<pre>{{subst:mra|'''Bold text'''|''Italic text''}}</pre>
 
Will produce this:
<pre>{{markup|
&lt;nowiki>'''Bold text'''</nowiki>|'''Bold text'''|
&lt;nowiki>''Italic text''</nowiki>|''Italic text''}}</pre>
 
Which renders as:
{{markup|
<nowiki>'''Bold text'''</nowiki>|'''Bold text'''|
<nowiki>''Italic text''</nowiki>|''Italic text''}}
 
==See also==