Skip to content
This repository has been archived by the owner on Oct 17, 2021. It is now read-only.

Documentation

mattt edited this page Mar 5, 2021 · 12 revisions

Documentation

Documentation for a Swift declaration.

public struct Documentation: Hashable, Codable

Inheritance

Codable, Hashable

Properties

summary

The summary.

var summary: Paragraph?

discussionParts

The text segments and callouts that comprise the discussion, if any.

var discussionParts: [DiscussionPart] = []

parameters

The documented parameters.

var parameters: [Parameter] = []

returns

The documented return value.

var returns: Document?

`throws`

The documented error throwing behavior.

var `throws`: Document?

isEmpty

Whether the documentation has any content.

var isEmpty: Bool

Documentation is considered empty if all of the following criteria are met:

  • Its summary property is nil

  • Its returns property is nil

  • Its throws property is nil

  • Its discussionParts property is empty

  • Its parameters property is empty

Methods

parse(_:)

Create and return documentation from Swift Markup text.

public static func parse(_ text: String?) throws -> Documentation
  • Parameters

    • text: The documentation text in Swift Markup (CommonMark) format.

Throws

  • CommonMark.Document.Error if the provided text can't be parsed.

Returns

A structured representation of the documentation.