Skip to content

Latest commit

 

History

History
68 lines (52 loc) · 1.53 KB

README.md

File metadata and controls

68 lines (52 loc) · 1.53 KB

cmark-gfm-swift

A Swift wrapper of cmark with GitHub Flavored Markdown extensions.

Usage

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

Resources

Acknowledgements