BBCode: Difference between revisions

From XMBdocs
m I broke the table (I'll fix the formatting in a bit)
 
(4 intermediate revisions by 2 users not shown)
Line 14: Line 14:
{{highlight | '''These few words in this text should be bold''', while these should not}}
{{highlight | '''These few words in this text should be bold''', while these should not}}


A few basic rules for all bbcode:
A few basic rules for all BBCode:


*all BBCode must be closed, so having [a] means we also need to have [/a] which "closes" it. The only exception to this is when using [*]
*all BBCode must be closed, so having [a] means we also need to have [/a] which "closes" it. The only exception to this is when using [*]
Line 22: Line 22:
==Text Formatting==
==Text Formatting==
<table class="wikitable">
<table class="wikitable">
<tr>
<tr>
<th>Opening Tag</th><th>Closing Tag</th><th>Effect</th><th> Additional Information</th></tr>
<th>Opening Tag</th>
<tr>
<th>Closing Tag</th>
<td> [b]
<th>Effect</th>
</td><td> [/b]
<th>Additional Information</th>
</td><td style=""> <b>Makes the enclosed text bold.</b>
</tr>
</td><td style="">
</td></tr>
<tr>
<td style=""> [i]
</td><td> [/i]
</td><td> <i>Makes the enclosed text italic</i>
</td><td>
</td></tr>
<tr>
<td> [u]
</td><td> [/u]
</td><td> <u>Makes the enclosed text underlined.</u>
</td><td>
</td></tr>
<tr>
<td> [strike]
</td><td style="border: 1px solid #000000; text-align: center;"> [/strike]
</td><td style="border: 1px solid #000000; text-align: center;"> <strike>Strikes the enclosed text.</strike>
</td><td style="border: 1px solid #000000; text-align: center;">
</td></tr>
<tr>
<td style="border: 1px solid #000000; text-align: center;"> [blink]
</td><td style="border: 1px solid #000000; text-align: center;"> [/blink]
</td><td style="border: 1px solid #000000; text-align: center;"><span style="text-decoration: blink;">Makes the enclosed text blink.</span>
</td><td style="border: 1px solid #000000; text-align: center;">
</td></tr>
<tr>
<td style="border: 1px solid #000000; text-align: center;">[marquee]
</td><td style="border: 1px solid #000000; text-align: center;"> [/marquee]
</td><td style="border: 1px solid #000000; text-align: center;">Makes the enclosed text scroll right to left.
</td><td style="border: 1px solid #000000; text-align: center;">
</td></tr>
<tr>
<td style="border: 1px solid #000000; text-align: center;">[color=<b>X</b>]
</td><td style="border: 1px solid #000000; text-align: center;"> [/color]
</td><td style="border: 1px solid #000000; text-align: center;"> Changes the enclosed text color to <b>X</b>.
</td><td style="border: 1px solid #000000; text-align: center;">  <b>X</b> may be a hexadecimal RGB value (#000000 - #FFFFFF), rgb(0,0,0) - rgb(128,128,128), or any other standard CSS color value (Red, Green, etc).<hr />As of XMB 1.10, the W3C Extended Color Set is supported.
</td></tr>
<tr>
<td style="border: 1px solid #000000; text-align: center;"> [size=<b>X</b>]
</td><td style="border: 1px solid #000000; text-align: center;"> [/size]
</td><td style="border: 1px solid #000000; text-align: center;"> Changes the size of the enclosed text to <b>X</b>.
</td><td style="border: 1px solid #000000; text-align: center;"> <b>X</b> is an offset form base-font-size. For example: If the forum font was set to 10pt, [size=]text[/size] would show "text" in 15pt font size. Size range is from -10 to 99.
</td></tr>
<tr>
<td style="border: 1px solid #000000; text-align: center;"> [font=<b>X</b>]
</td><td style="border: 1px solid #000000; text-align: center;"> [/font]
</td><td style="border: 1px solid #000000; text-align: center;"> Changes the font of the enclosed text to <b>X</b>.
</td><td style="border: 1px solid #000000; text-align: center;"> <b>X</b> can be any font.<hr />Prior to XMB 1.9.12.09, fonts with a "-" symbol could not be used.</td></tr>
<tr>
<td style="border: 1px solid #000000; text-align: center;"> [align=<b>X</b>]
</td><td style="border: 1px solid #000000; text-align: center;"> [/align]
</td><td style="border: 1px solid #000000; text-align: center;"> Aligns the enclosed text to <b>X</b>.
</td><td style="border: 1px solid #000000; text-align: center;"> <b>X</b> can be any <b>one</b> of the following: left, center, right, or justify.
</td></tr></table>


<tr>
<td>
[b]
</td>
<td>
[/b]
</td>
<td>
<b>Makes the enclosed text bold.</b>
</td>
<td>
</td>
</tr>
<tr>
<td>
[i]
</td>
<td>
[/i]
</td>
<td>
<i>Makes the enclosed text italic</i>
</td>
<td>
</td>
</tr>
<tr>
<td>
[u]
</td>
<td>
[/u]
</td>
<td>
<u>Makes the enclosed text underlined.</u>
</td>
<td>
</td>
</tr>
<tr>
<td>
[strike]
</td>
<td>
[/strike]
</td>
<td>
<strike>Strikes the enclosed text.</strike>
</td>
<td>
</td>
</tr>
<tr>
<td>
[blink]
</td>
<td>
[/blink]
</td>
<td>
<span class="blink">Makes the enclosed text blink.</span>
</td>
<td>
This tag may not work on modern browsers in versions below XMB 1.10.x.<hr />
The re-implementation of this tag may not reflect exactly the original behaviour.
</td>
</tr>
<tr>
<td>
[marquee]
</td>
<td>
[/marquee]
</td>
<td>
<div class="marquee"><div class="marquee2">Makes the enclosed text scroll -right to left.</div></div>
</td>
<td>
This tag may not work on modern browsers in versions below XMB 1.10.x.<hr />
The re-implementation of this tag may not reflect exactly the original behaviour.
</td>
</tr>
<tr>
<td>
[color=<b>X</b>]
</td>
<td>
[/color]
</td>
<td>
Changes the enclosed text color to <b>X</b>.
</td>
<td>
<b>X</b> may be a hexadecimal RGB value (#000000 - #FFFFFF), rgb(0,0,0) - rgb(128,128,128), or any other standard CSS color value (Red, Green, etc).<hr />
As of XMB 1.10, the W3C Extended Color Set is supported.
</td>
</tr>
<tr>
<td>
[size=<b>X</b>]
</td>
<td>
[/size]
</td>
<td>
Changes the size of the enclosed text to <b>X</b>.
</td>
<td>
<b>X</b> is an offset form base-font-size. For example: If the forum font is set to 10pt, [size=]text[/size] will show "text" in 15pt font size. Size range can be set from -10 to 99.
</td>
</tr>
<tr>
<td>
[font=<b>X</b>]
</td>
<td>
[/font]
</td>
<td>
Changes the font of the enclosed text to <b>X</b>.
</td>
<td>
<b>X</b> can be any font, including generic fallbacks.<hr />
Prior to XMB 1.9.12.09, fonts with a "-" symbol could not be used.
</td>
</tr>
<tr>
<td>
[align=<b>X</b>]
</td>
<td>
[/align]
</td>
<td>
Aligns the enclosed text to <b>X</b>.
</td>
<td>
<b>X</b> can be any <b>one</b> of the following: left, center, right, or justify.
</td>
</tr>
</table>


<!-- I'm sorry for this one's formatting, I really am -->
==Text Structure==
==Text Structure==
<table class="wikitable">
<table class="wikitable">
<tr>
<tr>
<th style="width: 10%;">Opening Tag</th><th style="width: 10%;">Closing Tag</th><th style="width: 40%;">Effect</th><th style="width: 40%;">Additional Information
<th>Opening Tag</th>
</th></tr>
<th>Closing Tag</th>
<tr>
<th>Effect</th>
<td> &#x5b;quote&#x5d; </td><td> &#x5b;/quote&#x5d; </td><td> <table style="border: 1px solid #FFFFFF; margin: 15px auto 10px auto; width: 80%;"><tr><td style="background-color: #737373; border-bottom: 1px solid #FFFFFF; color: #FFFFFF; font-family: Verdana, Arial, Helvetica; font-size: 10px; font-weight: bold; height: 20px; padding-left: 5px;">Quote:</td></tr><tr><td style="background-color: #EFEFEF; color: #2E3E55; font-family: Verdana, Arial, Helvetica; font-size: 10px; padding: 10px 0 20px 5px;">Quotes this text</td></tr></table></td><td> When a quote is generated by XMB, the first line usually contains the author of the quoted post: [i]Originally posted by EXAMPLE:[/i]
<th>Additional Information</th>
</td></tr>
</tr>
<tr>
<tr>
<td>&#x5b;code&#x5d;</td><td> &#x5b;/code&#x5d; </td><td> <table style="border: 1px solid #FFFFFF; margin: 15px auto 10px auto; width: 80%; white-space: pre;"><tr><td style="background-color: #737373; border-bottom: 1px solid #FFFFFF; color: #FFFFFF; font-family: Verdana, Arial, Helvetica; font-size: 10px; font-weight: bold; height: 20px; padding-left: 5px;">Code:</td></tr><tr><td style="background-color: #EFEFEF; color: #2E3E55; font-family: Courier New; font-size: 10px; padding: 10px 5px 10px 5px; white-space: pre;">while(true) {
<td>
printf("Hello World!");
&#x5b;quote&#x5d;
}</td></tr></table> </td><td> Text enclosed in &#x5b;code&#x5d;&#x5b;/code&#x5d; BBCode will preserve whitespace and will be shown in monotype font (so all characters have the same width and height). Smilies and other BBCode will not be parsed inside &#x5b;code&#x5d;&#x5b;/code&#x5d; tags.
</td>
</td></tr></table>
<td>
&#x5b;/quote&#x5d;
</td>
<td>
<table align="center" class="quote" cellspacing="0" cellpadding="0" style="border:1px solid #86a9b6;margin: 15px 5% 10px 5%;width: 80%;"><tr><td class="quote" style="background-color: #d3dfe4;border-bottom: 1px solid #86a9b6;color: #24404b;font-family: Tahoma, Arial, Helvetica, Verdana;font-size: 11px;font-weight: bold;height: 20px;padding-left: 5px;">Quote:</td></tr><tr><td class="quotemessage" style="background-color: #f4f7f8;color: #000000;font-family: Tahoma, Arial, Helvetica, Verdana;font-size: 11px;padding: 10px 0 20px 5px;">text </td></tr></table>
</td>
<td>
</td>
</tr>
<tr>


<td>
&#x5b;rquote=<b>X</b>&ZeroWidthSpace;&amp;tid=<b>Y</b>&ZeroWidthSpace;&amp;author=<b>Z</b>&#x5d;
</td>
<td>
&#x5b;/rquote&#x5d;
</td>
<td>
<table align="center" class="quote" cellspacing="0" cellpadding="0" style="border:1px solid #86a9b6;margin: 15px 5% 10px 5%;width: 80%;"><tr><td class="quote" style="background-color: #d3dfe4;border-bottom: 1px solid #86a9b6;color: #24404b;font-family: Tahoma, Arial, Helvetica, Verdana;font-size: 11px;font-weight: bold;height: 20px;padding-left: 5px;">Quote: [https://forums.xmbforum2.com/viewthread.php?tid=777162&goto=search&pid=1376512 Originally posted by flushedpancake]</td></tr><tr><td class="quotemessage" style="background-color: #f4f7f8;color: #000000;font-family: Tahoma, Arial, Helvetica, Verdana;font-size: 11px;padding: 10px 0 20px 5px;">text </td></tr></table>
</td>
<td>
When a quote is generated by XMB, the first line usually contains the author of the quoted post: [i]Originally posted by EXAMPLE:[/i]
</td>
</tr>
<tr>
<td>
&#x5b;code&#x5d;
</td>
<td>
&#x5b;/code&#x5d;
</td>
<td>
<table align="center" class="code" cellspacing="0" cellpadding="0" style="border: 1px solid #86a9b6;margin: 15px auto 10px auto;"><tr><td class="code" style="background-color: #d3dfe4;border-bottom: 1px solid #86a9b6;color: #24404b;font-family: Tahoma, Arial, Helvetica, Verdana;font-size: 11px;font-weight: bold;height: 20px;padding-left: 5px;">Code:</td></tr><tr><td class="codemessage" style="background-color: #f4f7f8;color: #000000;font-size: 11px;padding: 10px 5px 10px 5px;white-space: pre;display: block;width: 600px;max-height: 400px;overflow: auto;border: none;"><span style="font-family:monospace;">while(true)
printf("Hello World!");</span></td></tr></table>
</td>
<td>
Text enclosed in <code>&#x5b;code&#x5d;&#x5b;/code&#x5d;</code> BBCode will preserve whitespace and will be shown in monotype font (so all characters have the same width and height). Smilies and other BBCode will not be parsed inside <code>&#x5b;code&#x5d;&#x5b;/code&#x5d;</code> tags.
</td>
</tr>
</table>


==Block Elements==
==Block Elements==
<table class="wikitable">
<table class="wikitable">
<tr>
<tr>
<th style="width: 10%;">Opening Tag</th><th style="width: 10%;">Closing Tag</th><th style="width: 40%;">Effect</th><th style="width: 40%;">Additional Information
<th>Opening Tag</th>
</th></tr>
<th>Closing Tag</th>
<th>Effect</th>
<th>Additional Information</th>
</tr>


<tr>
<tr>
<td> &#x5b;img&#x5d; </td><td> &#x5b;/img&#x5d; </td><td>[content is replaced with the image]</td><td>
<td>
</td></tr>
&#x5b;img&#x5d;
<tr>
</td>
<td> &#x5b;img=AxB&#x5d; </td><td> &#x5b;/img&#x5d; </td><td>[content is replaced with the image, resized to AxB px]</td><td>
<td>
&#x5b;/img&#x5d;</td>
<td>
[content is replaced with the image]
</td>
<td>


</td></tr>
</td>
<tr>
</tr>
<td> &#x5b;url&#x5d; </td><td> &#x5b;/url&#x5d; </td><td>link to the URL provided.</td><td>
<tr>
<td>
&#x5b;img=AxB&#x5d;
</td>
<td>
&#x5b;/img&#x5d;
</td>
<td>
[content is replaced with the image, resized to AxB px]
</td>
<td>
As of XMB 1.9.12.09, no support for percentage-based resizing exists.
</td>
</tr>
<tr>
<td>
&#x5b;url&#x5d;</td>
<td>
&#x5b;/url&#x5d;
</td>
<td>
Standard URL
</td>
<td>
</td>
</tr>
<tr>
<td>
&#x5b;url=<b>X</b>&#x5d;
</td>
<td>
&#x5b;url&#x5d;
<td>
[http://forums.xmbforum2.com Labelled URL]
</td>
<td>


</td></tr>
</td>
<tr>
</tr>
<td> &#x5b;url=?&#x5d; </td><td> &#x5b;/url&#x5d; </td><td> the text provided, linking to <b>?</b> </td><td>
<tr>
</td></tr>
<td>
<tr>
&#x5b;email&#x5d;
<td> &#x5b;email&#x5d; </td><td> &#x5b;/email&#x5d; </td><td> link to the email provided.</td><td>
</td>
<td>
&#x5b;/email&#x5d;
</td>
<td>
[mailto:postmaster@qaop.gb mailto email link]
</td>
<td>


</td></tr>
</td>
<tr>
</tr>
<td> &#x5b;email=?&#x5d; </td><td> &#x5b;/email&#x5d; </td><td> the text provided, linking to email <b>email</b>.</td></tr>
<tr>
<tr>
<td>
<td style="border: 1px solid #000000; text-align: center;">[youtube]
&#x5b;email=<b>X</b>&#x5d;
</td><td style="border: 1px solid #000000; text-align: center;"> [/youtube]
</td>
</td><td style="border: 1px solid #000000; text-align: center;"> Embeds a YouTube link. Added in XMB 1.9.12.
<td>
</td><td style="border: 1px solid #000000; text-align: center;">The tag supports raw video IDs, youtu.be, youtube.com and m.youtube.com URLs.
&#x5b;/email&#x5d;
</td></tr>
</td>
<tr>
<td>
<td>[list] Text Here</td><td> [/list] </td><td>This will create a list from the text, in bullet points.</td><td>list can also take one of the following arguments:<br><b>List Items</b>[list=1]<br>[list=a]<br>[list=A]<br><br>[*] Text - When [*] is placed in a list, it will provide a bullet in front of the text.</td></tr>
[mailto:postmaster@qaop.gb Labelled email mailto link]
<tr>
<td>
<td>[poem]Text Here</td><td>[/poem]</td><td>This will show the text in poem style. Meaning, italicized and centered.</td><td></td></tr></table>
 
</td>
</tr>
<tr>
<td>
&#x5b;youtube?&#x5d;
</td>
<td>
&#x5b;/youtube?&#x5d;
</td>
<td>
[YouTube embed]
</td>
<td>
Since 1.9.12.07, the tag supports raw video IDs, youtu.be, youtube.com and m.youtube.com URLs.
</td>
</tr>
<tr>
<td>
[list] Text Here
</td>
<td>  
[/list]
</td>
<td>
This will create a list from the text, in bullet points.
</td>
<td>
list can also take one of the following arguments:<br><b>List Items</b>[list=1]<br>[list=a]<br>[list=A]<br><br>[*] Text - When [*] is placed in a list, it will provide a bullet in front of the text.
</td>
</tr>
</table>

Latest revision as of 11:26, 2 July 2025

BBCode is an abbreviation for Bulletin Board Code. BBCode is essentially a series of tags that can be used to style or format text in posts. Examples of BBCode's uses are centered text, lists, varying font sizes and colors in posts.

The Basics

To use BBCode you first need to know what the effect is you're trying to reach. For example, we want, in the following text:

These few words in this text should be bold, while these should not

to have bold words. Looking at the table below, we can see that the bbcode to make text bold is

[b]bold text[/b]

Thus, having the following text:

[b]These few words in this text should be bold[/b], while these should not

will make the text look like this:

These few words in this text should be bold, while these should not

A few basic rules for all BBCode:

  • all BBCode must be closed, so having [a] means we also need to have [/a] which "closes" it. The only exception to this is when using [*]
  • although some bbcode can be used in a case-insensitive way (ie. you can use both [img][/img] and [IMG][/IMG], this is not guaranteed to work in all cases. To be on the safe side, try using it in lower-case if you can (ie. [b][/b] instead of [B][B]) to minimize processing time required to transform these to HTML.


Text Formatting

Opening Tag Closing Tag Effect Additional Information

[b]

[/b]

Makes the enclosed text bold.

[i]

[/i]

Makes the enclosed text italic

[u]

[/u]

Makes the enclosed text underlined.

[strike]

[/strike]

Strikes the enclosed text.

[blink]

[/blink]

Makes the enclosed text blink.

This tag may not work on modern browsers in versions below XMB 1.10.x.

The re-implementation of this tag may not reflect exactly the original behaviour.

[marquee]

[/marquee]

Makes the enclosed text scroll -right to left.
This tag may not work on modern browsers in versions below XMB 1.10.x.

The re-implementation of this tag may not reflect exactly the original behaviour.

[color=X]

[/color]

Changes the enclosed text color to X.

X may be a hexadecimal RGB value (#000000 - #FFFFFF), rgb(0,0,0) - rgb(128,128,128), or any other standard CSS color value (Red, Green, etc).

As of XMB 1.10, the W3C Extended Color Set is supported.

[size=X]

[/size]

Changes the size of the enclosed text to X.

X is an offset form base-font-size. For example: If the forum font is set to 10pt, [size=]text[/size] will show "text" in 15pt font size. Size range can be set from -10 to 99.

[font=X]

[/font]

Changes the font of the enclosed text to X.

X can be any font, including generic fallbacks.

Prior to XMB 1.9.12.09, fonts with a "-" symbol could not be used.

[align=X]

[/align]

Aligns the enclosed text to X.

X can be any one of the following: left, center, right, or justify.

Text Structure

Opening Tag Closing Tag Effect Additional Information

[quote]

[/quote]

Quote:
text

[rquote=X​&tid=Y​&author=Z]

[/rquote]

Quote: Originally posted by flushedpancake
text

When a quote is generated by XMB, the first line usually contains the author of the quoted post: [i]Originally posted by EXAMPLE:[/i]

[code]

[/code]

Code:
while(true) printf("Hello World!");

Text enclosed in [code][/code] BBCode will preserve whitespace and will be shown in monotype font (so all characters have the same width and height). Smilies and other BBCode will not be parsed inside [code][/code] tags.

Block Elements

Opening Tag Closing Tag Effect Additional Information

[img]

[/img]

[content is replaced with the image]

[img=AxB]

[/img]

[content is replaced with the image, resized to AxB px]

As of XMB 1.9.12.09, no support for percentage-based resizing exists.

[url]

[/url]

Standard URL

[url=X]

[url]

Labelled URL

[email]

[/email]

mailto email link

[email=X]

[/email]

Labelled email mailto link

[youtube?]

[/youtube?]

[YouTube embed]

Since 1.9.12.07, the tag supports raw video IDs, youtu.be, youtube.com and m.youtube.com URLs.

[list] Text Here

[/list]

This will create a list from the text, in bullet points.

list can also take one of the following arguments:
List Items[list=1]
[list=a]
[list=A]

[*] Text - When [*] is placed in a list, it will provide a bullet in front of the text.