Skip to content
Parses Markdown text into Fandoc objects
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Markdown Parser v0.0.10

Written in: Fantom pod: v0.0.10 Licence: ISC


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.


Install Markdown Parser with the Fantom Pod Manager ( FPM ):

C:\> fpm install afMarkdownParser

Or install Markdown Parser with fanr:

C:\> fanr install -r afMarkdownParser

To use in a Fantom project, add a dependency to

depends = ["sys 1.0", ..., "afMarkdownParser 0.0"]


Full API & fandocs are available on the Eggbox - the Fantom Pod Repository.


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().parseStr("...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.

You can’t perform that action at this time.