Manual:$wgRawHtml
HTML: $wgRawHtml | |
---|---|
Allow raw, unchecked HTML in <html>...</html> sections. |
|
Introduced in version: | 1.3.4 |
Removed in version: | still in use |
Allowed values: | (boolean) |
Default value: | false |
Other settings: Alphabetical | By function |
DetailsEdit
Insert $wgRawHtml = true;
into the file LocalSettings.php in your main MediaWiki directory and the wiki will allow you to insert raw unchecked HTML.
However, you must embed your html within the <html>...</html>
tags so that MediaWiki can differentiate it.
<html>...</html>
tags is handled.MediaWiki version: | ≥ 1.29 |
Since MediaWiki 1.29, the raw HTML tag has no effect in namespace 8 (MediaWiki): phabricator:T156184.
Is enabling raw HTML necessary?Edit
Some HTML tags are permitted in wikitext, even with $wgRawHtml = false
.
See m:Help:HTML in wikitext.
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.
Related ExtensionsEdit
There are a number of extensions which promise to allow more HTML flexibility, while improving the security situation.
Some require setting $wgRawHtml = true
in conjunction with using the extension, while others offer an alternative.
- HTML restriction - list of extensions that allow for the inclusion of raw HTML
- Extension:SaferHTMLTag – Allows only sysops and certain user groups to edit pages containing the
<html>
tag. - Extension:NamespaceHTML - allows HTML in specific namespaces.
- 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
.