BBCode

From XMBdocs
Revision as of 04:50, 2 July 2025 by Flushedpancake (talk | contribs) (Complete overhaul)

table.code {

   border: 1px solid #86a9b6;
   margin: 15px auto 10px auto;

}

td.code {

   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 {

   border: 1px solid #86a9b6;
   padding: 1px 4px;

}

.codemessage code {

   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;

}

.blink {

   animation: blinker 1.5s linear infinite;

}

@keyframes blinker {

   50% {
       opacity: 0;
   }

}

.marquee {

   max-width: 100%;
   overflow: hidden;

}

.marquee2 {

   display: flex;
   align-items: center;
   flex-grow: 0;
   flex-shrink: 0;
   margin: 0;
   padding: 0 2rem;
   list-style: none;
   transform: translateX(100%);
   animation: marqueeAnimation 20s linear infinite;

}

@keyframes marqueeAnimation {

   0% {
       transform: translateX(100%);
   }
   100% {
       transform: translateX(-100%);
   }

} </style>

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.


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:
fart

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

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

[/rquote]

Quote: Originally posted by flushedpancake
fart

[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.