Swift cmark wrapper for SwiftPM
Switch branches/tags
Nothing to show
Clone or download
Latest commit aea4876 Sep 21, 2017
Type Name Latest commit message Commit time
Failed to load latest commit information.
Sources/SwiftMarkdown Default to safe options for cmark Apr 19, 2017
Tests Update README Apr 19, 2017
.gitignore Add Swift 4 manifest Sep 20, 2017
.travis.yml Add Swift 4 support Sep 20, 2017
LICENSE Initial commit Aug 30, 2016
Package.swift Use new cmark library Apr 19, 2017
Package@swift-4.swift Add Swift 4 manifest Sep 20, 2017
README.md Add Swift 4 support Sep 20, 2017



Language Build Status 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.


markdown -> HTML

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


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.


Swift Package Manager

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