[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-6928":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":19,"rankGlobal":10,"rankLanguage":10,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":23,"hasPages":21,"topics":24,"createdAt":10,"pushedAt":10,"updatedAt":31,"readmeContent":32,"aiSummary":33,"trendingCount":16,"starSnapshotCount":16,"syncStatus":34,"lastSyncTime":35,"discoverSource":36},6928,"swift-markdown-ui","gonzalezreal\u002Fswift-markdown-ui","gonzalezreal","Maintenance mode — new development in Textual: https:\u002F\u002Fgithub.com\u002Fgonzalezreal\u002Ftextual","",null,"Swift",3868,546,24,38,0,7,40,67.71,"MIT License",false,"main",true,[25,26,27,28,29,30],"cmark","commonmark","github-markdown","markdown","swift","swiftui","2026-06-12 04:00:31","> [!NOTE]\n> MarkdownUI is in maintenance mode.\n> \n> New development is happening in [Textual](https:\u002F\u002Fgithub.com\u002Fgonzalezreal\u002Ftextual),\n> a SwiftUI-native text rendering engine that evolved from the ideas and lessons\n> learned in MarkdownUI.\n>\n> For more context, see the announcement here:\n> https:\u002F\u002Fgithub.com\u002Fgonzalezreal\u002Fswift-markdown-ui\u002Fdiscussions\u002F437\n\n# MarkdownUI\n[![CI](https:\u002F\u002Fgithub.com\u002Fgonzalezreal\u002FMarkdownUI\u002Fworkflows\u002FCI\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Fgonzalezreal\u002FMarkdownUI\u002Factions?query=workflow%3ACI)\n[![](https:\u002F\u002Fimg.shields.io\u002Fendpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fgonzalezreal%2Fswift-markdown-ui%2Fbadge%3Ftype%3Dswift-versions)](https:\u002F\u002Fswiftpackageindex.com\u002Fgonzalezreal\u002Fswift-markdown-ui)\n[![](https:\u002F\u002Fimg.shields.io\u002Fendpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fgonzalezreal%2Fswift-markdown-ui%2Fbadge%3Ftype%3Dplatforms)](https:\u002F\u002Fswiftpackageindex.com\u002Fgonzalezreal\u002Fswift-markdown-ui)\n\nDisplay and customize Markdown text in SwiftUI.\n\n* [Overview](#overview)\n* [Minimum requirements](#minimum-requirements)\n* [Getting started](#getting-started)\n  * [Creating a Markdown view](#creating-a-markdown-view)\n  * [Styling Markdown](#styling-markdown)\n* [Documentation](#documentation)\n  * [Related content](#related-content)\n* [Demo](#demo)\n* [Installation](#installation)\n\n## Overview\n\nMarkdownUI is a powerful library for displaying and customizing Markdown text in SwiftUI. It is\ncompatible with the [GitHub Flavored Markdown Spec](https:\u002F\u002Fgithub.github.com\u002Fgfm\u002F) and can\ndisplay images, headings, lists (including task lists), blockquotes, code blocks, tables,\nand thematic breaks, besides styled text and links.\n\nMarkdownUI offers comprehensible theming features to customize how it displays Markdown text.\nYou can use the built-in themes, create your own or override specific text and block styles.\n\n![](Sources\u002FMarkdownUI\u002FDocumentation.docc\u002FResources\u002FMarkdownUI@2x.png#gh-light-mode-only)\n![](Sources\u002FMarkdownUI\u002FDocumentation.docc\u002FResources\u002FMarkdownUI~dark@2x.png#gh-dark-mode-only)\n\n## Minimum requirements\n\nYou can use MarkdownUI on the following platforms:\n\n- macOS 12.0+\n- iOS 15.0+\n- tvOS 15.0+\n- watchOS 8.0+\n\nSome features, like displaying tables or multi-image paragraphs, require macOS 13.0+, iOS 16.0+,\ntvOS 16.0+, and watchOS 9.0+.\n\n## Getting started\n\n### Creating a Markdown view\n\nA `Markdown` view displays rich structured text using the Markdown syntax. It can display images,\nheadings, lists (including task lists), blockquotes, code blocks, tables, and thematic breaks,\nbesides styled text and links.\n\nThe simplest way of creating a `Markdown` view is to pass a Markdown string to the\n`init(_:baseURL:imageBaseURL:)` initializer.\n\n```swift\nlet markdownString = \"\"\"\n  ## Try MarkdownUI\n\n  **MarkdownUI** is a native Markdown renderer for SwiftUI\n  compatible with the\n  [GitHub Flavored Markdown Spec](https:\u002F\u002Fgithub.github.com\u002Fgfm\u002F).\n  \"\"\"\n\nvar body: some View {\n  Markdown(markdownString)\n}\n```\n\n![](Sources\u002FMarkdownUI\u002FDocumentation.docc\u002FResources\u002FMarkdownString@2x.png#gh-light-mode-only)\n![](Sources\u002FMarkdownUI\u002FDocumentation.docc\u002FResources\u002FMarkdownString~dark@2x.png#gh-dark-mode-only)\n\nA more convenient way to create a `Markdown` view is by using the\n`init(baseURL:imageBaseURL:content:)` initializer, which takes a Markdown content\nbuilder in which you can compose the view content, either by providing Markdown strings or by\nusing an expressive domain-specific language.\n\n```swift\nvar body: some View {\n  Markdown {\n    \"\"\"\n    ## Using a Markdown Content Builder\n    Use Markdown strings or an expressive domain-specific language\n    to build the content.\n    \"\"\"\n    Heading(.level2) {\n      \"Try MarkdownUI\"\n    }\n    Paragraph {\n      Strong(\"MarkdownUI\")\n      \" is a native Markdown renderer for SwiftUI\"\n      \" compatible with the \"\n      InlineLink(\n        \"GitHub Flavored Markdown Spec\",\n        destination: URL(string: \"https:\u002F\u002Fgithub.github.com\u002Fgfm\u002F\")!\n      )\n      \".\"\n    }\n  }\n}\n```\n\n![](Sources\u002FMarkdownUI\u002FDocumentation.docc\u002FResources\u002FMarkdownContentBuilder@2x.png#gh-light-mode-only)\n![](Sources\u002FMarkdownUI\u002FDocumentation.docc\u002FResources\u002FMarkdownContentBuilder~dark@2x.png#gh-dark-mode-only)\n\nYou can also create a `MarkdownContent` value in your model layer and later create a `Markdown`\nview by passing the content value to the `init(_:baseURL:imageBaseURL:)` initializer. The\n`MarkdownContent` value pre-parses the Markdown string preventing the view from doing this step.\n\n```swift\n\u002F\u002F Somewhere in the model layer\nlet content = MarkdownContent(\"You can try **CommonMark** [here](https:\u002F\u002Fspec.commonmark.org\u002Fdingus\u002F).\")\n\n\u002F\u002F Later in the view layer\nvar body: some View {\n  Markdown(self.model.content)\n}\n```\n\n### Styling Markdown\n\nMarkdown views use a basic default theme to display the contents. For more information, read about\nthe `basic` theme.\n\n```swift\nMarkdown {\n  \"\"\"\n  You can quote text with a `>`.\n\n  > Outside of a dog, a book is man's best friend. Inside of a\n  > dog it's too dark to read.\n\n  – Groucho Marx\n  \"\"\"\n}\n```\n\n![](Sources\u002FMarkdownUI\u002FDocumentation.docc\u002FResources\u002FBlockquoteContent@2x.png#gh-light-mode-only)\n![](Sources\u002FMarkdownUI\u002FDocumentation.docc\u002FResources\u002FBlockquoteContent~dark@2x.png#gh-dark-mode-only)\n\nYou can customize the appearance of Markdown content by applying different themes using the\n`markdownTheme(_:)` modifier. For example, you can apply one of the built-in themes, like\n`gitHub`, to either a Markdown view or a view hierarchy that contains Markdown views.\n\n```swift\nMarkdown {\n  \"\"\"\n  You can quote text with a `>`.\n\n  > Outside of a dog, a book is man's best friend. Inside of a\n  > dog it's too dark to read.\n\n  – Groucho Marx\n  \"\"\"\n}\n.markdownTheme(.gitHub)\n```\n\n![](Sources\u002FMarkdownUI\u002FDocumentation.docc\u002FResources\u002FGitHubBlockquote@2x.png#gh-light-mode-only)\n![](Sources\u002FMarkdownUI\u002FDocumentation.docc\u002FResources\u002FGitHubBlockquote~dark@2x.png#gh-dark-mode-only)\n\nTo override a specific text style from the current theme, use the `markdownTextStyle(_:textStyle:)`\nmodifier. The following example shows how to override the `code` text style.\n\n```swift\nMarkdown {\n  \"\"\"\n  Use `git status` to list all new or modified files\n  that haven't yet been committed.\n  \"\"\"\n}\n.markdownTextStyle(\\.code) {\n  FontFamilyVariant(.monospaced)\n  FontSize(.em(0.85))\n  ForegroundColor(.purple)\n  BackgroundColor(.purple.opacity(0.25))\n}\n```\n\n![](Sources\u002FMarkdownUI\u002FDocumentation.docc\u002FResources\u002FCustomInlineCode@2x.png#gh-light-mode-only)\n![](Sources\u002FMarkdownUI\u002FDocumentation.docc\u002FResources\u002FCustomInlineCode~dark@2x.png#gh-dark-mode-only)\n\nYou can also use the `markdownBlockStyle(_:body:)` modifier to override a specific block style. For\nexample, you can override only the `blockquote` block style, leaving other block styles untouched.\n\n```swift\nMarkdown {\n  \"\"\"\n  You can quote text with a `>`.\n\n  > Outside of a dog, a book is man's best friend. Inside of a\n  > dog it's too dark to read.\n\n  – Groucho Marx\n  \"\"\"\n}\n.markdownBlockStyle(\\.blockquote) { configuration in\n  configuration.label\n    .padding()\n    .markdownTextStyle {\n      FontCapsVariant(.lowercaseSmallCaps)\n      FontWeight(.semibold)\n      BackgroundColor(nil)\n    }\n    .overlay(alignment: .leading) {\n      Rectangle()\n        .fill(Color.teal)\n        .frame(width: 4)\n    }\n    .background(Color.teal.opacity(0.5))\n}\n```\n\n![](Sources\u002FMarkdownUI\u002FDocumentation.docc\u002FResources\u002FCustomBlockquote@2x.png#gh-light-mode-only)\n![](Sources\u002FMarkdownUI\u002FDocumentation.docc\u002FResources\u002FCustomBlockquote~dark@2x.png#gh-dark-mode-only)\n\nAnother way to customize the appearance of Markdown content is to create your own theme. To create\na theme, start by instantiating an empty `Theme` and chain together the different text and block\nstyles in a single expression.\n\n```swift\nextension Theme {\n  static let fancy = Theme()\n    .code {\n      FontFamilyVariant(.monospaced)\n      FontSize(.em(0.85))\n    }\n    .link {\n      ForegroundColor(.purple)\n    }\n    \u002F\u002F More text styles...\n    .paragraph { configuration in\n      configuration.label\n        .relativeLineSpacing(.em(0.25))\n        .markdownMargin(top: 0, bottom: 16)\n    }\n    .listItem { configuration in\n      configuration.label\n        .markdownMargin(top: .em(0.25))\n    }\n    \u002F\u002F More block styles...\n}\n```\n\n## Documentation\n\n[Swift Package Index](https:\u002F\u002Fswiftpackageindex.com) kindly hosts the online documentation for all versions, available here:\n\n- [main](https:\u002F\u002Fswiftpackageindex.com\u002Fgonzalezreal\u002Fswift-markdown-ui\u002Fmain\u002Fdocumentation\u002Fmarkdownui)\n- [2.1.0](https:\u002F\u002Fswiftpackageindex.com\u002Fgonzalezreal\u002Fswift-markdown-ui\u002F2.1.0\u002Fdocumentation\u002Fmarkdownui)\n- [2.0.2](https:\u002F\u002Fswiftpackageindex.com\u002Fgonzalezreal\u002Fswift-markdown-ui\u002F2.0.2\u002Fdocumentation\u002Fmarkdownui)\n\n### Related content\n\nYou can learn more about MarkdownUI by referring to the following articles and third-party resources:\n\n- [Better Markdown Rendering in SwiftUI](https:\u002F\u002Fgonzalezreal.github.io\u002F2023\u002F02\u002F18\u002Fbetter-markdown-rendering-in-swiftui.html)\n- [Unlock the Power of Markdown in SwiftUI with THIS Hack!](https:\u002F\u002Fyoutu.be\u002FgVy06iJQFWQ) by [@Rebeloper](https:\u002F\u002Ftwitter.com\u002FRebeloper)\n\n## Demo\n\nMarkdownUI comes with a few more tricks on the sleeve. You can explore the\n[companion demo project](Examples\u002FDemo\u002F) and discover its complete set of capabilities.\n\n![](Examples\u002FDemo\u002FScreenshot.png#gh-light-mode-only)\n![](Examples\u002FDemo\u002FScreenshot~dark.png#gh-dark-mode-only)\n\n## Installation\n### Adding MarkdownUI to a Swift package\n\nTo use MarkdownUI in a Swift Package Manager project, add the following line to the dependencies in your `Package.swift` file:\n\n```swift\n.package(url: \"https:\u002F\u002Fgithub.com\u002Fgonzalezreal\u002Fswift-markdown-ui\", from: \"2.0.2\")\n```\n\nInclude `\"MarkdownUI\"` as a dependency for your executable target:\n\n```swift\n.target(name: \"\u003Ctarget>\", dependencies: [\n  .product(name: \"MarkdownUI\", package: \"swift-markdown-ui\")\n]),\n```\n\nFinally, add `import MarkdownUI` to your source code.\n\n### Adding MarkdownUI to an Xcode project\n\n1. From the **File** menu, select **Add Packages…**\n1. Enter `https:\u002F\u002Fgithub.com\u002Fgonzalezreal\u002Fswift-markdown-ui` into the\n   *Search or Enter Package URL* search field\n1. Link **MarkdownUI** to your application target\n","MarkdownUI 是一个用于在 SwiftUI 中显示和自定义 Markdown 文本的强大库。它支持 GitHub Flavored Markdown 规范，能够渲染包括图片、标题、列表（含任务列表）、引用块、代码块、表格和主题分割线等在内的多种 Markdown 元素，并提供了丰富的主题定制功能，允许用户使用内置主题或自定义样式。该项目适用于需要在 macOS 12.0+、iOS 15.0+、tvOS 15.0+ 或 watchOS 8.0+ 平台上展示富文本内容的应用场景，尤其是那些希望以高度可定制的方式呈现文档或文章的开发者。目前，MarkdownUI 已进入维护模式，新的开发工作正在 Textual 项目中进行。",2,"2026-06-11 03:09:37","top_language"]