Although the dynamic content in the Cyotek website is written using Markdown syntax using the MarkdownSharp library, we decided to use the more commonly used BBCode tags for the forums.
Some of the source code on this site is also preformatted using the CSharpFormat library, and we wanted to provide access to this via forum tags too.
A quick Google search brought up a post by Mike343 which had a BBCode parser that more or less worked, but didn't cover everything we wanted.
You can download below an updated version of this parser which has been modified to correct some problems with the original implementation and add some missing BBCode tags, including a set of custom tags for providing the syntax highlighting offered by CSharpFormat. Using the provided formatter classes you can easily create additional tags to suit the needs of your application.
To transform a block of BBCode into HTML, call the static
Format method of the
BbCodeProcessor class, for example:
is transformed into
Much of the formatting is also customisable via CSS - several of
the BBCode tags such as
[list] etc are
assigned a class which you can configure in your style sheets.
Listed below are the default rules used by the Cyotek site as a
starting point for your own:
Finally, if you are using MVC, you may find the following HTML Helper useful for transforming code from within your views.
If you create any additional formatting codes for use with this library, please let us know via either comments or the Contact Us link, and we'll integrate them into the library for others to use.
- 2010-03-18 - First published
- 2020-11-21 - Updated formatting