Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/SwiftDocOrg/SwiftMarkup
Parses Swift documentation comments into structured entities
https://github.com/SwiftDocOrg/SwiftMarkup
commonmark documentation swift swift-markup
Last synced: 3 months ago
JSON representation
Parses Swift documentation comments into structured entities
- Host: GitHub
- URL: https://github.com/SwiftDocOrg/SwiftMarkup
- Owner: SwiftDocOrg
- License: mit
- Archived: true
- Created: 2020-01-22T19:10:23.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-06-10T10:50:30.000Z (over 3 years ago)
- Last Synced: 2024-07-14T07:41:42.828Z (4 months ago)
- Topics: commonmark, documentation, swift, swift-markup
- Language: Swift
- Homepage:
- Size: 94.7 KB
- Stars: 56
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: Changelog.md
- License: LICENSE.md
Awesome Lists containing this project
README
# SwiftMarkup
![CI][ci badge]
[![Documentation][documentation badge]][documentation]SwiftMarkup parses [Swift Markup][swift markup] from documentation comments
into structured documentation entities.```swift
import SwiftMarkuplet markdown = #"""
Creates a new bicycle with the provided parts and specifications.- Remark: Satisfaction guaranteed!
The word *bicycle* first appeared in English print in 1868
to describe "Bysicles and trysicles" on the
"Champs Elysées and Bois de Boulogne".- Parameters:
- style: The style of the bicycle
- gearing: The gearing of the bicycle
- handlebar: The handlebar of the bicycle
- frameSize: The frame size of the bicycle, in centimeters- Returns: A beautiful, brand-new bicycle,
custom-built just for you.
"""#
let documentation = try Documentation.parse(markdown)documentation.summary?.description // "Creates a new bicycle with the provided parts and specifications."
documentation.discussionParts.count // 2
if case .callout(let remark) = documentation.discussionParts[0] {
_ = remark.content // "Satisfaction guaranteed\\!"
}if case .paragraph(let paragraph) = documentation.discussionParts[1] {
_ = paragraph.description // "The word *bicycle* first appeared in English print in 1868 [ ... ]"
}documentation.parameters[0].name // "style"
documentation.parameters[0]?.content.description // "The style of the bicycle"documentation.returns?.description // A beautiful, brand-new bicycle, custom-built just for you.
```This package is used by [swift-doc][swiftdoc]
in coordination with [CommonMark][commonmark] and [SwiftSemantics][swiftsemantics]
to generate documentation for Swift projects.## Requirements
- Swift 5.2+
## Installation
### Swift Package Manager
Add the SwiftMarkup package to your target dependencies in `Package.swift`:
```swift
import PackageDescriptionlet package = Package(
name: "YourProject",
dependencies: [
.package(
url: "https://github.com/SwiftDocOrg/SwiftMarkup",
from: "0.3.0"
),
]
)
```Then run the `swift build` command to build your project.
## License
MIT
## Contact
Mattt ([@mattt](https://twitter.com/mattt))
[swiftdoc]: https://github.com/SwiftDocOrg/swift-doc
[commonmark]: https://github.com/SwiftDocOrg/CommonMark
[swiftsemantics]: https://github.com/SwiftDocOrg/SwiftSemantics
[swift markup]: https://developer.apple.com/library/archive/documentation/Xcode/Reference/xcode_markup_formatting_ref/MarkupSyntax.html#//apple_ref/doc/uid/TP40016497-CH105-SW1
[ci badge]: https://github.com/SwiftDocOrg/SwiftMarkup/workflows/CI/badge.svg
[documentation badge]: https://github.com/SwiftDocOrg/SwiftMarkup/workflows/Documentation/badge.svg
[documentation]: https://github.com/SwiftDocOrg/SwiftMarkup/wiki