Hysen Labs
Open-source project
zjc19891106/MarkdownDisplayView avatar
zjc19891106

MarkdownDisplayView

A view for display markdown text.support markdown streaming like gpt&claude&gemini&deepseek

227 stars31 forksSwiftApache-2.0
DEEP OPEN-SOURCE ANALYSIS

MarkdownDisplayView renders Markdown on iOS with live AI streaming and typewriter output

A UIKit renderer built on TextKit 2 adds background parsing, incremental updates and safe SSE delta handling for chat style interfaces.

What the renderer is for

MarkdownDisplayView is a UIKit Markdown renderer for iOS built on TextKit 2, and the README positions it for AI chat and document screens. It can render complete Markdown or append live AI and server sent event deltas with configurable styling, typewriter output and optional haptic feedback. The design goal is to handle both a static document and a streaming response from a model such as GPT, Claude, Gemini or DeepSeek without re rendering the whole view. Background parsing keeps the main thread free, and incremental UI updates mean only the changed portion of the document is touched as new chunks arrive. The project ships an English README and a Chinese translation, and the example target can run a real AI chat demo when a local config file with a host, path, api key, model and system prompt is supplied. The streaming demo shows real SSE chunk handling with safe module buffering and ordered deltas.

Supported syntax and styling

The feature table lists what the renderer provides. On rendering it covers TextKit 2, background parsing, first screen first and incremental UI updates. On Markdown it handles headings, lists, tables, blockquotes, images, LaTeX, footnotes, details and horizontally scrollable code blocks, with built in highlighting for more than twenty common languages. Navigation includes a generated table of contents, heading navigation and internal anchors. Styling covers fonts, colors, spacing, light and dark presets and block appearance. Extensions allow custom parsers, view providers, action handlers and fenced code renderers, while callbacks cover link, image, table of contents, height and streaming step events. The requirements are iOS 15.0 or later, Swift 5.9 or later, and Xcode 15.0 or later for the package, with the checked in example project using the Xcode 26 project format.

How to install and use it

Installation supports both Swift Package Manager and CocoaPods. With Swift Package Manager the dependency name is MarkdownDisplayView and the import is the same name; CocoaPods exposes the same API through a pod named MarkdownDisplayKit. Swift Package Manager resolves swift markdown and Kingfisher automatically, while the CocoaPods podspec declares AppleSwiftMDWrapper for parsing and Kingfisher for image loading. A basic usage example creates a ScrollableMarkdownViewTextKit, assigns a default configuration and sets the markdown string, then adds the view to the hierarchy like any scroll view. Link and image taps are handled through callbacks such as on link tap, which opens the URL when the application can. The repository carries 227 stars and 31 forks with a single open issue, the default branch is master, and the license is Apache 2.0.

Editorial conclusion

MarkdownDisplayView is an Apache 2.0 licensed Swift package on the master branch with 227 stars that installs through Swift Package Manager or CocoaPods and targets iOS 15 plus Swift 5.9 and Xcode 15.

DEEP OPEN-SOURCE ANALYSIS

Official sources

Community notes

Community notes