BBCode
From Wikipedia, the free encyclopedia
|
|
This article is missing citations or needs footnotes. Please help add inline citations to guard against copyright violations and factual inaccuracies. (July 2008) |
| Operating system | Cross-platform |
|---|---|
| Development status | Active |
| Type | message board |
| Website | http://www.bbcode.org/ |
Bulletin Board Code or BBCode is a lightweight markup language used to format posts in many message boards. The available tags are usually indicated by square 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. 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 | example HTML | Effect | |
[b]bolded text[/b] |
<b>bolded text</b> or <span style="font-weight: bold;">bolded text</span> |
bolded text | |
[i]italicized text[/i] |
<i>italicized text</i> or <span style="font-style: italic;">italicized text</span> |
italicized text | |
[u]underlined text[/u] |
<u>underlined text</u> or <span style="text-decoration: underline;">underlined text</span> |
underlined text | |
[s]strikethrough text[/s] |
<s>strikethrough text</s> or <span style="text-decoration: line-through;">strikethrough text</span> |
||
[url]http://example.org[/url] |
<a href="http://example.org">http://example.org</a> |
http://example.org | |
[url=http://example.com]Example[/url] |
<a href="http://example.com">Example</a> |
Example | |
[img]http://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/Go-home.svg/100px-Go-home.svg.png[/img] |
<img src="http://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/Go-home.svg/100px-Go-home.svg.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:15px">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) |
|
[table] [tr] [td]table data[/td] [/tr] [/table]
|
<table><tr><td>table data</td></tr></table> |
|
A few places you may also find the tag [background]. It's used like the IMG tag and it should be put on an image.
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.
Web 2.0 progression of BBCode sees the not too common occurrence of new tags such as [youtube] [facebook] and [skype] tags.
[edit] External links
- BBCode.org
- BBCode guide at phpBB.com
- FUDcode, FUDforum's BBcode implementation.
- BBCode FireFox extension
- BBEditor - Light weight BBCode editor in JavaScript
- A .NET BBCode Parser Implementation
- Cool HTML to BBCode Converter online application
- YaBB code reference at YaBBForum.com
- Recruiting Parser a PHP-based BBCode to HTML parser with rich features and very easy implementation
[edit] Libraries
- KefirBB - The Java library
- javabbcode - The Java library, the part of JavaBB forum soft