SwiftMarkdown

0.7.1

Swift cmark wrapper for SwiftPM
vapor-community/markdown

What's New

0.7.1

2021-10-23T15:45:25Z

What's Changed

New Contributors

Full Changelog: 0.7.0...0.7.1

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"))

Description

  • Swift Tools 5.1.0
View More Packages from this Author

Dependencies

Last updated: Wed Nov 09 2022 00:10:26 GMT-0500 (GMT-05:00)