Skip to content

Rename main.swift to MarkdownCommand.swift and add @main #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
// swift-tools-version:5.3
// In order to support users running on the latest Xcodes, please ensure that
// [email protected] is kept in sync with this file.
// swift-tools-version:5.5
Copy link
Contributor Author

@Kyle-Ye Kyle-Ye Jul 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is safe for us to bump to use Swift 5.5 now. (Released on SEPTEMBER 20, 2021)

/*
This source file is part of the Swift.org open source project

Copyright (c) 2021 Apple Inc. and the Swift project authors
Copyright (c) 2021-2023 Apple Inc. and the Swift project authors
Licensed under Apache License v2.0 with Runtime Library Exception

See https://swift.org/LICENSE.txt for license information
Expand Down Expand Up @@ -51,9 +49,16 @@ let package = Package(
if ProcessInfo.processInfo.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
// Building standalone, so fetch all dependencies remotely.
package.dependencies += [
.package(url: "https://github.com/apple/swift-cmark.git", .branch("gfm")),
.package(url: "https://github.com/apple/swift-argument-parser", .upToNextMinor(from: "1.0.1")),
.package(url: "https://github.com/apple/swift-cmark.git", branch: "gfm"),
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.2.2"),
]

// SwiftPM command plugins are only supported by Swift version 5.6 and later.
#if swift(>=5.6)
package.dependencies += [
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.1.0"),
]
#endif
} else {
// Building in the Swift.org CI system, so rely on local versions of dependencies.
package.dependencies += [
Expand Down
70 changes: 0 additions & 70 deletions [email protected]

This file was deleted.

11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,18 @@ The markup tree provided by this package is comprised of immutable/persistent, t
In your `Package.swift` Swift Package Manager manifest, add the following dependency to your `dependencies` argument:

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

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

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

To parse a document, use `Document(parsing:)`, supplying a `String` or `URL`:
Expand Down Expand Up @@ -61,4 +66,4 @@ Swift Markdown can be improved to better meet your needs.

Please see the [contributing guide](https://swift.org/contributing/#contributing-code) for more information.

<!-- Copyright (c) 2021-2022 Apple Inc and the Swift Project authors. All Rights Reserved. -->
<!-- Copyright (c) 2021-2023 Apple Inc and the Swift Project authors. All Rights Reserved. -->
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import ArgumentParser
import Foundation
import Markdown

@main
struct MarkdownCommand: ParsableCommand {
enum Error: LocalizedError {
case couldntDecodeInputAsUTF8
Expand Down Expand Up @@ -50,5 +51,3 @@ struct MarkdownCommand: ParsableCommand {
return (stdinString, Document(parsing: stdinString, options: options))
}
}

MarkdownCommand.main()