Swiftpack.co - Package - longhorn499/LemonTree

LemonTree

Display Markdown using UIKit 🍋

WHY?

This can potentially provide more configuration options than presenting Markdown in a webview or with one attributed string.

By using UIStackView to build a Markdown view, there are situations where you could: add a UIView with a configured spacer height (ex: GitHub Markdown does this after H1 and H2 headers), create a custom UIView for displaying your code blocks, or insert a UIImageView for inline images, and find opportunities for customization using UIKit.

Usage

  let string = "I am some **Markdown** _text_ right here"
  let lemonView: UIView = try! LemonTree.generateView(for: string)
  lemonView.translatesAutoresizingMaskIntoConstraints = false
  view.addSubview(lemonView)

Markdown

Supported

  • ☑ Headings
  • ☑ Inline Code
  • ☑ Links (openable)
  • Emphasis, Strong
  • ☑ Lists (bulleted and ordered)
  • ☑ Ordered Lists
  • ☑ Images (local)

Next

  • ☐ Block quotes
  • ☐ Multi-level lists
  • ☐ Code blocks
  • ☐ Remote images (and gifs)

Unsupported

  • ☐ HTML

.. and a few more that aren't listed

Platforms

  • ☑ iOS 13.0+
  • ☐ macOS

Installation

Use the URL from this repository to add using Swift Package Manager

Credit

CommonMark - generates the Markdown Document for rendering

CommonMarkAttributedString - the logic for generating attributed strings for nodes (especially this file)

Parma - thank you for the inspo. I thought this was a fun/maybe good idea but got hung up trying to do some of the work unrelated to the final step

Github

link
Stars: 0

Dependencies

Used By

Total: 0

Releases

1.0.2 - 2020-08-25 00:00:40

Fix access control again

1.0.1 - 2020-08-24 23:54:19

Fix access control

1.0.0 - 2020-08-24 23:45:26