Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/swiftlang/swift-markdown
A Swift package for parsing, building, editing, and analyzing Markdown documents.
https://github.com/swiftlang/swift-markdown
Last synced: about 1 month ago
JSON representation
A Swift package for parsing, building, editing, and analyzing Markdown documents.
- Host: GitHub
- URL: https://github.com/swiftlang/swift-markdown
- Owner: swiftlang
- License: apache-2.0
- Created: 2021-07-19T16:42:24.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-09-26T10:19:12.000Z (about 2 months ago)
- Last Synced: 2024-09-26T23:20:14.367Z (about 1 month ago)
- Language: Swift
- Homepage: https://swiftpackageindex.com/swiftlang/swift-markdown/documentation/markdown
- Size: 1.78 MB
- Stars: 2,746
- Watchers: 129
- Forks: 181
- Open Issues: 39
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# 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](https://github.com/github/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](https://github.com/swiftlang/swift-syntax).
## Getting Started Using Markup
In your `Package.swift` Swift Package Manager manifest, add the following dependency to your `dependencies` argument:
```swift
.package(url: "https://github.com/swiftlang/swift-markdown.git", branch: "main"),
```Add the dependency to any targets you've declared in your manifest:
```swift
.target(
name: "MyTarget",
dependencies: [
.product(name: "Markdown", package: "swift-markdown"),
]
),
```To parse a document, use `Document(parsing:)`, supplying a `String` or `URL`:
```swift
import Markdownlet source = "This is a markup *document*."
let document = Document(parsing: source)
print(document.debugDescription())
// Document
// └─ Paragraph
// ├─ Text "This is a markup "
// ├─ Emphasis
// │ └─ Text "document"
// └─ Text "."
```Please see Swift `Markdown`'s [documentation site](https://swiftlang.github.io/swift-markdown/documentation/markdown/)
for more detailed information about the library.## Contributing to Swift Markdown
Please see the [contributing guide](https://swift.org/contributing/#contributing-code) for more information.
### Submitting a Bug Report
Swift Markdown tracks all bug reports with [GitHub Issues](https://github.com/swiftlang/swift-markdown/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](https://swift.org/contributing/#reporting-bugs) guidelines
and provide as many details as possible.### Submitting a Feature Request
For feature requests, please feel free to file a [GitHub issue](https://github.com/swiftlang/swift-markdown/issues/new)
or start a discussion on the [Swift Forums](https://forums.swift.org/c/development/swift-docc).Don't hesitate to submit a feature request if you see a way
Swift Markdown can be improved to better meet your needs.