A Swift wrapper of cmark with GitHub Flavored Markdown extensions.
Import the framework
import cmark_gfm_swift
Render Markdown to HTML
let markdownText = """
## Heading
"""
if let parsed = Node(markdown: markdownText)?.html {
print("HTML parsed: \(parsed)")
}
Enabling Markdown extensions and options
let markdownText = """
## Heading
"""
// List of markdown options
var options: [MarkdownOption] = [
.footnotes // Footnote syntax
]
// List of markdown extensions
var extensions: [MarkdownExtension] = [
.emoji, // GitHub emojis
.table, // Tables
.autolink, // Autolink URLs
.mention, // GitHub @ mentions
.checkbox, // Checkboxes
.wikilink, // WikiLinks
.strikethrough // Strikethrough
]
if let parsed = Node(
markdown: markdownText,
options: options,
extensions: extensions
)?.html {
print("HTML parsed: \(parsed)")
}