MarkdownKit

A CommonMark compliant Markdown parser for Xojo

MarkdownKit is the only 100% native Xojo Markdown parser that is fully CommonMark compliant. It works on every supported Xojo platform (including iOS) and is fast. Really fast.


What is Markdown?

Markdown is a very popular lightweight plain text markup language for the web. It's grown in popularity in recent years thanks to its widespread adoption on platforms such as GitHub and StackOverflow.

What is MarkdownKit?

MarkdownKit is an easy-to-use Xojo module that takes String or Text Markdown as input and outputs HTML as a String or Text. It is fully compliant with the CommonMark 0.29 specification which means that it passes all 649 tests in the test suite.

Once added to your Xojo project, using it is as easy as:

Dim md As String = "Some **bold** text and `code`"
Dim html As String = MarkdownKit.ToHTML(md)
// html now equals: 
// <p>Some <strong>bold</strong> text and <code>code</code></p>

Why use MarkdownKit?

  1. 100% native Xojo code. Requires no external plugins
  2. The only Xojo Markdown parser that works on iOS
  3. Fast. 3-4x faster than other Xojo Markdown parsers*
  4. The only CommonMark compliant Markdown parser for Xojo
  5. Unencrypted source code
  6. Provides access to the abstract syntax tree (AST) so you can easily create your own renderer. This allows you to easily output the Markdown in a format other than HMTL

Advanced features

As briefly mentioned above, whilst MarkdownKit is very easy to use, it also provides access to the abstract syntax tree (AST) it generates whilst parsing the input Markdown. The AST is a representation of the structure and content of the Markdown document. Once created, it can then be "walked" or traversed by a renderer.

A renderer is a class that implements the MarkdownKit.IRenderer interface. You can create your own if you wish. The default HTML renderer included in the MarkdownKit module is just such as class. I also include a second renderer class called ASTRenderer which will print out the AST (instead of converting it to HTML). Below is a simple example:

// Create a new Markdown document with some source code.
Dim doc As New MarkdownKit.Document("Some **bold** `Markdown` code.")

// Parse the source code into an AST.
doc.ParseBlockStructure
doc.ParseInlines

// `doc` is now essentially an AST. You can print it out using one of the 
// included renderers:
Dim astRenderer As New MarkdownKit.ASTRenderer
astRenderer.VisitDocument(doc)
Dim ast As String = astRenderer.Output

Dim htmlRenderer As New MarkdownKit.HTMLRenderer
htmlRenderer.VisitDocument(doc)
Dim html As String = htmlRenderer.Output

Fully documented

As people have come to expect from my products and projects, MarkdownKit comes with comprehensive documentation and a high quality demo application. Below is a short video showing the demo app in action:

Pricing

MarkdownKit is sold as an unencrypted Xojo module for £60 GBP and comes with full support for issues, bugs or feature requests. Your purchase includes the module, PDF documentation, a demo application and the test suite. Payment is handled securely through Stripe.

Note: The purchase actually includes two MarkdownKit modules. One of the modules is Text based and will run on all platforms. The other is String based and will run on all platforms except iOS (as Xojo's iOS framework does not yet support the String class). I recommend using the String based module if you don't need iOS support as it's faster.

Demo

Download a precompiled demo application showcasing what you can achieve with MarkdownKit in your own projects. The demo app is a Markdown editor with a live preview, light/dark CSS styling and syntax highlighting. The demo app's full source code is included with every purchase of MarkdownKit.

MarkdownKit
60.00
Add To Cart
 
* The comparison was made against Dave Sisemore's rdsMARKDOWN class (v1.13) on an iMac Pro in a compiled 64-bit macOS application. MarkdownKit rendered the raw Markdown text of the CommonMark 0.29 spec (202,341 characters) in 300 ms. Dave's class rendered it (incorrectly, as it's not compliant) in 910 ms. Remember, MarkdownKit is the only Markdown parser that also runs on iOS.