Help:HTML in wikitext: Difference between revisions

Content deleted Content added
m Permitted HTML: Cleanup; Update
Line 3:
The following [[HTML element]]s are currently permitted:
{{Colbegin|3}}
{| border="0" cellpadding="5" class="plainlinks"
* [[HTML element#General|<abbr>]]
| valign="top"|
* [[HTML element#Presentation|<b>]]
* [[HTML element#Presentation|<big>]]
Line 21:
* [[HTML element#Presentation|<font>]]
* [[HTML element#Basic Text|<h1>]]
| valign="top"|
* [[HTML element#Basic Text|<h2>]]
* [[HTML element#Basic Text|<h3>]]
Line 34 ⟶ 33:
* [[HTML element#Basic Text|<p>]]
* [[HTML element#Other Block Elements|<pre>]]
* [[Ruby character#Ruby markup|<rb>]]
* [http://www.w3.org/TR/1999/WD-ruby-19990322/ <rb>]
* [[Ruby character#Ruby markup|<rp>]]
* [http://www.w3.org/TR/1999/WD-ruby-19990322/ <rp>]
* [[Ruby character#Ruby markup|<rt>]]
* [http://www.w3.org/TR/1999/WD-ruby-19990322/ <rt>]
* [http://www.w3.org/TR/1999/WD-ruby-19990322/[Ruby character#Ruby markup|<ruby>]]
| valign="top"|
* [[HTML element#Presentation|<s>]]
* [[HTML element#Presentation|<small>]]
Line 55 ⟶ 53:
* [[HTML element#Computer Phrase Elements|<var>]]
* [[HTML element#HTML Comment|<!-- ... -->]]
{{Colend}}
|}
 
For many HTML elements, more convenient wikitext code is available, see [[Help:Editing]]. On the other hand, HTML tags allow an <ttcode>id</ttcode> attribute that can be referenced in one's [[Help:User style|user style]] CSS, and allows the tagelement to be used as link target.
 
For exampleHowever, the anchor element <ttcode>&lt;a></ttcode> is not allowed, so the wikitext
For many HTML elements, more convenient wikitext code is available, see [[Help:Editing]]. On the other hand, HTML tags allow an <tt>id</tt> that can be referenced in one's [[Help:User style|user style]] CSS, and allows the tag to be used as link target.
: <code><nowiki><a href="http://meta.wikimedia.org/">Main Page</a></nowiki></code>
 
 
For example, the anchor element <tt>&lt;a></tt> is not allowed, so the wikitext
 
: <code><nowiki><a href="http://meta.wikimedia.org/">Main Page</a></nowiki></code>
 
is treated like the wikitext
: <code><nowiki>&amp;lt;a href="http://meta.wikimedia.org/"&amp;gt;Main Page&amp;lt;/a&amp;gt;</nowiki></code>
 
: <code><nowiki>&amp;lt;a href="http://meta.wikimedia.org/"&amp;gt;Main Page&amp;lt;/a&amp;gt;</nowiki></code>
 
and is therefore displayed as
: {{Quote|1=<a href="http://meta.wikimedia.org/">Main Page</a>}}
 
which is unlikely to be what the editor intended. Instead of using the anchor element (&lt;a&gt;) the wiki markup for external reference is recommendedrequired (enclosed in square brackets with the URL separated from the contents by a single space):
: <a href="http://meta.wikimedia.org/">Main Page</a>
: <code><nowiki>[http://meta.wikimedia.org/ Main Page]</nowiki></code>
 
which is unlikely to be what the editor intended. Instead of using the anchor element (&lt;a&gt;) the wiki markup for external reference is recommended (enclosed in square brackets with the URL separated from the contents by a single space):
 
: <code><nowiki>[http://meta.wikimedia.org/ Main Page]</nowiki></code>
 
displays as:
: {{Quote|[http://meta.wikimedia.org/ Main Page]}}
 
The following excerpt from [http://svn.wikimedia.org/viewvc/mediawiki/tags/REL1_6_6trunk/phase3/includes/Sanitizer.php?view=markup Sanitizer.php] additionally shows which attributes are allowed.
: [http://meta.wikimedia.org/ Main Page]
 
 
<br clear=all><!-- stop floating navbox before pre -->
 
The following excerpt from [http://svn.wikimedia.org/viewvc/mediawiki/tags/REL1_6_6/phase3/includes/Sanitizer.php?view=markup Sanitizer.php] additionally shows which attributes are allowed.
 
<source lang="php">
$htmlpairshtmlpairsStatic = array( # Tags that must be closed
'b', 'del', 'i', 'ins', 'u', 'font', 'big', 'small', 'sub', 'sup', 'h1',
'h2', 'h3', 'h4', 'h5', 'h6', 'cite', 'code', 'em', 's',
'strike', 'strong', 'tt', 'var', 'div', 'center',
'blockquote', 'ol', 'ul', 'dl', 'table', 'caption', 'pre',
'ruby', 'rt' , 'rb' , 'rp', 'p', 'span', );'u', 'abbr'
);
$htmlsingle = array(
'br', 'hr', 'li', 'dt', 'dd'
);
$htmlsingleonly = array( # Elements that cannot have close tags
'br', 'hr'
);
$htmlnest = array( # Tags that can be nested--??
'table', 'tr', 'td', 'th', 'div', 'blockquote', 'ol', 'ul',
'dl', 'font', 'big', 'small', 'sub', 'sup', 'span'
);
$tabletags = array( # Can only appear inside table, we will close them
'td', 'th', 'tr' ,
);
$htmllist = array( # Tags used by list
'ul','ol',
);
$listtags = array( # Tags that can appear in a list
'li',
);
</source>