Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time
November 17, 2020 10:26
January 2, 2018 15:31
August 30, 2016 16:14
November 17, 2020 10:14

Leaf Markdown

Language Build Status codecov GitHub license

A Markdown renderer for Vapor and Leaf. This uses the Vapor Markdown package to wrap cmark (though a fork is used to make it work with Swift PM), so it understands Common Mark. A quick reference guide for Common Mark can be found here. It also supports Github Flavored Markdown.


Once set up, you can use it in your Leaf template files like any other tag:


Where you have passed myMarkdown into the view as something like:

# Hey #

Check out my *awesome* markdown! It is easy to use in `tags`


Add as dependency

Add Leaf Markdown as a dependency in your Package.swift file:

    dependencies: [
        .package(name: "LeafMarkdown", url: "", .upToNextMajor(from: "3.0.0")),

Then add the dependency to your target:

    name: "App",
    dependencies: [
        // ...
    // ...

Register with Leaf

Register the tag with Leaf so Leaf knows about it:

app.leaf.tags["markdown"] = Markdown()

Don't forget to import LeafMarkdown in the file you register the tag with import LeafMarkdown.