Jump to content

BBCode

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by AnomieBOT (talk | contribs) at 03:31, 11 April 2016 (Dating maintenance tags: {{Refimprove}}). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

BBCode
Operating systemCross-platform
Typemessage board
Websitehttp://php.net/manual/en/book.bbcode.php

BBCode or Bulletin Board Code 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.[1]

BBCode was introduced in 1998 by the messageboard software Ultimate Bulletin Board (UBB) implemented in Perl. In 2000 BBCode was used in phpBB - an internet forum system written in PHP.

Tags

<b>bolded text</b>
,
<strong>bolded text</strong>
or
<span style="font-weight: bold;">bolded text</span>
[b]bolded text[/b]
bolded text
<i>italicized text</i>
,
<em>italicized text</em>
or
<span style="font-style: italic;">italicized text</span>
[i]italicized text[/i]
italicized text
<u>underlined text</u>
,
<ins>underlined text</ins>
or
<span style="text-decoration: underline;">underlined text</span>
[u]underlined text[/u]
underlined text
<s>strikethrough text</s>
,
<del>strikethrough text</del>
or
<span style="text-decoration: line-through;">strikethrough text</span>
[s]strikethrough text[/s]
strikethrough text
<a href="http://example.org">http://example.org</a>
[url]http://example.org[/url]
http://example.org
<a href="http://example.com">Example</a>
[url=http://example.com]Example[/url]
Example
<img src="http://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/Go-home.svg/100px-Go-home.svg.png" alt="" />
[img]http://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/Go-home.svg/100px-Go-home.svg.png[/img]
<blockquote><p>quoted text</p></blockquote>

(usually implemented in more advanced ways)
[quote="author"]quoted text[/quote]

(including optional author)
To quote:

quoted text

<pre>monospaced text</pre>
[code]monospaced text[/code]
monospaced text
<span style="font-size:15px">Large Text</span>


or

<font size="(+,-)x">Different text-size</font> (you can set + or - and x is a number representing pixels
[style size="15px"]Large Text[/style]

(The unit of measurement varies with each BBCode variant and could represent pixels, points, or relative HTML sizes.)
Large Text
<span style="color:#FF0000;">Red Text</span>


or

<font color="red">Red Text</font>, <span style="color:#FF0000;">Red Text</span>


or

<span style="color:red;">Red Text</span>


or

<span style="color:red;">Red Text</span>
[style color="red"]Red Text[/style]

or
[style color=#FF0000]Red Text[/style]

or
[color=#FF0000]Red Text[/color]

(Both HTML color names and hexadecimal color values are generally supported, although on some boards, you must omit the # from selecting a hexadecimal color.)
<img src="Face-smile.svg" alt=":-)">
:)
[:-)]

this would be another way to use the [img]url_img[/img] and must be pre-configured for the forum administrator
(And other emoticons, depending on the variant. Most BBCodes do not enclose emoticons in square brackets, leading to frequent accidental usage)

:-)

(Specific image and size vary)

<ul><li>Entry 1</li><li>Entry 2</li></ul>
[list]
[*]Entry 1
[*]Entry 2
[/list]

Some message boards do not need the square brackets around the markers, e.g.:

[list]
*Entry 1
*Entry 2
[/list]

[2]

(many variants for li and /li, list types (unordered and ordered, with different bullets or counter formats), etc.)

  • Entry 1
  • Entry 2
<table><tr><td>table 1</td><td>table 2</td></tr><tr><td>table 3</td><td>table 4</td></tr></table>
[table]
  [tr]
  [td]table 1[/td]
  [td]table 2[/td]
  [/tr]
  [tr]
  [td]table 3[/td]
  [td]table 4[/td]
  [/tr]
[/table]

(some variants for thead, rules, etc.)

table 1 table 2
table 3 table 4

Implementation

BBCode is typically implemented by applying a series of regular expression string-replace operations upon the input. Because regular expressions are limited in analyzing the structure of text input, this has the artifact that any non-hierarchical BBCode input will be transformed into invalid non-hierarchical HTML without error.

Applying traditional parsing techniques is made difficult by ambiguities in the markup, such as in [quote=[b]text[/b][/quote], where the input can either be interpreted as "text" quoted from someone called "[b", or the bolded text "text" surrounded by "[quote=" and "Template:Unstyled inline syntax", i.e. "[quote=text[/quote]".

References

  1. ^ "Why modern forums are switching from HTML to BBCode". www.lovelyreality.com. Retrieved 24 May 2015.
  2. ^ BOINC Project Forums et al.