Rendering Markdown text natively in SwiftUI.

Overview

MarkdownView

MarkdownView is a Swift Package for rendering Markdown text natively in SwiftUI.

Thanks to apple/swift-markdown, it can fully compliant with the CommonMark Spec.

Here is a preview :)

Supported Platforms

You can use MarkdownView in the following platforms:

  • macOS 13.0+
  • iOS 16.0+
  • tvOS 16.0+

Sadly, the system requirements is relatively high because we need to use the Layout Protocal that only supports in the new Operating Systems to automatically position elements.

If you still want to support older operating systems, there is a similar package gonzalezreal/MarkdownUI.

Advantage

  • Fully compliant with CommonMark
  • SVG rendering support
  • Highly Customizable and Extensible
    • Supports almost all the built-in modifiers
    • Supports Directive Block Rendering
    • Supports custom image loading
  • Fully Native SwiftUI code

Usage

You can create a Markdown view by providing a Markdown-formatted string.

MarkdownView(text: "This is the Apple's **newly published** [swift-markdown](https://github.com/apple/swift-markdown)")

If your Markdown have CheckBoxes, you can provide a Binding string.

@State var text = "- [x] Buy some eggs"
MarkdownView(text: $text)

For more information, Check out MarkdownView's Documentation

Swift Package Manager

In your Package.swift Swift Package Manager manifest, add the following dependency to your dependencies argument:

.package(url: "https://github.com/LiYanan2004/MarkdownView.git", .branch("main")),

Add the dependency to any targets you've declared in your manifest:

.target(name: "MyTarget", dependencies: ["MarkdownView"]),

Similar Projects

Dependencies

You might also like...
Marky Mark is a parser written in Swift that converts markdown into native views.
Marky Mark is a parser written in Swift that converts markdown into native views.

Marky Mark is a parser written in Swift that converts markdown into native views. The way it looks it highly customizable and the supported markdown syntax is easy to extend.

Notepad - A fully themeable iOS markdown editor with live syntax highlighting.
Notepad - A fully themeable iOS markdown editor with live syntax highlighting.

Notepad is just like any other UITextView, but you need to use the convenience initializer in order to use the themes. To create a new theme, copy one of the existing themes and edit the JSON.

Markdown parser for iOS

Marky Mark Marky Mark is a parser written in Swift that converts markdown into native views. The way it looks it highly customizable and the supported

Swift markdown library
Swift markdown library

