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

What's New

Swift 5.10 Release


What's Changed

  • track inner indentation for doxygen commands by @QuietMisdreavus in #118
  • Fix crash parsing document tree dump as markdown content by @d-ronnqvist in #123
  • Refactored the lex function in the BlockDirectiveParser file. by @Mayank-84 in #128
  • fix: fix to issue #132 (implementation of child(through) by @georgemp in #133
  • Remove a expired link from README.md by @Ryu0118 in #138
  • Fix typo in markdown-tool validation error by @Samasaur1 in #104
  • Rename main.swift to MarkdownCommand.swift and add @main by @Kyle-Ye in #10
  • consider queued newlines when wrapping elements in MarkupFormatter by @QuietMisdreavus in #116
  • [5.10] Add link title support for commonmark by @Kyle-Ye in #147
  • [5.10] Fix multiline directive without content parsing range issue by @Kyle-Ye in #157
  • [5.10] Fix multi line symbol link source range issue by @Kyle-Ye in #156

New Contributors

Full Changelog: swift-5.9.2-RELEASE...swift-5.10-RELEASE

Swift Markdown

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

The parser is powered by GitHub-flavored Markdown's cmark-gfm implementation, so it follows the spec closely. As the needs of the community change, the effective dialect implemented by this library may change.

The markup tree provided by this package is comprised of immutable/persistent, thread-safe, copy-on-write value types that only copy substructure that has changed. Other examples of the main strategy behind this library can be seen in SwiftSyntax.

Getting Started Using Markup

In your Package.swift Swift Package Manager manifest, add the following dependency to your dependencies argument:

.package(url: "https://github.com/apple/swift-markdown.git", branch: "main"),

Add the dependency to any targets you've declared in your manifest:

    name: "MyTarget", 
    dependencies: [
        .product(name: "Markdown", package: "swift-markdown"),

To parse a document, use Document(parsing:), supplying a String or URL:

import Markdown

let source = "This is a markup *document*."
let document = Document(parsing: source)
// Document
// └─ Paragraph
//    ├─ Text "This is a markup "
//    ├─ Emphasis
//    │  └─ Text "document"
//    └─ Text "."

Please see Swift Markdown's documentation site for more detailed information about the library.

Getting Involved

Submitting a Bug Report

Swift Markdown tracks all bug reports with GitHub Issues. You can use the "Swift-Markdown" component for issues and feature requests specific to Swift Markdown. When you submit a bug report we ask that you follow the Swift Bug Reporting guidelines and provide as many details as possible.

Submitting a Feature Request

For feature requests, please feel free to file a GitHub issue or start a discussion on the Swift Forums.

Don't hesitate to submit a feature request if you see a way Swift Markdown can be improved to better meet your needs.

Contributing to Swift Markdown

Please see the contributing guide for more information.


  • Swift Tools 5.5.0
View More Packages from this Author


Last updated: Fri Apr 19 2024 12:42:10 GMT-0900 (Hawaii-Aleutian Daylight Time)