Swiftpack.co -  vapor-community/markdown as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
vapor-community/markdown
Swift cmark wrapper for SwiftPM
.package(url: "https://github.com/vapor-community/markdown.git", from: "0.7.0")

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: 42
Last commit: 15 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

0.7.0
15 weeks ago

0.7.0

Make use of the new API in cmark-gfm 2.1.0 to stop memory leaks in the extensions

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API