Simple text formatting
Simplest tags are:- [b]the text[/b] - format to bold: the text
- [i]the text[/i] - format to italic: the text
- [u]the text[/u] - format to underline: the text
ⓘ Example usage:
will be rendered as bold, underline and italic[b][u][i]bold, underline and italic[/][/][/]
Paragraph
Also [p] tag is useful for marking one HTML paragraph:ⓘ Example usage:
[p]This is just one paragraph of text.[/]
Headers
Usage:- [h1]The top header[/] - Header of level #1 - top level header, good for main caption of main section
- [h2]Level #2 header[/] - Header of level #2 - good for caption of subsection
- [h3]Level #3 header[/] - Header of level #3 - good for caption of sub-subsection
- ... up to six levels of headers - so [h6][/] is the "deepest" sub-sub-sub-...-section header
Lists
Lists are different than you can expect from a point of view of original BB-Code. They don't follow the XML-like open-close schema.This is a proper list:
ⓘ Example usage:
[li]item 1 [li]item 2 [li]item 3 [/ul]
Which will render like this:
- item 1
- item 2
- item 3
Notice:
- don't need to use [ul] for opening a list - it's just auto-opened if you simply start first point of a list by [li]
- don't need to close every list point - just open next one by using next [li] or just close whole list by [/ul]
List of lists
The same simplified logic works for list-of-lists, so putting an list inside of an existing list item...Just use [ul] opening tag, to enter the "deeper level", and use [/ul] for going out of a level.
For example this BB Code:
ⓘ Example usage:
[li]item 1 [ul][li]item 1.1 [li]item 1.2 [/ul] [li]item 2 [/ul]
Will be render as:
- item 1
- item 1.1
- item 1.2
- item 1.1
- item 2
Ignore part of BB text (aka comment-out)
For any reason, you may want to disable some part of text from viewing. (e.g. for finishing the sentence in the future or put a comment visible only to authors).This is easy as:
ⓘ Example usage:
will render as:The piece of text [0]which will be invisible or[1] visible.
The piece of text visible.
So simply put [0] to disable output. And from that position, all following text (even BB tags) will be ignored until [1] is found.
Link
Link example:ⓘ Example usage:
will look like this:[link url="http://ke.mu"]KEMU[/]
KEMU
Just put your link target to "url" parameter, and between [link][/link] tags you put BB-Code which you want to look like a link.
If you put nothing between [link][/link] tags, then the url will be put automatically as a text of a link. Example:
[link url="http://ke.mu"][/]
will look this:
http://ke.mu
Obviously other tags may be used inside of the link:
ⓘ Example usage:
is rendered as:[link url="http://ke.mu"][b]KE[/][i]MU[/][/]
KEMU
Open in new window
To open a link in new window just add a "open" parameter. Like this:ⓘ Example usage:
will look like:[link open url="http://ke.mu"]KEMU[/]
KEMU
which is equivalent of putting target="_blank" in a html anchor tag.
Link relative to main url
For "relative" linking inside of given website use tag linkin:ⓘ Example usage:
will look like this:[linkin url="document/bb_code"]KEMU[[/]
KEMU
It's not just shortcut, it's the only option to link relativelly to main url.
Let's explain by example:
assume you're on page http://mysite.com and you want to put link to http://mysite.com/the_subpage in your text. It looks like putting code [link url="the_subpage"][/] will work, as the_subpage will just be added to the current url.
But if you're already on another sub page - it will not work !
For example if you're on http://mysite.com/about, using [link url="the_subpage"][/] will emit link to http://mysite.com/about/the_subpage - which is not what you expected.
It's also useful to use the tag [linkin] for generating different links on your development vs production server.
Target
To make a simple "hash target" known from links, just do:[target id=the_target_in_text]
it will generate html: <a name="the_target_in_text">
So you can now jump to it with link: http://mylink.com#the_target_in_text