Cebur nuju daging

Mal:Markup/doc

Saking Wikipédia

Mal:TemplateStyles

This template is used to present markup or code side by side with the output it renders.

Usage

[uah wit]

Each pair of {{Markup}}'s arguments should be two copies of some wikitext markup, with the first of the pair enclosed in Mal: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
[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

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 {{subst: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.
  • Some templates may have error checking that places the page in a maintenance category.
    • Gaya Rujukan 1 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 Mal:Xtag tags. To work around this, replace the & with &amp; 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

[uah wit]

Multiple rows

[uah wit]
Markup Renders as
[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

With custom title and column headers

[uah wit]
How to write about foxes and dogs in Wikipedia.
Write this in wikitext and this will appear in the article.
[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

A complex example

[uah wit]

In this example, Mal:Tl2's second argument here uses Mal:Tl2 (to avoid headings appearing in the table of contents) and Mal:Tl2 (to avoid adding this page to the maintenance list).

Markup Renders as
[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

With HTML entities

[uah wit]

HTML entities are parsed in the markup cell. To work around this, replace the & with &amp; in the first column.

{{Markup| <nowiki>&amp;ndash;</nowiki> | &ndash;}}

renders as:

Markup Renders as
[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

With the glyphs "|" and "="

[uah wit]

If the markup contains the glyphs | or = they need to be replaced by the magic words {{!}} or {{=}}. 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:

{{markup
|<nowiki>use <code>|lang = en</code></nowiki>
|use <code>{{!}}lang {{=}} en</code>
}}

which renders as:

Markup Renders as
[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

More examples

[uah wit]
Markup Renders as
[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

Typing aid: template {{mra}}

[uah wit]

{{mra}} will duplicate the source text automatically, saving you the trouble of copying the text and adding Mal: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
[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

[markup]

[rendering]

See also

[uah wit]
  • {{Markup HTML Rendered}} for three-column Wikitext, HTML, and Rendered output
  • {{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

[uah wit]
Ini dokumennya TemplateData untuk template ini digunakan oleh VisualEditor dan alat lainnya; see a monthly parameter usage report for this template in articles.

TemplateData untuk Markup

Paraméter mal

ParaméterDéskripsiSorohStatus
margin-leftmargin-left

To set a margin on the table's lefthand side.

Baku
0
Krunadadi-dadi
widthwidth

To set the table's overall width.

Baku
auto
Krunadadi-dadi
stylestyle

For CSS styles amending the table's overall appearance.

Krunadadi-dadi
noheadersnoheaders

Set (as e.g. noheaders=on) to suppress the columns' headings and table's title.

Krunadadi-dadi
titletitle

Title above table.

Baku
none
Krunadadi-dadi
tagtag

Tag to use for markup. The default is pre and syntaxhighlight only works with single rows of text.

Aji kanikayang
pre syntaxhighlight
Baku
pre
Krunadadi-dadi
colheaderstylecolheaderstyle

For CSS styling to amend the appearance of each column's heading.

Krunadadi-dadi
col1headerstylecol1headerstyle

For CSS styling to amend the appearance of the first column's heading. Overrides (but does not replace) colheaderstyle.

Krunadadi-dadi
col1col1

First column (markup/code)'s heading.

Baku
"Markup"
Krunadadi-dadi
col2headerstylecol2headerstyle

For CSS styling to amend the appearance of the second column's heading. Overrides (but does not replace) colheaderstyle.

Krunadadi-dadi
col2col2

Second column (output)'s heading.

Baku
"Renders as"
Krunadadi-dadi
Column 1 Stylecol1style

For CSS styles to amend the appearance of the markup column (e.g. width of the column).

Baku
none
Conto
width:20em;
Krunadadi-dadi
Column 2 Stylecol2style

For CSS styles to amend the appearance of the output column (e.g. the background colour).

Baku
none
Conto
background-color:#fff;
Krunadadi-dadi
Markup text stylecodestyle markupstyle

Use CSS style code to change the appearance of content (text) in the Markup column.

Conto
white-space: nowrap;
Krunadadi-dadi
Output text styleoutputstyle

Use CSS style code to change the appearance of content (text) in the Renders-as column.

Conto
white-space: nowrap;
Krunadadi-dadi
paddingpadding

Padding within each cell

Baku
5px
Krunadadi-dadi
11

row 1, first column (markup/code)'s content.

Krunadadi-dadi
22

row 1, second column (output)'s content.

Krunadadi-dadi
33

row 2, first column's content (etc).

Krunadadi-dadi
44

row 2, second column's content (etc).

Krunadadi-dadi
3939

First column's content in last possible row.

Krunadadi-dadi
4040

Second column's content in last possible row.

Krunadadi-dadi