Easily render HTML from standard Markdown content.
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>This implementation is built entirely on top of the amazing cmark-gfm which itself is a fork of the excellent cmark.
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>"Complete documentation ins DocC format can be found attached to each corresponding release. For instance here.
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"])
]
…
)