Skip to content

An extension of GitHub's cmark fork with a Swift AST wrapper and more extensions

License

Notifications You must be signed in to change notification settings

lukakerr/cmark-gfm-swift

 
 

Repository files navigation

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

About

An extension of GitHub's cmark fork with a Swift AST wrapper and more extensions

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 71.8%
  • C++ 18.9%
  • Swift 4.8%
  • Objective-C 4.4%
  • Ruby 0.1%