Skip to content
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

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

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 11 additions & 6 deletions Package.swift
@@ -1,10 +1,8 @@
// swift-tools-version:5.3
// In order to support users running on the latest Xcodes, please ensure that
// Package@swift-5.5.swift is kept in sync with this file.
// swift-tools-version:5.5
Copy link
Collaborator 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 Package@swift-5.5.swift

This file was deleted.

11 changes: 8 additions & 3 deletions README.md
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. -->
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()