Wikia

WoWWiki

Help:HTML Entity

Talk0
101,310pages on
this wiki
Revision as of 23:22, July 5, 2010 by WoWWiki-Skyfire (Talk | contribs)

(diff) ←Older revision | Latest revision (diff) | Newer revision → (diff)
HELP CONTENTS · Getting Started · New to WoWWIKI · Editing WoWWIKI · Editing WoWWIKI (advanced)
The WoWWIKI Community · Additional Help · Mists-Logo-Small Updating for Mists of Pandaria
See Wikia Help for general Wikia- and wiki- related help. See Metawiki logo 18x18 Meta-Wiki HelpIntro for basic MediaWiki usage!
See Wikimedia-logo-18x18Help:Special characters at meta.wikimedia.org for more general info about special characters in MediaWiki based wikis.


What is an HTML Entity? Edit

An HTML entity is a special character string that is translated by an HTML parser into a single character or symbol. All entities begin with the & (ampersand) and end with a ; (semi-colon). All fonts should support rendering of all of the ASCII range from 0 - 127 in a similar fashion (except specialty symbol fonts), but above that range the symbols used may not be reliably consistent from font to font. The use of entities is one method to try to maintain consistency of rendering character glyphs.

The basic Latin-1 character set (also known as ISO 8859-1) outside of the typical roman keyboard set has entity codes for most characters (mostly from #160 to #255) in the form of special names (usually abbreviated descriptions or acronyms). All characters including unicode can be represented by decimal versions (&dddd;) or hexadecimal versions (&xhhhh;).

Support for entities is not specific to wikis, but should be supported by all wikis, since they generally represent a translation layer from wikicode to HTML (though usually also including CSS and Javascript). This article does not apply directly to use in wikis, but is provided as a tool to use along with other wiki features.

Use of entities in WoWWiki Edit

In general, wiki editors like to use the <nowiki> tag to temporarily turn off special properties of wiki-reserved characters like *, [, or {. However, you can also use entities to display these wiki-characters without the wiki parser trying to do something with them.

NOTE: Named entity codes are case-sensitive, hence &rarr; (→) and &rArr; (⇒) are different.

Wiki-character entities Edit

Here are some commonly used wiki-characters and their entity codes:

Character Entity Wiki usage
# &#35; Numbered/ordered list
* &#42; Bulleted/unordered list
: &#58; Indent
; &#59; Definition (bold)
[ &#91; Links
] &#93; Links
{ &#123; Magic words and templates
| &#124; Magic words and templates
} &#125; Magic words and templates

Escaping HTML characters with entities Edit

Entities are also useful for rendering characters that might otherwise be parsed as HTML (or SGML tags specific to the wiki, like <nowiki>).

Character Entity HTML usage
< &lt; Tags
> &gt; Tags
& &amp; URLs and showing other entities
= &#61; Tag attributes and URLs
? &#63; URLs

In a wiki, you might want to use &lt;nowiki&gt; to describe what <nowiki> looks like.

Common symbols used in wikis Edit

Here are some entity codes for symbols often used in wikis:

Character Entity Symbol
&bull;
· &middot;
¢ &cent;
&euro;
£ &pound;
¥ &yen;
© &copy;
® &reg;
&trade;
&hellip;
&dagger;
&Dagger;
× &times;
÷ &divide;
&infin;
&loz;
&spades;
&clubs;
&hearts;
&diams;

Non-alphanumeric symbols Edit

There are also a variety of non-alphanumeric symbols with entity codes that have a variety of uses.

Character Entity HTML usage
&larr; Left arrow
&rarr; Right arrow
&uarr; Up arrow
&darr; Down arrow
&lArr; Left "double" arrow
&rArr; Right "double" arrow
&uArr; Up "double" arrow
&dArr; Down "double" arrow

Other reasons to use entities Edit

Often people copy-paste special characters (like € or ®) from some other source, like MS Word to a wiki editor and expect everyone to see the same character glyph. Unfortunately, most computer OSes encode these characters differently in their binary form when being transferred from one place to another. So, you can't rely on everything looking as you expect when someone looks at it on a browser on a different OS (problems between MS Windows and Macintosh are notorious). Entities solve this problem by, in most cases, identifying the character symbol by a common code that HTML renderers know how to display by standard. Non-unicode entities in the 128 to 255 ASCII range that don't use named codes (like &euro; for € or &reg; for ®) aren't as reliable, but most of the others will display what you expect or the generic box (☐) or question mark to indicate the glyph is not present in the font.

See also Edit

External linksEdit

HTML 4 Entities
Unicode


Around Wikia's network

Random Wiki