Help:HTML in wikitext/ja

PD 注意: このページを編集すると、編集内容が CC0 のもとで公開されることに同意したと見なされます。詳細はパブリック・ドメインのヘルプ ページを参照してください。 PD

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

使えるHTMLタグと属性

MediaWikiソフトウェアで使用可能なHTMLタグと属性
タグ 意味 使用可能な属性 使用可能バージョン(以降) 注記
<abbr> 略称 common attributes 1.16
<b> 太字 common attributes 1.1 ウィキテキストでは3つの一重引用符でも表記可能。(例: '''このテキスト'''に注意)。
<bdi> 書字方向の分離 common attributes 1.20
<bdo> 双方向テキストのオーバーライド common attributes 1.22
<big> テキストを大きくする common attributes 1.1 <big> は HTML では非推奨ですが、ウィキテキストでは異なります (T154067)
<blockquote> ブロック引用 common attributes + cite 1.1
<br> 改行 common attributes + clear 1.1
<caption> 表のキャプション common attributes + align 1.1
<cite> 出典、つまり引用された創作物への参照。 common attributes 1.1
<code> コンピューターコード common attributes 1.1
<col> common attributes + span
<colgroup> common attributes + span
<data> value 属性を通じて機械的に読み取れるように変換されたデータにリンクする。 common attributes + value 1.21
<dd> 説明リスト内の用語要素に関する説明。 common attributes 1.1 ウィキテキスト: 先頭が : の行は、それぞれ説明リストの詳細になります。
<del> 削除済みのテキスト common attributes + cite, datetime 1.3
<dfn> 定義。定義する用語/フレーズを囲みます。 common attributes 1.17
<div> コンテンツの分割、ブロックにCSSの書式整形を適用。 common attributes + align 1.1
<dl> 説明リスト。 common attributes 1.1
<dt> 説明リスト内で説明される用語。 common attributes 1.1 ウィキテキスト: 先頭が ; の行は、それぞれ説明リストの用語を表します。
<em> 強調 common attributes 1.1
<h1> 節の見出し – レベル1から6 common attributes + align 1.1 ウィキテキスト: 等号のペア(書式整形に関するヘルプを参照)。

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

<hr> テーマの区切り common attributes + width 1.1 ウィキテキスト: 先頭が4つ以上のダッシュ(----)で始まる行。
<i> 慣用的なテキスト common attributes 1.1 ウィキテキスト: 2つの一重引用符(例: ''慣用的なテキスト'')。
<ins> 追加されたテキスト common attributes + cite, datetime 1.3
<kbd> キーボード入力 common attributes 1.17
<li> リスト項目 common attributes + type, value 1.1 ウィキテキスト: 先頭が # または * の行は、それぞれ番号付きリストと番号なしリストになります。
<link> 外部リソースへのリンク itemprop, href, title 1.27 itemprophref 属性の指定が必要です。[1] Excludes most values for rel, including the stylesheet value.
<mark> マークまたは強調表示されたテキスト。 common attributes 1.21
<meta> メタデータ itemprop, content 1.27 itempropcontent 属性の指定が必要です。[1]
<ol> 番号付きリスト common attributes + type, start, reversed 1.1
<p> 段落 common attributes + align 1.1 ウィキテキスト: 空行が含まれるテキスト。
<pre> 整形済みテキスト common attributes + width 1.1 <nowiki> タグのように、内容は解析されません。

ウィキテキスト: 空白で始まる行(例:  preformatted text)。

