Skip to content
/ Down Public
forked from johnxnguyen/Down

GitHub-flavored Markdown rendering in Swift, built upon Apple's Swift Markdown parser.

License

Notifications You must be signed in to change notification settings

shadone/Down

 
 

Repository files navigation

Down

MIT licensed Swift 5 macOS iOS tvOS

Blazing fast Markdown (GitHub-flavored) rendering in Swift, built upon Apple's Swift Markdown.

Note! This is a fork of the excellent Down library by Rob Phillips and John Nguyen.

The main purpose of this fork is to make the markdown parser and renderer that as needed for the Spud Lemmy client that I am developing (on and off). If you also find this useful, let me know!

Maintainers

Based on Down library (https://github.com/johnxnguyen/Down) maitained by John Nguyen and others:

Installation

Note: Swift support is summarized in the table below.

Swift Version Tag
Swift 5.1 >= 0.9.0

Install using Swift Package Manager:

To add Down to your project, select File → Add Package Dependency and enter the GitHub URL for Down. See Adding Package Dependencies to Your App for detailed instructions.

Or manually install:

  1. Clone this repository
  2. Drag and drop the Down project into your workspace file, adding the framework in the embedded framework section
  3. Build and run your app
  4. ?
  5. Profit

Output Formats

  • NSAttributedString

Usage

The Down struct has everything you need if you just want out-of-the-box setup for parsing and conversion.

import Down
import Markdown


// Parse the markdown string into AST
let document = Document(parsing: markdownString)

// Convert to an attributed string using default presentation ("styler")
let down = Down(document: document).toAttributedString(DownStyler())

// Get NSAttributedString representation of the markdown content.
let attributedString = try? down.toAttributedString()

// Display the rendered markdown content in UITextView
let downView = UITextView()
downView.attributedText = attributedString

Supports

Swift; iOS 15+, tvOS 15+, macOS 11.00+

A little help from my friends

Please feel free to fork and create a pull request for bug fixes or improvements, being sure to maintain the general coding style, adding tests, and adding comments as necessary.

Credit

Down is built upon the Apple's Swift Mardown library that is powered by GitHub-flavored Markdown's cmark-gfm implementation.

This library is a fork of the excellent Down library by Rob Phillips and John Nguyen.

About

GitHub-flavored Markdown rendering in Swift, built upon Apple's Swift Markdown parser.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 99.5%
  • Other 0.5%