BBCode
From Wikipedia, the free encyclopedia
BBCode is an abbreviation for Bulletin Board Code, the lightweight markup language used to format posts in many message boards. It is also called forum codes. The available tags are usually indicated by rectangular brackets surrounding a keyword, and they are parsed by the message board system before being translated into a markup language that web browsers understand, usually HTML or XHTML.
Contents |
[edit] Purpose
BBCode was devised to provide a safer, easier and more limited way of allowing users to format their messages. Programmer convenience was certainly another factor, as BBCode is very simple to implement.[citation needed] Previously, many message boards allowed the users to include HTML formatting, a side effect of which was that malformed HTML could disrupt the page's layout, or HTML could be used to run JavaScript leading to XSS attacks. Some implementations of BBCode have suffered problems related to the way they translate the BBCode into HTML, which could negate the security that was intended to be given by BBCode. An alternative is a properly written HTML filter (many of which are freely available).
Although the basic tags of BBCode are similar in most internet forum software, there is currently no standards document for BBCode and there are consequently many incompatible variants. Some variants are case-sensitive while others are not. Some variants have tags which highlight the formatting of HTML, ASP, PHP, SQL and other markup languages and programming languages.
[edit] BBCode tags
The following are the most common BBCode tags available to most modern message boards, and are displayed here with their HTML equivalents. However, it should be noted that the effect of these tags can be changed substantially, and the effect may not be identical on all sites using BBCode.
BBCode | HTML | Effect |
[b]bolded text[/b] |
<strong>bolded text</strong> or <b>bolded text</b> |
bolded text |
[i]italicized text[/i] |
<em>italicized text</em> or <i>italicized text</i> |
italicized text |
[u]underlined text[/u] |
<span style="text-decoration: underline;">underlined text</span> |
underlined text |
[url]http://wikipedia.org[/url] |
<a href="http://wikipedia.org">http://wikipedia.org</a> |
http://wikipedia.org |
[url=http://wikipedia.org]Wikipedia[/url] |
<a href="http://wikipedia.org">Wikipedia</a> |
Wikipedia |
[img]http://upload.wikimedia.org/wikipedia/ commons/thumb/6/63/Wikipedia-logo.png/ 150px-Wikipedia-logo.png[/img] |
<img src="http://upload.wikimedia.org/wikipedia/ commons/thumb/6/63/Wikipedia-logo.png/ 150px-Wikipedia-logo.png" alt=""> |
|
[quote]quoted text[/quote] |
<blockquote><p>quoted text</p></blockquote> (usually implemented in more advanced ways) |
To quote:
|
[code]monospaced text[/code] |
<pre>monospaced text</pre> |
monospaced text |
[size=15]Large Text[/size] (The unit of measurement varies with each BBCode variant and could represent pixels, points, or relative HTML sizes.) |
<span style="font-size:12px">Large Text</span> |
Large Text |
[color=red]Red Text[/color] or
|
<span style="color:#FF0000">Red Text</span> |
Red Text |
[:-)]
(And other emoticons, depending on the variant) |
<img src="Face-smile.gif" alt=""> |
(Specific image and size vary) |
Many message boards include a FAQ with information on how to use their own variants of BBCode. In addition, some bulletin board systems allow administrators to define their own custom BBCodes. This is usually done by asking them to specify the BBCode markup (utilizing variables/wildcards to indicate the user-customizable parts of the code) and then indicating the XHTML replacement which will be substituted for the BBCode.
[edit] See Also
[edit] External links
- BBCode guide at phpBB.com
- BBCode quick reference
- BBCode extension for Mozilla Firefox
- BBCodeXtra extension for Mozilla Firefox
- HTML::BBCode perl module
- HTML::BBReverse perl module
- Python BBCode implementation
- Dotnet BBCode implementation
[edit] PHP Implementations
- PECL (PHP extension) BBCode implementation - with configurable C library
- PEAR BBCode implementation
- Recruiting Parser - over 25 tags, bundled smilies and extras
- BBcode2HTML - Free & easy BBcode translation in PHPtc:BBCode