Update 12th Jan 2017: This project has been replaced with my improved CommonMark-iOS project

I’ve just put the finishing touches on a module I’ve been working on for iOS projects. It’s a module for converting Markdown to HTML and HTML to Markdown. I call it Shakespeare. It’s fast (a few milliseconds per document) and requires no plugins or third party items.

How does it work?

It’s essentially a sneaky hack. Rather than implement a Xojo-based Markdown parser and re-invent the wheel, the module uses two javascript scripts embedded in iOSHTMLViewers to do the conversion. It uses remarkable.js and to-markdown.js.

How do I use it in my projects?

Shakespeare is designed to be easy to use. Simply drop it in a Xojo iOS project, initialise it and call one of its two methods:


dim md, html as Text

' Convert to HTML
md = "This is **bold** text"
html = Shakespeare.MarkdownToHTML(md) ' This is <strong>bold</strong> text

' Convert to Markdown
html = <h1>My heading</h1>
md = Shakespeare.HTMLToMarkdown(html) ' # My heading

Suggestions and feedback welcome.