<q> インライン引用 common attributes + cite 1.22
<rp> ルビの代替表示用の括弧 common attributes 1.1
<rt> ルビテキスト: ベーステキスト付近に表示される注釈。ruby タグ内で使用。 common attributes 1.1
<ruby> ルビ注釈。rtrp を囲む。 common attributes 1.1
<s> 正確でなくなったか、関連性がなくなったテキストに対して引かれる取り消し線。 common attributes 1.1
<samp> コンピュータープログラムからのサンプル出力を示すインラインのテキスト。 common attributes 1.17
<small> サイドコメント。 common attributes 1.1
<span> コンテンツの範囲、インラインテキストにCSSの書式整形を適用。 common attributes 1.4
<strong> 非常に重要。 common attributes 1.1
<sub> 下付き文字 common attributes 1.1
<sup> 上付き文字 common attributes 1.1
<table> 表(テーブル)、表形式のデータ。 common attributes + summary, width, border, frame, rules, cellspacing, cellpadding, align, bgcolor 1.1 ウィキテキスト: 表に関するヘルプページを参照
<td> 表のデータセル、tr タグ内で使用。 common attributes + abbr, axis, headers, scope, rowspan, colspan, nowrap, width, height, bgcolor, align, valign 1.1 ウィキテキスト: 表に関するヘルプページを参照
<th> 表の見出しセル、tr タグ内で使用 common attributes + abbr, axis, headers, scope, rowspan, colspan, nowrap, width, height, bgcolor, align, valign 1.1 ウィキテキスト: 表に関するヘルプページを参照
<time> 日付/時刻 common attributes + datetime 1.21
<tr> 表の行、table タグ内で使用。 common attributes + bgcolor, align, valign 1.1 ウィキテキスト: 表に関するヘルプページを参照
<u> 明確な表現ではない注釈。 common attributes 1.1
<ul> 番号なしリスト。 common attributes + type 1.1
<var> 変数 common attributes 1.1
<wbr> 改行可能な位置。 common attributes 1.22

Common attributes

The following attributes are permitted on almost all tags listed in the table above (except meta and link):

  • HTML
    • id
    • class
    • style
    • lang
    • dir
    • title
    • tabindex
  • WAI-ARIA
    • aria-describedby
    • aria-flowto
    • aria-hidden
    • aria-label
    • aria-labelledby
    • aria-level
    • aria-owns
    • role
  • RDFa
    • about
    • property
    • resource
    • datatype
    • typeof
  • Microdata
    • itemid
    • itemprop
    • itemref
    • itemscope
    • itemtype

非推奨タグ

以下のタグはMediaWikiで解析されますが、HTML5では廃止されています。 上記のいずれかのタグに置き換える必要があります。 期待どおりの表示を再現するには、style 属性を追加してください。

MediaWikiにおける非推奨HTMLタグ
タグ 使用可能バージョン(以降) Lint エラーの有無 注記
<center> 1.1 はい
<font> 1.1 はい
<rb> 1.1 いいえ
<rtc> 1.24 いいえ
<strike> 1.1 はい
<tt> 1.1 はい

使用事例

アンカー

リンク可能なアンカーを作成するには、任意のHTMLタグに id 属性を指定します。

例えば、<span id="note2"></span> を使用すると、[[#note2|関連するメモを参照]] のようにしてページ上のその場所へのリンクを作成できます。

CSSによる書式整形

style属性の付与

ウィキテキストの代わりにHTMLタグを使用することで、style 属性を追加して、CSS言語によるカスタム表示を定義できます。

classid属性の付与

TemplateStyles を使用すると、文書にカスタムスタイルシートを追加できます。 そのため、表示をカスタマイズしたい要素に classid 属性を追加すると便利です。

挙動の異なるHTML構文

HTML コメント

ウィキテキストは独自のコメントにHTMLのコメント構文を使用します: 構文解析の際にこれらは無視され、出力されるHTMLソースには反映されません。

<!-- このテキストはウィキテキストのコメントです。保存すると、ウィキテキストのソースに反映されますが、表示はされず、HTMLソースにも出力されません。 -->

Pre タグ

pre タグの内容は、<nowiki> タグのように解析されません。

解析されるようにするには、同等のウィキテキスト構文を使用する必要があります。つまり、各行を空白で始めます:

 ウィキテキストを含むことができる整形済みのテキスト、つまり、この慣用的なテキストは解析されます。
 他の行。

関連項目

  • Help:Extension:Linter ページ内のHTMLの問題を検出する、Linter拡張機能に関するヘルプ。
  • HTML の制限 MediaWikiのHTMLコンテンツのデフォルトの制限と、そのサポートを拡張する拡張機能について
  • Manual:$wgRawHtml HTMLをさらに拡張する拡張機能

脚注