Swiftpack.co - Package - vapor-community/markdown

Markdown

Language Build Status Code Coverage GitHub license

Very simple Swift wrapper of GitHub's fork of cmark. Uses a fork of cmark which has been adapted for building with SwiftPM.

Usage

markdown -> HTML

let markdown = "# Hello"
let html = try markdownToHTML(markdown)
print(html) // This will return "<h1>Hello</h1>\n"

Options

You can pass different options to the underlying cmark library. By default safe is passed, but this can be explicitly done with:

let html = try markdownToHTML(markdown, options: [.safe])

The available options are:

  • sourcePosition
  • hardBreaks
  • safe
  • noBreaks
  • normalize
  • validateUTF8
  • smartQuotes

For more information on the available options, see cmark.

Installation

Swift Package Manager

.package(url: "https://github.com/vapor-community/markdown.git", .upToNextMajor(from: "0.4.0"))

Github

link
Stars: 34

Used By

Total: 0

Releases

0.5.0 - 2019-12-02 10:15:15

Swift Markdown 0.5.0

Update to Swift 5.1

0.4.0 - 2017-09-21 17:43:43

Markdown 0.4.0

PR #4 - add Swift 4 support to the library

0.3.0 - 2017-04-25 21:18:03

Markdown 0.3.0

This release contains a number of improvements from Broken Hand's fork including:

  • Github Flavoured Markdown support
  • Default to safe rendering

Markdown 0.2 - 2017-03-29 17:41:22

- 2016-08-30 13:02:15