Customisable and extensible Markdown parser written in Swift

What's New

  • Simple command-line interface for parsing markdown to HTML.
  • Fix fenced code block parser to support block parameters.


Build Status Version License Platform Carthage compatible

Dumpling is a pure Swift customisable and extensible Markdown parser for iOS, macOS and Linux.


  • 100% Swift
  • Easy to extend with new markdown tags, output formats or customise existing implementations.
  • Intermediate layer describing document structure with Abstract Syntax Tree
  • Build-in support for rendering outputs as the Plain Text, HTML, NSAttributedString.
  • Multiplatform - iOS, macOS, Linux.

Internal architecture

Dumpling uses a highly extensible and modular functional approach called parser combinator.

Markdown parser produces an intermediate data model called Abstract Syntax Tree (AST).

Renderer implementations use AST to produce the final output. Dumpling provides 3 main build-in output formats - Plain Text, HTML and NSAttributedString.

Supported Elements

*italic* or _italics_ 
**bold** or __bold__ 

# Header 1
## Header 2
### Header 3
#### Header 4
##### Header 5
###### Header 6

Horizontal lines (Thematic breaks)

* * *   *

* List
  - List
+ List

1. Ordered 
1. Lists with **style**

Inline `code` or 
block code

> Blockquotes
> > and  nested blockquote.
> ## With nested content 
> 1.   This is the **first** list ~~item~~.
> 2.   This is the *second* list item.

Please note that the goal of this project was to create a foundation for a flexible Markdown parser. Dumpling doesn't fully support all Markdown specs. This is a very young implementation so it covers only the most common set of Markdown features.



pod 'Dumpling'


github "chojnac/Dumpling.git" ~> 0.3.0

Swift Package Manager

dependencies: [
    .package(url: "https://github.com/chojnac/Dumpling.git", .upToNextMajor(from: "0.3.0"))


Basic usage

Parse text and produce html:

import Dumpling 

let text = "**Lorem ipsum**"
let html = Markdown().parse(text).renderHTML()

or NSAttributedText:

import Dumpling 

let text = "**Lorem ipsum**"
let string = Markdown().parse(text).renderAttributedString()

Change NSAttributedText style

import Dumpling 

let theme = AttributedStringTheme(
   baseFont: .systemFont(ofSize: 13),
   color: .blue

    forKey: .strong,
    style: StringStyle.foregroundColor(Color.red)

    forKey: .em,
    style: compose(

let string = Markdown()
        .renderAttributedString(theme: theme)

You will find more advanced examples in the project example playground


Dumpling is available under the MIT license. See the LICENSE file for more info.

Markdown test document used in the project based on Max Stoiber's Markdown Test File


  • Swift Tools 5.3.0
View More Packages from this Author


  • None
Last updated: Mon Nov 20 2023 05:43:05 GMT-1000 (Hawaii-Aleutian Standard Time)