BBCode ("Bulletin Board Code") is a lightweight markup language used to format messages in many Internet forum software. It was first introduced in 1998. The available "tags" of BBCode are usually indicated by square brackets () surrounding a keyword, and are parsed before being translated into HTML.
Tags
Example in HTML/CSS | BBCode | Output | ||||
---|---|---|---|---|---|---|
<b>bolded text</b> ,<strong>bolded text</strong> or<span style="font-weight: bold;">bolded text</span>
|
bolded text
|
bolded text | ||||
<i>italicized text</i> ,<em>italicized text</em> or<span style="font-style: italic;">italicized text</span>
|
italicized text
|
italicized text | ||||
<ins>underlined text</ins> or<span style="text-decoration: underline;">underlined text</span>
|
underlined text
|
underlined text | ||||
<del>strikethrough text</del> or<span style="text-decoration: line-through;">strikethrough text</span>
|
strikethrough text
|
|||||
<a href="https://en.wikipedia.org">https://en.wikipedia.org</a> <a href="https://en.wikipedia.org">English Misplaced Pages</a>
|
https://en.wikipedia.org English Misplaced Pages
|
https://en.wikipedia.org English Misplaced Pages | ||||
<img src="https://upload.wikimedia.org/wikipedia/commons/7/70/Example.png" alt="This is just an example" />
|
https://upload.wikimedia.org/wikipedia/commons/7/70/Example.png
|
|||||
<img src="Smileys/Face-smile.svg" alt=":-)">
|
:) or
This would be another way to use the url_img and must be pre-configured by the forum administrator.(This 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.) | ||||
<blockquote><p>quoted text</p></blockquote> (Usually implemented in more advanced ways.) |
quoted text quoted text (including optional author )
|
Using a Misplaced Pages template:
| ||||
<pre>monospaced text</pre>
|
monospaced text
|
monospaced text
| ||||
<span style="font-size:30px">Large Text</span> or<span style="font-size:85%">Smaller Text</span>
|
Large Text Smaller Text (The unit of measurement varies with each BBCode variant and could represent pixels, points, or relative HTML sizes.) |
Large Text Smaller Text | ||||
<span style="color:fuchsia;">Text in fuchsia</span> or<span style="color:#FF00FF;">Text in fuchsia</span>
|
Text in fuchsia orText in fuchsia orText in fuchsia (Both HTML color names and hexadecimal color values are generally supported, although on some boards, you must omit the # from selecting a hexadecimal color.)
|
Text in fuchsia | ||||
<ul> <li>Entry A</li> <li>Entry B</li> </ul> <ol> <li>Entry 1</li> <li>Entry 2</li> </ol> |
Entry A Entry B Entry 1 Entry 2 Some message boards do not need the square brackets around the markers. (Many variants for |
| ||||
<table> <tr> <td>table cell 1</td> <td>table cell 2</td> </tr> <tr> <td>table cell 3</td> <td>table cell 4</td> </tr> </table> |
table cell 1 table cell 2 table cell 3 table cell 4 (Some variants for |
| ||||
Source: |
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 text
, where the input can either be interpreted as "text" quoted from someone called , i.e.
.
See also
References
- "HTML Text Formatting". W3Schools. Retrieved 2021-05-01.
- e.g. BOINC Project Forums et al.
- "BBCode tags reference". www.bbcode.org. Retrieved 12 January 2022.