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

Document

mattt edited this page Jan 22, 2020 · 13 revisions

Document

A CommonMark document.

public final class Document

Inheritance

CustomStringConvertible, CustomReflectable


Nested Types


Initializers

init(_:options:)

Creates a document from a CommonMark string.

public init(_ commonmark: String, options: ParsingOptions = []) throws
  • Parameter commonmark: A CommonMark string.

Parameters

  • Document.Error.invalid if a document couldn't be constructed with the provided source.

Properties

children

The children of the document.

var children: [Node]

description

var description: String

customMirror

var customMirror: Mirror

Methods

render(format:options:width:)

Render a document into a given format with the specified options.

public func render(format: RenderingFormat, options: RenderingOptions = [], width: Int = 0) -> String

Parameters

  • format: The rendering format
  • options: The rendering options
  • width: The column width used to wrap lines for rendered output (.commonmark, .man, and .latex formats only). Must be a positive number. Pass 0 to prevent line wrapping.

Returns

The rendered text.

Clone this wiki locally