Codekicker.BBCode is a stable and fast BBCode-Parser for .NET. It can transform any BBCode into HTML or into an in-memory syntax tree that can be analyzed or translated. All tags are fully customizable, nothing is hardcoded.

The design goals of Codekicker.BBCode were:
  • Stable - it never ever crashes
  • Safe - it does not let through unsafe HTML like <script> under any circumstances
  • Performance - it is meant to be used in production
  • Easy to use - Just call BBCode.ToHtml("[url=http://example.com/]example.com[url]")
  • Customizable - Customizing the translation of every tag is easy and flexible
  • Error messages - the messages are available in English and German. Language contributions are welcome.

Quickstart
Just call BBCode.ToHtml("My [b]BBCode[/b] [i]here[/i]")

How do I customize the markup set?
            var parser = new BBCodeParser(new[]
                {
                    new BBTag("b", "<b>", "</b>"), 
                    new BBTag("i", "<span style=\"font-style:italic;\">", "</span>"), 
                    new BBTag("u", "<span style=\"text-decoration:underline;\">", "</span>"), 
                    new BBTag("code", "<pre class=\"prettyprint\">", "</pre>"), 
                    new BBTag("img", "<img src=\"${content}\" />", "", false, true), 
                    new BBTag("quote", "<blockquote>", "</blockquote>"), 
                    new BBTag("list", "<ul>", "</ul>"), 
                    new BBTag("*", "<li>", "</li>", true, false), 
                    new BBTag("url", "<a href=\"${href}\">", "</a>", new BBAttribute("href", ""), new BBAttribute("href", "href")), 
                });
            return parser.Transform("[b]bbcode[/b]");

Why is it as stable as we claim?
We have used Visual Studio IntelliTest (Announcement for Visual Studio 2015: https://www.visualstudio.com/en-us/products/vs-2015-product-editions.aspx) to extensively test some important properties of this BBCode-Parser. We used IntelliTest to ensure that the parser never crashes and that it never emits any dangerous tag such as <script>, no matter what the input was. The user can type any HTML he wants but it will just get encoded, even when it is in unusual places like the href-attribute of the url-tag. If you have any questions about this you can post them on http//codekicker.de if you speak German. In other cases you can contact us by email in English.

Licence
This BBCode-parser is licensed under the Creative Commons Attribution 3.0 Licence: http://creativecommons.org/licenses/by/3.0/. You can freely use and modify the code even commercially. Please help us spread the word: We require a link from anywhere on your corporate website or blog (or from a staff-member's personal blog).

Who can use it?
As this parser is written in C#, it can be used in any .NET-Language like C# or VB.NET. The reason why we wrote it is that all existing BBCode-parsers for .NET were fundamentally broken and immature.

What else?
If you have questions, feature suggestion or bug reports you can contact us at team@codekicker.de in English or German. If you do speak German you should post your question on http//codekicker.de.

Last edited Jun 19 at 3:55 PM by codekicker, version 17