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

Heading

mattt edited this page Jan 14, 2021 · 11 revisions

Heading

A heading.

public final class Heading: Node

From the CommonMark Spec:

An ATX heading consists of a string of characters, parsed as inline content, between an opening sequence of 1–6 unescaped # characters and an optional closing sequence of any number of unescaped # characters. The opening sequence of # characters must be followed by a space or by the end of line. The optional closing sequence of #s must be preceded by a space and may be followed by spaces only. The opening # character may be indented 0-3 spaces. The raw contents of the heading are stripped of leading and trailing spaces before being parsed as inline content. The heading level is equal to the number of # characters in the opening sequence.

A setext heading consists of one or more lines of text, each containing at least one non-whitespace character, with no more than 3 spaces indentation, followed by a setext heading underline. The lines of text must be such that, were they not followed by the setext heading underline, they would be interpreted as a paragraph: they cannot be interpretable as a code fence, ATX heading, block quote, thematic break, list item, or HTML block.

Inheritance

Node, Visitable

Initializers

init(level:text:)

public convenience init(level: Int, text string: String)

init(level:children:)

public convenience init(level: Int, children: [Inline & Node] = [])

init(level:_:)

public convenience init(level: Int = 1, _ closure: () -> String)

init(level:_:)

public convenience init(level: Int = 1, _ builder: () -> InlineConvertible)

Properties

level

var level: Int

Methods

accept(visitor:)

public func accept<T: Visitor>(visitor: T)
Clone this wiki locally