swiftysites/gfmarkdown
Easily render HTML from standard Markdown content.
Overview
Use this library to generate HTML from a string containing GitHub Flavored Markdown (GFM) / CommonMark content.
For example this code:
# Hello
Hello, _World_!Will be translated into this code:
<h1>Hello</h1>
<p>Hello, <em>World<em>!</p>Acknowledgements
This implementation is built entirely on top of the amazing cmark-gfm which itself is a fork of the excellent cmark.
Basic usage
Simply wrap your Markdown string with `GFMarkdown and call GFMarkdown/toHTML(options:extensions:)` with no parameters.
let html = GFMarkdown("# Hello").toHTML()
print(html) // "<h1>Hello</h1>"Documentation
Complete documentation ins DocC format can be found attached to each corresponding release. For instance here.
Configuring your project
Look for the corresponding XCFramework attached to each release and add it as a binary target to your Package.swift. The example below contains the correct URL and checksum for the current branch/release.
…
let package = Package(
…
dependencies: [
.package(name: "GFMarkdown", url: "https://github.com/swiftysites/gfmarkdown", branch: "release")
],
targets: [
.target(
name: "MyApp",
dependencies: ["GFMarkdown"])
]
…
)Package Metadata
Repository: swiftysites/gfmarkdown
Default branch: master
README: README.md