SwiftDocOrg / CommonMark

Create, parse, and render Markdown text according to the CommonMark specification
MIT License
179 stars 10 forks source link

Update to Swift 5.4 and @resultBuilder #25

Closed mattt closed 3 years ago

mattt commented 3 years ago

Pending availability of official Swift 5.4 docker image and Xcode in macOS virtual environment.

Here's a preview of coming attractions:

let urlString: String? = "https://www.un.org/en/universal-declaration-human-rights/"

let articles: [String] = [
    """
    All human beings are born free and equal in dignity and rights.
    They are endowed with reason and conscience
    and should act towards one another in a spirit of brotherhood.
    """
]

let document = Document {
    Heading {
        if let urlString = urlString {
            Link(urlString: urlString, title: "View full version") {
                "Universal Declaration of Human Rights"
            }
        }
    }

    for (number, body) in zip(1..., articles) {
        Section {
            Heading { "Article \(number)." }
            body
        }
    }
}

This PR will likely correspond to a new major version (1.0.0) because it removes the CommonMarkBuilder module and significantly changes a few APIs.