List - SwiftDocOrg/CommonMark GitHub Wiki
A list.
public final class List: NodeFrom the CommonMark Spec:
A list is a sequence of one or more list items of the same type. The list items may be separated by any number of blank lines.
A list marker is a bullet list marker or an ordered list marker.
An ordered list marker is a sequence of 1–9 arabic digits (0-9), followed by either a . character or a ) character. (The reason for the length limit is that with 10 digits we start seeing integer overflows in some browsers.)
public convenience init(delimiter: Delimiter = .none, children: [List.Item] = [])public convenience init(delimiter: Delimiter = .none, tight: Bool = true, _ builder: () -> ListItemConvertible)public convenience init<Values>(of values: Values, delimiter: Delimiter = .none, tight: Bool = true, _ builder: (Values.Element) -> ListItemConvertible) where Values: Sequencepublic convenience init<Values>(of values: Values, delimiter: Delimiter = .none, tight: Bool = true, _ closure: (Values.Element) -> String) where Values: Sequencevar kind: Kindvar delimiter: DelimiterWhether the list is loose.
var loose: BoolFrom the CommonMark Spec:
A list is loose if any of its constituent list items are separated by blank lines, or if any of its constituent list items directly contain two block-level elements with a blank line between them. Otherwise a list is tight.
Whether the list is tight.
var tight: BoolThe list's items.
var children: [Item]Adds an item to the beginning of the list.
@discardableResult public func prepend(child: Item) -> Bool- child: The item to add.
true if successful, otherwise false.
Adds an to the end of the list.
@discardableResult public func append(child: Item) -> Bool- child: The item to add.
true if successful, otherwise false.
Inserts an item to the list before a specified sibling.
@discardableResult public func insert(child: Item, before sibling: Item) -> Bool- child: The item to add.
- sibling: The item before which the new item is added
true if successful, otherwise false.
Inserts an item to the list after a specified sibling.
@discardableResult public func insert(child: Item, after sibling: Item) -> Bool- child: The item to add.
- sibling: The item after which the new item is added
true if successful, otherwise false.
Replaces an item with the specified node.
@discardableResult public func replace(child: Item, with replacement: Item) -> Bool- child: The item to replace.
- replacement: The item to replace the existing item.
true if successful, otherwise false.
Removes an item from the list.
@discardableResult public func remove(child: Item) -> Bool- child: The item to remove.
true if successful, otherwise false.
Removes and returns the list's items.
@discardableResult public func removeChildren() -> [Item]An array of list items.
public func accept<T: Visitor>(visitor: T)