Jump to content

Help:HTML in wikitext

From mediawiki.org
This page is a translated version of the page Help:HTML in wikitext and the translation is 20% complete.
PD 注意: このページを編集すると、編集内容が CC0 のもとで公開されることに同意したと見なされます。詳細はパブリック・ドメインのヘルプ ページを参照してください。 PD

MediaWikiはウィキテキストでHTMLタグを書けます。他のタグのブラケットはエスケープされ、タグは解析される代わりに表示されます。

使えるHTMLタグ

Allowed HTML tags in MediaWiki software
タグ 意味 Allowed since… 注記
‎<abbr> 略称 1.16
‎<b> Bring attention 1.1 Wikitext: three single quotes, e.g. Be careful to '''this text'''.
‎<bdi> Bidirectional isolate 1.20
‎<bdo> 双方向テキストのオーバーライド 1.22
‎<big> テキストを大きくする 1.1 big is deprecated in HTML, but not in wikitext (T154067)
‎<blockquote> ブロック引用 1.1
‎<br> 改行 1.1
‎<caption> 表のキャプション 1.1
‎<cite> Citation, i.e. reference to a cited creative work. 1.1
‎<code> Inline computer code 1.1
‎<data> Data, linked to machine-readable translation through value attribute. 1.21
‎<dd> Description details for a description term element, inside a description list. 1.1 Wikitext: : starting the line, respectively for description list details.
‎<del> Deleted text 1.3
‎<dfn> Definition. Wrap a term/phrase which is being defined. 1.17
‎<div> Content division, to apply CSS formatting to a block. 1.1
‎<dl> Description list. 1.1
‎<dt> Description term, inside a description list. 1.1 Wikitext: ; starting the line, respectively for description list term.
‎<em> Emphasis 1.1
‎<h1> Section heading – levels 1 to 6 1.1 Wikitext: pairs of equal signs (see help about formatting).

Note when you edit a section headed by an HTML heading, the edit summary will not be prefilled.

‎<hr> Thematic break 1.1 Wikitext: 4+ dashes (----) starting a line.
‎<i> Idiomatic text 1.1 Wikitext: two single quotes, e.g. ''idiomatic text''.
‎<ins> Added text 1.3
‎<kbd> Keyboard input 1.17
‎<li> List item 1.1 Wikitext: # or * starting the line, respectively for ordered list and unordered list.
‎<link> External resource link 1.27 Must have itemprop and href attributes set.[1]
‎<mark> Marked or highlighted text. 1.21
‎<meta> Metadata 1.27 Must have itemprop and content attributes set.[1]
‎<ol> Ordered list 1.1
‎<p> Paragraph 1.1 Wikitext: text between empty lines.
‎<pre> Preformated text 1.1 Content is not parsed, as in a ‎<nowiki> tag.

Wikitext: line starting with a blank space, i.e.  preformated text.

‎<q> Inline quotation 1.22
‎<rp> Ruby fallback parenthesis 1.1
‎<rt> Ruby text: annotation rendered near the base text. Inside a ruby tag. 1.1
‎<ruby> Ruby annotation. Encloses rt and rp. 1.1
‎<s> Strikethrough, for no longer accurate or relevant text. 1.1
‎<samp> Sample output, inline ouput text of a computer program. 1.17
‎<small> Side comment. 1.1
‎<span> Content span, to apply CSS formatting to an inline text. 1.4
‎<strong> Strong importance. 1.1
‎<sub> Subscript 1.1
‎<sup> Superscript 1.1
‎<table> Table, for tabular data. 1.1 Wikitext: see help page about tables.
‎<td> Table data cell, inside a tr tag. 1.1 Wikitext: see help page about tables.
‎<th> Table header cell, inside a tr tag 1.1 Wikitext: see help page about tables.
‎<time> Date/Time 1.21
‎<tr> Table row, inside a table tag. 1.1 Wikitext: see help page about tables.
‎<u> Unarticulated annotation. 1.1
‎<ul> Unordered list. 1.1
‎<var> Variable 1.1
‎<wbr> Line break opportunity. 1.22

非推奨タグ

The following tags are parsed by MediaWiki, but they are obsolete in HTML 5. They should be replaced with one of above tags. You might add a style attribute to reproduce the expected display.

HTML tags deprecated in MediaWiki
タグ Allowed since… Emits Lint error? 注記
‎<center> 1.1 はい
‎<font> 1.1 はい
‎<rb> 1.1 いいえ
‎<rtc> 1.24 いいえ
‎<strike> 1.1 はい
‎<tt> 1.1 はい

使用事例

アンカー

To create a linkable anchor, you can use any HTML tag with an id attribute.

E.g. <span id="note2"></span> allows you to create a link to its location on the page using [[#note2|See relevant note]].

CSS formatting

With style attribute

Using HTML tag instead of wikitext equivalent allows you to add a style attribute to define a custom display through CSS language.

With class and id attributes

Thanks to TemplateStyles, you may add a custom stylesheet to the document. So it is useful to add class or id attributes to the elements you want to customize their display.

Overridden HTML syntax

HTML コメント

Wikitext uses HTML comment syntax for its own comments: the parser ignores them, they are not rendered in resulting HTML source.

<!-- This text is a wikitext comment. After saving, it will be kept in wikitext source but will not be displayed, neither rendered in HTML source. -->

Pre タグ

The content of a pre tag is not parsed, as in a ‎<nowiki> tag.

You have to use the equivalent wikitext syntax to allow the content parsing. I.e. start each line with a blank space:

 Some preformatted text which can contain wikitext, i.e. this idiomatic text will be parsed.
 他の行。

関連項目

脚注