HTML, BBCode, or Plain Text?

Utterly PointlessUnequivocally DaftThoroughly AverageModerately ImpressiveBeyond Brilliant Rate this article

Most every web developer has asked himself (or herself) this question at least once. While some applications only need one method of parsing, many should support at least two. There is rarely a need to include support for more than two methods on any single part of an application though.

In this article, several parsing techniques will be covered, including Textile, BBCode, and HTML. WYSIWYG editors will also be discussed. Pros and Cons of each technique will be examined to provide you with facts and my own opinion.

Plain Text

Plain text is the easiest input to deal with. It’s as simple as creating paragraphs from the text and encoding special characters. Hell, creating paragraphs are optional and sometimes even discouraged. Allowing only plain text allows users to post information, but doesn’t focus on styling the output like other options. This method is great for basic messaging applications.

Textile

Some developers may want simple formatting such as bold text or emoticons, but don’t want to force their users to learn BBCode. Not to worry, Textile is available for your use. I suggest only using part of the markup language, but you’re free to use the whole thing. Textile is nice because it is lightweight and easy to learn (the basics anyway). The most useful parts (in my opinion) are bold text (*bold*), emphasized text (_emphasized_), and lists (unordered begins with *, ordered begins with #).

BBCode

Forum and blog users are most likely familiar with BBCode making it a great choice for any application. Not only is it well-known, but it isn’t too difficult to write a basic BBCode parser. If you’re unfamiliar with BBCode, it is basically a watered-down version of HTML (generally using [ and ] instead of < and >) that typically adds in paragraph formatting automatically. It’s a great choice for web developers that don’t have the time to write (or integrate) an HTML filter that want more functionality than textile.

HTML (filtered)

Filtering HTML can do many different things depending on the application. It can remove unwanted tags (<script>), change some tags to different tags (<b> to <strong>), and even fix coding errors (<p>text</b>). Some filters even allow the creation of new tags (<youtube>Q0BDBrLJI0g</youtube> becomes an embedded video of http://www.youtube.com/watch?v=Q0BDBrLJI0g). An application developer wanting to use filtered HTML input should decide his/her needs before deciding on a filter to use. Many may even decide to write their own filter to fit their needs the best.

HTML (unfiltered)

Unfiltered HTML gives the author complete availability to HTML, JavaScript, CSS, and any other client-side web language. This makes it an excellent choice for site administration, but should never be available to the public. Also keep in mind this should only be used by experienced coders. Any application provided to clients should filter HTML input (if HTML is allowed at all). Typically, if someone needs a web designer/developer, they probably don’t know HTML. In these cases, providing a WYSIWYG editor or only allowing plain text may be the best option.

WYSIWYG Editor

Regardless of the type of parser used, WYSIWYG editors should always be an option. For those of you not familiar with WYSIWYG editors, they are basically word processors coded in JavaScript (at least the type I’m discussing in this article). Even for applications using custom tags (BBCode for example), a WYSIWYG editor makes the process much easier for the end-user. Despite an end-user’s background, they are more likely know to click [b] to bold text than to add [b] before the text and [/b] after the text (or <b> & </b>). This isn’t necessarily because we humans are visual learners, but rather because most computer users are familiar with word processors and how they work.

Closing Remarks

Applications should always use the parser(s) best suited to its needs. They should also provide a WYSIWYG editor if at all possible. Remember, applications should always be geared towards the end-user, not the application itself. Open source applications are typically available for developers who either don’t have the time or the knowledge to write certain functionality themselves.

What do you allow on your website?

View Results

Tags: , , , , , , , , ,

3 Responses to “HTML, BBCode, or Plain Text?”

  1. Polprav Says:

    Hello from Russia!
    Can I quote a post in your blog with the link to you?

  2. Brandon Frohs Says:

    Absolutely! :)

  3. Tab Atkins Says:

    Dude, markdown. It is, hands down, the best markup language for creating text.

Leave a Reply