MarkdownKit is a high-performance native Markdown renderer for Apple platforms, built in Swift with swift-markdown and TextKit-based layout.
- CommonMark + GitHub Flavored Markdown (tables, task lists, strikethrough, links)
- Native table rendering (
NSTextTable) with GitHub-like styling - Math support (
$...$,$$...$$, and fencedmath) via MathJaxSwift - Collapsed sections support (
<details>/<summary>) - Diagram fence detection (
mermaid,geojson,topojson,stl) with pluggable adapter fallback - Async layout pipeline and virtualized iOS/macOS collection views
- Swift 6.2+
- iOS 17.0+
- macOS 26.0+
swift build
swift test
swift run MarkdownKitDemoimport MarkdownKit
let parser = MarkdownKitEngine.makeParser()
let solver = MarkdownKitEngine.makeLayoutSolver()
let document = parser.parse("# Hello MarkdownKit")
let layout = await solver.solve(node: document, constrainedToWidth: 800)
print(layout.children.count)import MarkdownKit
let layout = await MarkdownKitEngine.layout(
markdown: "# Hello\n\nThis is **MarkdownKit**.",
constrainedToWidth: 800
)
print(layout.children.count)Fast regression gate (recommended for daily iteration):
bash scripts/verify_fast.shBenchmark-only gate (heavier):
bash scripts/verify_benchmarks.shCombined wrapper (fast + optional heavy):
bash scripts/verify_all.shOptional heavy benchmark suites:
bash scripts/verify_all.sh --with-benchmarksOne-shot full suite (includes all tests, including benchmarks/snapshots):
bash scripts/verify_all.sh --fullThe test suite is split into fast regression tests and heavy benchmarks:
- Fast suite (
verify_fast.sh): ~200 tests covering parsing, layout, plugins, security, and snapshot stability. Runs in under 60 seconds. Used as CI gate. - Benchmark suite (
verify_benchmarks.sh): Heavy performance regression tests. Run locally or in nightly CI. - Running bare
swift testexecutes everything including benchmarks. Preferverify_fast.shfor daily iteration.
Sources/MarkdownKit: core parser, AST nodes, plugins, layout engine, UI componentsSources/MarkdownKitDemo: demo appTests/MarkdownKitTests: unit/integration testsdocs/: PRD, feature notes, roadmapscripts/: local automation and verification entrypointstasks/: implementation checklist