This sample shows how to configure CKEditor to output BBCode format instead of HTML. Please note that the editor configuration was modified to reflect what is needed in a BBCode editing environment. Smiley images, for example, were stripped to the emoticons that are commonly used in some BBCode dialects.
Please note that currently there is no standard for the BBCode markup language, so its implementation for different platforms (message boards, blogs etc.) can vary. This means that before using CKEditor to output BBCode you may need to adjust the implementation to your own environment.
A snippet of the configuration code can be seen below; check the source of this page for a full definition:
CKEDITOR.inline( 'editor1', { extraPlugins : 'bbcode', (below configurations details omitted:) toolbar : ..., fontSize_sizes : ..., smiley_images : ..., smiley_descriptions : ... });
BBCode Output:
[img]http://a.cksource.com/f/1/img/logo-ckeditor.gif[/img]
"[b]Little Red Riding Hood[/b]" is a famous [url=http://en.wikipedia.org/wiki/Fairy_tale]fairy tale[/url] about a young girl's encounter with a wolf. The story has been changed considerably in its history and subject to numerous modern adaptations and readings.
[list]
[*]Chinese: [i]小紅帽[/i]
[*]Italian: [i]Cappuccetto Rosso[/i]
[*]Spanish: [i]Caperucita Roja[/i]
[/list]
[quote]It is about a girl called [color=#ff0000]Little Red Riding Hood :)[/color], after the red [url=http://en.wikipedia.org/wiki/Hood_%28headgear%29]hooded[/url] [url=http://en.wikipedia.org/wiki/Cape]cape[/url] or [url=http://en.wikipedia.org/wiki/Cloak]cloak[/url] she wears.
The girl walks through the woods to deliver food to her sick grandmother. A wolf wants to eat the girl but is afraid to do so in public. He approaches the girl, and she naïvely tells him where she is going.
He suggests the girl pick some flowers, which she does. In the meantime, he goes to the grandmother's house and gains entry by pretending to be the girl. He swallows the grandmother whole, and waits for the girl, disguised as the grandmother. When the girl arrives, she notices he looks very strange to be her grandma. In most retellings, this eventually culminates with Little Red Riding Hood saying, "My, what big teeth you have!"
To which the wolf replies, "The better to eat you with," and swallows her whole, too.[/quote]
The above version most widely known today is based on the [url=http://en.wikipedia.org/wiki/Brothers_Grimm]Brothers Grimm[/url] variant.