Markdown ParserUser Guide

Markdown Parser is a support library that aids Alien-Factory in the development of other libraries, frameworks and applications. Though you are welcome to use it, you may find features are missing and the documentation incomplete.


Parses Markdown text into Fandoc objects.

Supported Markdown syntax:

  • Headings (with anchor links)
  • Paragraphs
  • Block quotes
  • Lists (ordered and unordered)
  • Links and images
  • Bold and italics
  • Code blocks and code spans (normal and Github style)

Markdown Parser uses the extensible Parsing Expression Grammer as provider by Pegger.

Note that this markdown implementation is known to be incomplete. For example, it does not support reference links or backslash escaping * and _ characters. But it should be usable to most casual users.


1 class - 1 method - 1 argument - 1 return value.

fandoc := MarkdownParser().parse("...markdown...")

It's pretty self explanatory!


A cheatsheet of supported markdown syntax:

# Heading 1

## Heading 2

### Heading 3

#### Heading 4

#### <a name="id"></a> Heading with anchor tag

This is *italic* and so is _this_

This is **bold** and so is __this__

These are just * stars * and _ stripes _

This is a `code` span.

This is a code block:
    Void main() {
        echo("Note the leading 4 spaces")

This is a Github style code block.

Horizonal Rules:

This is a link to [Fantom-Factory](

![Fanny the Fantom Image](

> This is a block quote. - said Fanny

 * An unordered list
 * An unordered list
 * An unordered list

 1. An ordered list
 1. An ordered list
 1. An ordered list


To convert Markdown to HTML use the HtmlDocWriter class from the core fandoc pod:

using afMarkdownParser
using fandoc

fandoc := MarkdownParser().parse("...markdown...")
buf    := StrBuf()
html   := buf.toStr

Note that Fantom also ships with a FandocDocWriter and a MarkdownDocWriter should you wish to print fandoc or markdown documents.