Markdown ![Swift version](https://img.shields.io/badge/Swift-2.1 | 2.2-blue.svg) ![GitHub license](https://img.shields.io/badge/license-LGPL v3-green.

A Pure Swift implementation of the markdown mark-up language

SmarkDown A pure Swift markdown implementation consistent with Gruber's 1.0.1 version. It is released under the BSD license so please feel free to use

`resultBuilder` support for `swift-markdown`

SwiftMarkdownBuilder resultBuilder support for swift-markdown. The default way to build Markdown in swift-markdown is to use varargs initializers, e.g

Leverages Apple's Swift-based Markdown parser to output NSAttributedString.
Leverages Apple's Swift-based Markdown parser to output NSAttributedString.

Markdownosaur 🦖 Markdownosaur uses Apple's excellent and relatively new Swift Markdown library to analyze a Markdown source, and then takes that anal

AttributedString Markdown initializer with custom styling
AttributedString Markdown initializer with custom styling

AttributedString Markdown initializer with custom styling AttributedString in iOS 15 and macOS 12 comes with a Markdown initializer. But: There is no

An Objective-C framework for converting Markdown to HTML.

MMMarkdown MMMarkdown is an Objective-C framework for converting Markdown to HTML. It is compatible with OS X 10.7+, iOS 8.0+, tvOS, and watchOS. Unli

Releases(0.2.0)
  • 0.2.0(Oct 16, 2022)

    Performance

    • Rendering is now at least 3x faster on ALL DEVICES.
    • Real-time previewing is now much much smoother.
    • Scrolling is much quicker and smoother with no frame drop.
    • Memory usage has been reduced by 30%

    New Features

    • Merge horizontal cells are supported in the table.

    Resolved Bugs

    • HTML blocks can be rendered properly.

    Minor Improvements

    • Images from Internet can now use its actual size as the maximum size.
    • The empty label of the image will be hidden.

    Deprecations

    • Lazy load is now deprecated.

    Full Changelog: https://github.com/LiYanan2004/MarkdownView/compare/0.1.0...0.2.0

    Source code(tar.gz)
    Source code(zip)
  • 0.1.0(Aug 18, 2022)

  • 0.0.7(Aug 16, 2022)

    A Markdown Renderer in SwiftUI

    We have added all the components that defined in CommonMark Spec.

    For Example:

    • Bold
    • Italic
    • Underline
    • Strike through
    • Images
    • Links
    • Lists
      • Ordered lists
      • Unordered lists
      • Todo lists(lists with Check Boxes)
    • Tables
    • Blocks
    • And lots of customizable modifier and handlers

    If you find a bug, please file an issue.😃

    Source code(tar.gz)
    Source code(zip)
Owner
LiYanan2004
Teen iOS Developer. I will Discover SwiftUI in coming summer holiday!
LiYanan2004
Blazing fast Markdown / CommonMark rendering in Swift, built upon cmark.

Down Blazing fast Markdown (CommonMark) rendering in Swift, built upon cmark v0.29.0. Is your app using it? Let us know! If you're looking for iwasrob

John Nguyen 2k Dec 19, 2022
Generate SwiftUI Text or AttributedString from markdown strings with custom style names.

iOS 15.0 / macOS 12.0 / tvOS 15.0 / watchOS 8.0 StyledMarkdown is a mini library that lets you define custom styles in code and use them in your local

null 19 Dec 7, 2022
Render Markdown text in SwiftUI, preview based on the Marked implementation

Markdown Render Markdown text in SwiftUI. It is a preview based on the Marked implementation. swiftui-markdown.mov Installation You can add MarkdownUI

小弟调调™ 26 Dec 20, 2022
AttributedText is a Swift µpackage that provides NSAttributedString rendering in SwiftUI by wrapping either an NSTextView or a UITextView depending on the platform.

AttributedText AttributedText is a Swift µpackage that provides NSAttributedString rendering in SwiftUI by wrapping either an NSTextView or a UITextVi

null 1 Jul 18, 2022
Markdown in SwiftUI, and some other interesting components.

RoomTime RoomTime is a bundle of tools developed in my app RoomTime Lite. ( ?? RoomTime Lite is still in development) Features TextArea AutoWrap Markd

Chen SiWei 56 Dec 20, 2022
An iOS app to turn typed text into images of handwritten text in your own handwriting style.

Text-to-Handwritting © 2021 by Daniel Christopher Long An iOS app to turn typed text into images of handwritten text in your own handwriting style. ht

Daniel Long 11 Dec 29, 2022
Twitter Text Libraries. This code is used at Twitter to tokenize and parse text to meet the expectations for what can be used on the platform.

twitter-text This repository is a collection of libraries and conformance tests to standardize parsing of Tweet text. It synchronizes development, tes

Twitter 2.9k Dec 27, 2022
Powerful text framework for iOS to display and edit rich text.

YYText Powerful text framework for iOS to display and edit rich text. (It's a component of YYKit) Features UILabel and UITextView API compatible High

null 8.8k Jan 4, 2023
A simple and customizable Markdown Parser for Swift

MarkdownKit MarkdownKit is a customizable and extensible Markdown parser for iOS and macOS. It supports many of the standard Markdown elements through

Bruno Oliveira 687 Dec 18, 2022
MarkdownView is a WKWebView based UI element, and internally use bootstrap, highlight.js, markdown-it.

MarkdownView is a WKWebView based UI element, and internally use bootstrap, highlight.js, markdown-it.

Keita Oouchi 1.8k Dec 21, 2022