Manual:$wgRawHtml
HTML: $wgRawHtml | |
---|---|
<html>...</html> セクション内で未整形・未確認の HTML を使用できるようにする。 |
|
導入されたバージョン: | 1.3.4 |
除去されたバージョン: | 使用中 |
許容される値: | (真偽値) |
既定値: | false |
その他の設定: アルファベット順 | 機能順 |
詳細
MediaWikiディレクトリのファイル「LocalSettings.php」に「$wgRawHtml = true;
」を挿入すると、WikiでチェックされていないHTMLを挿入できます。
しかし、htmlコードは <html>...</html>
タグ内に記してMediawikiが識別できるようにしてください。
<html>...</html>
タグの外に記されたウィキコードの扱いには影響しません。MediaWiki バージョン: | ≧ 1.29 |
MediaWiki 1.29以降、未加工のHTMLタグは名前空間8(MediaWiki)には影響しなくなりました: phabricator:T156184.
未加工HTMLの有効化は必要ですか?
一部の HTMLタグは、$wgRawHtml = false
が設定されていてもウィキテキスト内で使うことができます。
m:Help:ウィキテキスト内におけるHTMLを参照してください。
The vast majority of fancy formatting seen on Wikimedia sites is achieved using these limited tags (e.g. tables with CSS style tags).
If you can make do with these limitations (leave $wgRawHtml = false
), your wiki will be more secure.
Also note that the "limited" wiki syntax is actually a deliberate design feature of wikis. It is a compact simplified markup which is easily understood even by non-technical users, easily visualised in diff displays, and discourages stylistic tinkering in favor of getting on with writing useful/interesting text.
関連する拡張機能
セキュリティ状態を改善しつつHTMLをより柔軟にしてくれる拡張機能がいくつかあります。
拡張機能を使う際、$wgRawHtml = true
を設定する必要があるものもあれば、代替の方法を提供するものもあります。
- HTML_restriction - list of extensions that allow for the inclusion of raw HTML
- Extension:SaferHTMLTag –
<html>
タグを含むページの編集を sysop とある特定のグループに属する利用者のみに限定する。 - Extension:NamespaceHTML - 特定の名前空間にあるHTMLを許可する。
- Extension:Secure HTML – adds "secret key" protection for html sections.
- Extension:HTMLets – allows pre-defined HTML snippets with
$wgRawHtml = false
. - Extension:Widgets – allows HTML and Smarty PHP templates, ostensibly in the form of "widgets", but it can do nearly anything else too.
Another way get custom HTML appearing within your wiki articles is to develop your own tag extension.
Do not be tempted to develop an extension which allows arbitrary HTML, otherwise the same serious security issues apply as with setting $wgRawHtml = true
.