Swift MIT

CDMarkdownKit

An extensive Swift framework providing simple and customizable markdown parsing.

C

chrisdhaan

Dernière activité 10 sept. 2026
chrisdhaan/CDMarkdownKit

267

étoiles

64

forks

1

issues ouvertes

ioslabelmacosmarkdownswiftswift-package-managertextviewtvosvisionoswatchosxcode

Ce README est souvent en anglais.

CDMarkdownKit

CI Status Swift Versions Swift Package Manager Compatible License


A pure-Swift, zero-dependency framework for parsing Markdown text into styled NSAttributedString.

Features

  • Parse Markdown to styled NSAttributedString
  • Support for bold, italic, strikethrough, headers, lists, ordered lists, task lists, quotes, horizontal rules, code blocks
  • Tables with column alignment (GFM-style)
  • Reference-style links ([text][ref] + [ref]: url definitions)
  • Clickable links and automatic URL detection
  • Image rendering (iOS, macOS, tvOS, visionOS)
  • Async image loading with async/await
  • Custom Markdown elements
  • CDMarkdownTheme for one-call parser styling
  • Custom attribute keys: .cdMarkdownCodeLanguage, .cdMarkdownLinkTitle
  • UILabel and UITextView subclasses with Markdown support
  • macOS UI components (NSTextView, NSLabel subclasses)
  • SwiftUI support via CDMarkdownText and CDMarkdownView
  • Swift 6 concurrency safety

Quick Example

import CDMarkdownKit

let parser = CDMarkdownParser()
let markdown = "# Hello **World**\n\nThis is *italic* text."
let attributedString = await parser.parse(markdown)
label.attributedText = attributedString

Requirements

Platform Minimum OS Swift Installation
iOS 13.0+ 5.3+ SPM
macOS 10.15+ 5.3+ SPM
tvOS 13.0+ 5.3+ SPM
watchOS 6.0+ 5.3+ SPM
visionOS 1.0+ 5.3+ SPM

Installation

Note: CocoaPods support was removed in v4.2.0 ahead of CocoaPods Trunk going read-only on 2026-12-02. The last version published via CocoaPods was 4.1.0. If you're installing via CocoaPods, switch to Swift Package Manager below — already-installed versions will keep resolving, but the pod will no longer receive updates.

Swift Package Manager

Add to your Package.swift:

.package(url: "https://github.com/chrisdhaan/CDMarkdownKit.git", from: "4.0.0")

Or in Xcode: File → Add Packages and enter the repository URL.

Usage

For comprehensive usage documentation including styling, custom elements, and platform-specific information, see Documentation/Usage.md.

Contributing

We welcome contributions! Before contributing to CDMarkdownKit, please read the detailed instructions in our contribution guide. We maintain high standards for code quality and test coverage, and we're happy to help you get your changes integrated.


License

CDMarkdownKit is available under the MIT license. See the LICENSE file for more info.

Projets similaires

A Swift package for parsing, building, editing, and analyzing Markdown documents.

Swift
Sswiftlang
3,4 k étoiles302

A framework for parsing and transforming Markdown written in Swift 6. The syntax is based on the CommonMark specification. The framework defines an abstract syntax for Markdown, provides a parser for parsing strings into abstract syntax trees, and comes with generators for HTML, attributed strings, plain text, and text with ANSI-markup.

Swiftcommonmarkioslinux
Oobjecthub
214 étoiles26

A native AppKit Markdown editor for macOS, built on TextKit 2 and bridged to SwiftUI.

Swift
Nnodes-app
1,1 k étoiles117