gonzalezreal/swift-markdown-ui
58.9
Weak · 30 September 2026
8k
lines of production code
Swift
primary language
2
measurements over time
What this system is
MarkdownUI is a Swift library that renders GitHub Flavored Markdown natively within SwiftUI applications. It provides a declarative DSL and a comprehensive theming system to customize the appearance of structured text, including headings, lists, tables, and code blocks. The system supports extensible image loading, syntax highlighting, and environment-based configuration for flexible integration into iOS, macOS, and other Apple platform apps.
How it got here
2020 — MarkdownUI maintenance and migration
5 changes.
The project entered maintenance mode, shifting focus to the new MarkdownUI component while removing the legacy CommonMarkUI module and its associated test infrastructure. This period involved upgrading to Swift 5.6, integrating external dependencies for rendering and testing, and establishing comprehensive documentation and CI tooling to support the transition.
2021–2022 — Core SwiftUI rendering and theming
9 changes.
This period focused on building the foundational SwiftUI rendering engine for MarkdownUI, introducing native views for block and inline elements alongside a comprehensive, environment-driven theming system. The work established granular control over visual presentation through built-in presets and composable text styles, supported by a demo application and extensive test coverage to validate the new architecture.
2023 — MarkdownUI DSL and parser overhaul
4 changes.
This period focused on a comprehensive overhaul of the MarkdownUI library, introducing a declarative Swift DSL for programmatically composing Markdown content, including blocks, inlines, and tables. The underlying parser was refactored to use swift-cmark with a new AST structure, while the renderer gained configurable soft break handling and improved HTML fidelity. Extensibility was enhanced through new image providers, syntax highlighting protocols, and dark-mode-aware utilities.
Features
Added Xcode scheme for MarkdownUI and cmark-gfm
An Xcode scheme file has been added to configure build, test, launch, and archive actions for the MarkdownUI and cmark-gfm targets, enabling direct development and testing within Xcode.
.swiftpm · high confidence
Introduce declarative DSL for Markdown blocks, inlines, and tables
The MarkdownUI DSL now provides a comprehensive set of Swift types for composing Markdown content programmatically. This change adds block-level elements including Paragraph, Heading, Blockquote, CodeBlock, ThematicBreak, BulletedList, NumberedList, and TaskList, along with their corresponding result builders (MarkdownContentBuilder, ListContentBuilder, TaskListContentBuilder). It also introduces inline elements such as Strong, Emphasis, Strikethrough, Code, InlineLink, InlineImage, LineBreak, and SoftBreak (with a configurable Mode for space vs. line break). Additionally, a new TextTable system is added, featuring TextTable, TextTableColumn, TextTableRow, and their builders, enabling the creation of structured data tables within Markdown content.
Sources/MarkdownUI/DSL · high confidence
Introduce native SwiftUI Markdown rendering view
Added a new \Markdown\ view in \Sources/MarkdownUI/Views\ that renders GitHub Flavored Markdown content natively in SwiftUI. This view supports rich structured text including images, headings, lists, blockquotes, code blocks, tables, and links, and allows customization through built-in themes (like GitHub), text style modifiers, and block style overrides.
Sources/MarkdownUI/Views · high confidence
Introduces a composable text styling system for Markdown themes
The MarkdownUI library now provides a new \TextStyle\ protocol and a suite of built-in style modifiers (such as \FontFamily\, \FontSize\, \FontWeight\, \FontWidth\, \ForegroundColor\, and \BackgroundColor\) that allow users to precisely customize the appearance of text inlines and block quotes. This change introduces a \FontProperties\ model to handle detailed font characteristics—including caps variants, digit variants, and width—and a \TextStyleBuilder\ result builder that enables composing multiple styles together using SwiftUI's standard syntax within \.markdownTextStyle\ modifiers.
Sources/MarkdownUI/Theme/TextStyle · high confidence
New Demo app showcasing MarkdownUI features and extensibility
The repository now includes a complete SwiftUI Demo application that serves as an interactive showcase for MarkdownUI. The app demonstrates core rendering capabilities including headings, lists, tables, quotes, and text styling, along with advanced extensibility patterns such as syntax-highlighted code blocks (using the Splash library), custom image providers for web and asset images, and lazy loading strategies for large content lists. It also provides a 'Dingus' view for live Markdown previewing and a sample fetching a GitHub README to demonstrate heading anchor scrolling and PDF generation via ImageRenderer.
Examples/Demo/Demo · high confidence
New MarkdownUI theme system with built-in presets
The MarkdownUI library now includes a comprehensive theming system that allows users to customize the appearance of Markdown content. This change introduces a new \Theme\ struct and provides three built-in presets: \basic\ (a clean, default style), \docC\ (mimicking Apple's documentation style with specific colors and rounded containers), and \gitHub\ (replicating GitHub's markdown rendering with alternating row colors and specific typography). Users can apply these themes via the \.markdownTheme()\ modifier or create custom themes by chaining style configurations for headings, paragraphs, code blocks, tables, and other elements.
Sources/MarkdownUI/Theme · high confidence
New block-level rendering views and spacing system for MarkdownUI
This change introduces the complete set of SwiftUI views responsible for rendering Markdown block elements, including paragraphs, headings, blockquotes, lists (bulleted, numbered, and task lists), code blocks, thematic breaks, and tables. It establishes a new spacing mechanism via \BlockMargin\ and \BlockMarginsPreference\ that calculates vertical spacing between blocks by taking the maximum of the current block's top margin and the predecessor's bottom margin, ensuring consistent layout. The implementation also adds table-specific infrastructure such as \TableView\, \TableCell\, \TableBounds\, and border/background styling views, along with support for inline image flows within block content.
Sources/MarkdownUI/Views/Blocks · high confidence
New environment-based customization API for Markdown rendering
The MarkdownUI library now exposes a comprehensive set of SwiftUI environment values and view modifiers that allow you to customize how Markdown content is rendered within a view hierarchy. You can now configure the base URL for resolving relative links and images, specify custom providers for loading images (including inline images), and apply syntax highlighting to code blocks. Additionally, the appearance of tables (border and background styles), text styles, soft break behavior, and specific theme elements like list markers and task list checkboxes can be tailored using dedicated modifiers such as \markdownTheme\, \markdownCodeSyntaxHighlighter\, and \markdownImageProvider\. This shift to an environment-driven model provides a more flexible and declarative way to adapt Markdown rendering to your app's design system.
Sources/MarkdownUI/Views/Environment · high confidence
New extensibility utilities and dark-mode-aware image filtering
This update introduces a suite of new utility types and providers within the MarkdownUI library. It adds AssetImageProvider and AssetInlineImageProvider to load images from app or module bundles, and introduces a CodeSyntaxHighlighter protocol with a PlainTextCodeSyntaxHighlighter for code block styling. The default network image loading now relies on the NetworkImage package. Additionally, a new BlockNode+ColorSchemeImage utility enables automatic filtering of images based on the current color scheme (e.g., hiding dark-mode-only images in light mode), and several new modifiers (relativeFrame, relativePadding, relativeLineSpacing) along with the RelativeSize type allow styling dimensions relative to font sizes.
Sources/MarkdownUI/Utility · high confidence
Support for rendering inline and block images in Markdown
Markdown content can now display images, both as standalone block elements and embedded within text. The new \ImageView\ component handles block-level images, supporting relative URLs via a configurable base URL and optional click-to-navigate links. Inline images are rendered within text using a new \InlineText\ view that asynchronously loads images via an \inlineImageProvider\, allowing for customizable image fetching and caching. This enables rich media integration in Markdown UIs without requiring external image handling logic.
Sources/MarkdownUI/Views/Inlines · high confidence
Removals
Removal of CommonMarkUI module
The CommonMarkUI module has been removed from the codebase. This eliminates the previous implementation that provided a basic UI wrapper for CommonMark parsing, effectively removing this component from the product.
Sources/CommonMarkUI · high confidence
Behavioural changes
Enhanced theming API with granular block and list configurations
The MarkdownUI theming system has been expanded to provide more control over block rendering. Code blocks can now be styled using a \CodeBlockConfiguration\ that exposes the language and raw content. List markers support a configurable minimum width via \ListMarkerConfiguration\, allowing for better alignment in nested lists. Additionally, new configuration structs (\BlockConfiguration\, \TableCellConfiguration\, \TaskListMarkerConfiguration\) expose block content and structural details (such as row/column indices and completion status) to the style body, enabling richer custom appearances for tables, task lists, and general blocks.
Sources/MarkdownUI/Theme/BlockStyle · high confidence
Introduce configurable soft break handling and HTML line-break support in inline rendering
The MarkdownUI renderer now supports customizing how soft breaks (line breaks in the source) are rendered via a new \softBreakMode\ configuration, allowing users to choose between inserting a space or a newline. Additionally, HTML \\<br\>\ tags are now explicitly recognized and rendered as line breaks, improving fidelity for HTML content within Markdown. These changes are implemented in the new \AttributedStringInlineRenderer\ and \TextInlineRenderer\ components, which also introduce \InlineTextStyles\ for consistent text styling across inline elements.
Sources/MarkdownUI/Renderer · high confidence
MarkdownUI enters maintenance mode with new documentation and tooling
The project has shifted to maintenance mode, with the README now directing users to Textual for new development. This update includes comprehensive documentation for the Markdown view, theming, and content builders, alongside new configuration files (.spi.yml, .swiftformat, Makefile) to support CI, formatting, and testing across macOS, iOS, tvOS, and watchOS.
(repo-wide) · high confidence
Refactored Markdown parser to use swift-cmark with new AST and rewrite capabilities
The Markdown parser in this location has been replaced with a new implementation based on swift-cmark (replacing the previous embedded cmark-gfm). This introduces a new internal Abstract Syntax Tree (BlockNode and InlineNode) and adds a \renderMarkdown()\ method to convert parsed blocks back to CommonMark. It also includes new \rewrite\ helper methods for BlockNode and InlineNode, enabling structural transformations of the parsed content.
Sources/MarkdownUI/Parser · high confidence
Test coverage
Added comprehensive unit and snapshot tests for MarkdownUI; Removal of legacy XCTest scaffolding files.
Dependencies
Upgrade to Swift 5.6 and introduce external dependencies for Markdown rendering
The package now requires Swift 5.6 and specifies minimum platform versions (macOS 12, iOS/tvOS/macCatalyst 15, watchOS 8). It introduces three key dependencies: \swift-cmark\ (v0.4.0+) for CommonMark parsing, \NetworkImage\ (v6.0.0+) for loading remote images, and \swift-snapshot-testing\ (v1.10.0+) for UI testing. The package has been renamed to \swift-markdown-ui\ with the main library target \MarkdownUI\, replacing the previous \CommonMarkUI\ structure.
(dependencies) · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 56 → 59 (+3.2)
- Rubric changed (rubric-2026.09.11 → rubric-2026.09.18) — scores are not directly comparable.
Lenses
- Code Health 99 → 96 (-2.5)
- Architecture 100 → 100 (+0.0)
- Maturity 49 → 49 (+0.0)
- Readiness 38 → 45 (+7.3)
- Security 90 → 90 (+0.0)
Resolved (3)
- Documentation: no installation or build instructions (README.md)
- Documentation: no usage examples (README.md)
- Duplicated block (15 lines × 3) (Sources/MarkdownUI/DSL/Inlines/Emphasis.swift)
New (12)
- Coverage not measured — Swift suite
- Duplicated block (8 lines × 2) (Sources/MarkdownUI/Views/Blocks/BulletedListView.swift)
- Duplicated block (8 lines × 2) (Sources/MarkdownUI/Views/Blocks/ListItemView.swift)
- Inconsistent method signature pattern for marker customization. The taskListMarker method has an overload taking a BlockStyle directly and another taking a body closure. Other similar methods like bulletedListMarker and numberedListMarker follow the same pattern, but the naming convention for the closure parameter (configuration) is consistent, whereas the direct BlockStyle overload lacks a descriptive label, making it less discoverable than the closure-based approach.
- Inconsistent parameter naming and typing for heading customization methods. The body closure parameter is named configuration in one overload and label in others, despite the types (BlockConfiguration vs Label) being distinct. This creates confusion about which type is expected and breaks the mental model of a unified API surface.
- Outdated: networkimage
- Outdated: swift-cmark
- Outdated: swift-snapshot-testing
- UnsafeNode.make (cognitive 18) (Sources/MarkdownUI/Parser/MarkdownParser.swift)
- UnsafeNode.make (cognitive 32) (Sources/MarkdownUI/Parser/MarkdownParser.swift)
- UnsafeNode.make (cyclomatic 20) (Sources/MarkdownUI/Parser/MarkdownParser.swift)
- UnsafeNode.make (cyclomatic 27) (Sources/MarkdownUI/Parser/MarkdownParser.swift)
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
gonzalezreal/swift-markdown-ui was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 30 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 8371aeb32f35795a9e559029fb08613355733626 — the exact code this score is about.
- Scored under rubric-2026.09.18 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-cb25ca4feafa.