Using BBCode
Probably one of the best methods for short peices of.
Table of Contents
Why BBCode?
I have recently (
) been using BBCode, just because it interested me. BBCode is quite unlike most forms of minimalist markup that I have come across, and partway through testing it out, I had a bit of an epiphany about minimal markup.I thought perhaps that others might benefit from this thought process and I have done my best to document this here.
Note that I also plan to move much of this document to a generic page about markdown. Currently, I am too lazy. Sorry.
Nomenclature
BBCode, standing for Bulletin Board Code is a descriptive, tagged, minimal, markup language syntactically similar to HTML.
To be honest, if you know what all those terms, then you probably already know what BBCode is. Let's try that again.
Bulletin Board System
To simplify: A pre-web social-media-like method of communication. It works similarly to a forum, hence bulletin board. Despite the advent of the web, these are still active and have experienced a recent resurgence. I tried to set one up myself and it worked well apart from the fact that I never put it online. My favourite is Tinfoil Hat BBS.
I don't believe that BBCode was common for BBSs (if used at all), as BBCode is a little bit too young. Who knows; I need to check.
Markup
A markup language is a way of indicating the visual representation of text within the text itself. The term comes from when authors or editors 'marked up' written text with information for printing like font and colour.
Descriptive
The markup system describes what part of the text is, but not directly what operations a program should perform (though it may be obvious), this in contrast to say, PostScript, (the language that taught me stack programming). PostScript is a page description (or display) language, but behaves like a programming language. The markup is visible and directly editable by the user with the intent of exporting it.
Tagged
The type of markup used works like 'labelled brackets': The user may nest tags inside one another but not interweave them. The tags have a standard syntax, making them easy to identify and parse. An HTML example explains this better:
<p>This is HTML with some <i>italicised</i> text</p>
Minimal/Lightweight
The markup places emphasis on readability and write-ability in it's source form, as opposed to it's exported or rendered result. Effectively, the text is human-oriented rather than computer-oriented. Generally, these languages have little metadata.
It is rare for a minimal markup language to use tags in their syntax (or, at least, HTML-like tags), instead preferring the user to learn unobtrusive ASCII-character indicators like asterix for bold-ing. For example:
This is Org-mode markup with some /italicised/ text
BBCode bucks the trend by having tags similar to HTML, but requiring no tags around standard text, thus greatly reducing the amount of tags required.
This is BBCode markup with some [i]italicised[/i] text
Uses
Forums are a common place to find BBCode. Many forums on the early web used HTML to allow users to format their posts. However, HTML is a complete website language, and could allow someone to run malicious code in something as simple as a forum comment by using the <script>
tag. This was the method used by Samy Kamkar to spread a worm across MySpace, which didn't correctly restrict the use of HTML. XSS (abbreviating 'Cross Site Scripting') is the name of this type of attack.
BBCode is one answer to this type of problem. It has a simplified HTML syntax containing the most commonly used elements in forum posts, such as basic text styling, images and links.
I have also heard of some people who like to use BBCode to write blog posts, a use-case that seems a perfect fit for such a language.
My Uses
I plan on hopefully finding a use for BBCode by using it to write shorter essays, long-ish pieces of writing, and typed out exam questions that may not require advanced use of tables, mathematics symbols, and special features like citations.
The reason for this is that for a document of which the primary consumption is visual, something like a title becomes just 'big text at start'. I don't need all the navigational functions that Org-mode offers for moving around headlines, because headlines aren't really used in the same way. Hopefully, this could reduce the reliance on Emacs and Org-mode features for, while I could indeed write an org file in Windows' Notepad, and although that would be far more enjoyable than writing a DocBook file in Notepad, I would never do either willingly. I feel BBCode would not be so bad.
BBCode Syntax
There are unfortunately a couple of implementations of BBCode in the wild. Some minor aspects of their syntax may be different. I have stolen this from the BBCode website, which I assume to be the 'most correct' source.
Note: I have not included all the short-hands and nuances in some of the tags.
Name | Syntax |
---|---|
Bold | [b]{text}[/b] |
Italic | [i]{text}[/i] |
Underlined | [u]{text}[/u] |
[s]{text}[/s] | |
Text Size | [size={number}]{text}[/size] |
or | [style size={number}]{text}[/style] |
Text Colour | [color={color}]{text}[/color] |
or | [style color={color hex}]{text}[/style] |
Center-ed Text | [center]{text}[/center] |
Left-Aligned | [left]{text}[/left] |
Right-Aligned | [right]{text}[/right] |
Quote | [quote]{text}[/quote] |
Link | [url]{url}[/url] |
Named | [url={url}]{text}[/url] |
Image | [img]{url}[/img] |
Un-ordered List | [ul]{items}[/ul] |
Ordered List | [ol]{items}[/ol] |
-List Item | [li]{text}[/li] |
Code/Pre-formatted | [code]{text}[/code] |
Table | [table]{rows}[/table] |
-Table Row | [tr]{cells}[/tr] |
–Table Header | [th]{content}[/th] |
–Table Cell | [td]{content}[/td] |
Embedded YouTube Video | [youtube]{id}[/youtube] |
Rivals
I have personally noticed that places that I feel should use BBCode, such as Stack Exchange and its relatives, are instead using Markdown for their formatting.
I am not a fan of Markdown. While it does have a simple syntax, it is not self explanatory like BBCode is. Markdown also suffers from a large amount of fragmentation, with countless variants and add-ons available. This may confuse a user-base primarily acquainted with a different form of Markdown. Note that there are a couple of different implementations of BBCode, but there appears to be a generally agreed 'standard'.
They also often allow the author to write in a cut-down HTML subset. I feel that this results in ambiguity in what a poster can and cannot use in his message, leading to possible confusion. If your users are already using HTML for their posts, then transitioning to BBCode would not be difficult. You then save yourself from restricting the use of certain HTML elements in certain areas. Instead you can just block all HTML elements, and then run the result through a BBCode parser.
Document Markups
I would feel uneasy comparing BBCode to Org-mode or AsciiDoc, as their use cases are different. Org-mode and AsciiDoc are both meant to make writing large complex documents easy and more fun than writing in heavy markups, while retaining the power offered by heavier markups and perhaps adding tools for specific end-users.
AsciiDoc is also primarily aimed at producing DocBook files. For this reason it has a rich feature-set for this task, having one-to-one compatibility with DocBook (a famously tag-heavy XML language) syntax (every element is accounted for, also known 'semantically equivalent'). The reason that AsciiDoc exists is that the author felt he was spending far too much time writing tags and not content.
Org-mode markup has hundreds of features, like support for code blocks, nested headlines, to-do lists, etc. The power of Org-mode comes not just from it's syntax, but from its integration with Emacs. This allows editing to be fast and enjoyable (if you like Emacs). Org-mode has specialist features more suited to certain uses. For example, Org-mode has tools to auto-generate a sitemap for a web-site, something that I use for this site.
BBCode on the other hand, is not really designed to make documents, but to add basic tag-oriented formatting to text for things like blog posts and forum questions and comments, without risking exploitation of using a markup that allows scripting. There is no implicit document structure, it just outputs some HTML.
Pros
BBCode is…
Easy
BBCode's lack of <p>
tags makes it easy to write. Theoretically, you could write a .bbcode file without typing a single tag. This gives BBCode a nice uncluttered look, one that makes it far easier to spot tagging mistakes compared to HTML.
Tags are a great type of markup for newcomers who are trying to read a source file. Tags are often self-explanatory and give hints about what they do. I feel that few people would ask what a <code>
tag indicates. Furthermore, everyone uses brackets and some may nest them already; the tagging style of [start][/end]
seems familiar
Compare all this to a .docx document. When viewed, MS Word hides the markup from the viewer to improve readability, at the cost of compatibility (you may only use a compatible word processor). The markup is complex and still appears in the file, it is just hidden. This is often referred to as 'what you see is what you get' (WYSIWYG) editing. Open a .docx file in a text editor and imagine trying to edit it by hand.
Fast
This is more of a lightweight markup feature, but is especially apparent in BBCode.
Learning the BBCode syntax in it's entirety takes perhaps 5 minutes; less if you have even a basic understanding of HTML. This makes it fast for newcomers to understand. BBCode doesn't really require a 'cheat sheet' on hand to help out.
Lightweight markups differ from other markups in that they require little 'pre-writing'. For example, when one starts using LaTeX, there are several elements that the author needs to define before starting to produce the content of the document. In contrast, R Markdown exports to LaTeX well (they are both used for scientific papers), but requires no definitions.
Similarly, BBCode has no metadata, it being such a simple language. It is only designed for relatively short pieces, and as such does not need to handle document features like page size.
Writing tags for every single element gets annoying and feels slow. I greatly dislike writing raw HTML, one main reason being that I don't like that I feel like I spend too much time writing <p></p>
.
Small Files
This is but a non-issue with nowadays' cheap storage, but the lack of inherent document structure and small amount of tagging and metadata means that BBCode (and other minimal markups) have smaller- files. This combined with text editors usually being much smaller programs results in larger writing like books being easier to move around and be editable on a larger range of devices.
Compatibility
"However", you may say, "my word processor means that I can produce a nice looking document and I have never typed a tag in my life!". True, that may be, but BBCode works in your favourite editor. Docx is WYSIWYG and relies on the behaviour of the word processor to edit and view correctly. I cannot afford a Microsoft Office license and besides, MS doesn't offer it for Linux. LibreOffice tries its best to support .docx, but it cannot guarantee compatibility, meaning seemingly fine documents might break at will.
Many of my schoolmates have incidents of writing a document at home that then will un-fix-ably display improperly upon trying to edit it in a slightly different version of Word. Note that this is because WYSIWYG dictates that the document be edited in the same manner that the viewer will see it; there is no way to dip into the source and tweak some things around.
Fundamentally, BBCode is just plain text. Perhaps in 10 years time, BBCode will be dead (though I hope not), and there will be no way to view the final document. However, if plain text editors are still around, I can open a .bbcode file without issue, view it, and edit it. Can the same be said for a 10 year-old Word document?
Aesthetically Pleasing
This is just my opinion, but BBCode blends together a good mix of tags (I like tags in theorem, just not a fusillade of angle-bracket tags) and plain old text. It is nice to look at, and feels a lot friendlier (apart from tables, read on).
Cons
Tables
This is a minor complaint and one that shared with most lightweight markups.
In my opinion, the one place that word processors shine is in their tables. Tables are column-based visual elements, whereas text is primarily line-based. Editing a table without such a visual reference can be difficult. No doubt it is not that difficult to get used to, I just need to put in the time. At least BBCode uses roughly the same syntax as what may well be the most common way that tables are stored for human consumption: HTML. See here a BBCode table.
[table] [tr][th]Text[/th][th]Number[/th][/tr] [tr][td]This[/td][td]1[/td][/tr] [tr][td]Is[/td][td]2[/td][/tr] [tr][td]A[/td][td]3[/td][/tr] [tr][td]Table[/td][td]4[/td][/tr] [/table]
In this category, Org-mode markup is by far the winner. It does rely on Emacs' ability to move text around automatically, but Org-mode justifies the table for you (columns are much easier to follow) and has some built in spreadsheet-like tools. It uses vertical bars for separators, which do their job well without much typing.
| Text | Number | |-------+--------| | This | 1 | | Is | 2 | | A | 3 | | Table | 4 |
Support
BBCode, despite being relatively prevalent for a minimal markup, does not have a dedicated exporter or parser program and has little widespread editor support. Some sites use a dedicated PHP (ugh) forum back-end that translates it into HTML for final viewing (along with other features for creating a full website).
The biggest downside for me is that Pandoc, a universal document converter that supports many lightweight and heavyweight markups has no support for BBCode. This is a shame because the simple nature of BBCode makes it a prime candidate for a converter. Having just checked the pandoc-discuss Google group, I see that there is a feature request for one, but from 2016.
That said, this is not really a problem unless you really need to convert BBCode often and offline. Otherwise, you may use one of the many online converters, or use a server back-end. Plus, it is readable to the point where you could probably just give them the source file in a pinch, and they would most likely understand what you mean.
Is BBCode For You?
Maybe. BBCode might be for you if you are thinking about looking at some minimal markup for the occasional document like an exam question or short essay. If you want to write a blog then I think that BBCode sounds like a good option for reducing the amount of HTML to write. If you already write HTML, then definitely give it a go.
If you are thinking that you might want to start using markup for much larger documents, notes, and research, then I would implore you to look at Org-mode, or if Emacs is not your thing, AsciiDoc, R Markdown, Pandoc Markdown and Restructured Text (ReST) are all options. Do some research and think about the features that you might need (e.g. citations, bibliographies, export formats, etc).
However, BBCode would make a good 'stepping stone' into using minimal markup for all your documents, as it takes no time to learn and is easy to understand. Ergo, this is a good beginner language, especially if you have some HTML under your belt.
To conclude, BBCode is not necessarily trying to replace your existing setup, nor support every feature under the sun. It simply is not powerful enough. However, this may be the biggest advantage to BBCode, as it makes it a safe language for user input on web sites and is easy to learn and use.
Summary
To summarise,
BBCode won't (or rather shouldn't)
- Write your dissertation/thesis/large project requiring special formatting.
- Replace Word (though you should replace it, just not with this).
- Replace (R/Pandoc) Markdown/AsciiDoc/Org-mode/ReST.
- Make a fully-fledged website.
- Take an age to learn/get good at.
- Look impressive on a personal statement/CV.
- Give you a headache.
- Make you reach for an 80 page cheat-sheet every 10 seconds.
BBCode will
- Add some style to your writing.
- Make a good blog post.
- Make a short essay.
- Work on slow computers.
- Be workable in any text editor.
BBCode is
- Worth learning.
Sources
- BBCode Website - http:www.bbcode.org
- Wikipedia: Lightweight Markup - http:en.wikipedia.org/wiki/List_of_lightweight_markup_languages
- Wikipedia: BBCode - http:en.wikipedia.org/wiki/BBCode
- Wikipedia: XSS Worm - http:en.wikipedia.org/wiki/XSS_Worm
Disagree?
I would love to hear your opinion, even if it is just screaming at me for doing minimal research and repeating myself a lot. You can get to me here.
Example
[size="10px"]BBCode Example[/size] [color="blue"]BBCode[/color] has support for tables, similar to [u]HTML[/u]. [table] [tr] [th]This[/th] [th]Is A[/th] [th]Table[/th] [/tr] [tr] [td]With[/td] [td]Some[/td] [td]Rows[/td] [/tr] [/table] One significant departure from HTML (at least for [b]me[/b]) is that it has no need for [code]<p>[/code] tags. I don't like [code]<p>[/code] tags. [img]../img/radar_oven.jpg[/img] [quote="The Great Radar Oven"]BBCode is certainly a good markup.[/quote] Other differences include: [ul] [li]Fewer tags.[/li] [li]No external files.[/li] [li]Nicer square brackets.[/li] [/ul] Read more at [url]https://bbcode.org/[/url].