Swiftpack.co - Package - vapor-community/leaf-markdown

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.

Usage

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

#markdown(myMarkdown)

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

# Hey #

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

Setup

Add as dependency

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

    dependencies: [
        ...,
        .package(name: "LeafMarkdown", url: "https://github.com/vapor-community/leaf-markdown.git", .upToNextMajor(from: "3.0.0")),
    ]

Then add the dependency to your target:

.target(
    name: "App",
    dependencies: [
        // ...
        "LeafMarkdown"
    ],
    // ...
)

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.

Github

link
Stars: 47

Used By

Total: 0

Releases

3.0.0 -

Leaf Markdown 3.0.0

Add support for Vapor 4. See the README for usage details

3.0.0 Beta 1 -

Adds support for Vapor 4 and migrate to Swift 5.2

2.2.0 -

Leaf Markdown 2.2.0

This is just a maintenance update to Swift 5.1 (with compatibility kept for Swift 4) and migrating to GH actions to stop things going stale!

2.1.0 -

Leaf Markdowm 2.1.0

New features:

  • #9 - Expose markdown parsing options

2.0.0 -

Leaf Markdown 2.0.0

Adds support for Leaf 3.

⚠️ This version contains changes due to the way Vapor registers Leaf tags. See the README for updated usage instructions.

2.0.0 RC 1 -

Leaf Markdown 2.0.0 RC 1

Adds support for Leaf 3.

⚠️ This version contains changes due to the way Vapor registers Leaf tags. See the README for updated usage instructions.

1.1.1 -

Markdown Provider 1.1.1

  • Fixes #6 with PR #7

1.1.0 -

Markdown Provider 1.1.0

PR #5 - add Swift 4 support

1.0.0 -

Markdown Provider 1.0.0

This is the first major release of the Markdown Provider for Vapor 2. It includes all of the work from the Broken Hands fork to make it use the latest Markdown package, including support for Github Flavoured Markdown. See the README for details on how to use.