-
Notifications
You must be signed in to change notification settings - Fork 10
List
A list.
public final class List: Node
From 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: Sequence
public convenience init<Values>(of values: Values, delimiter: Delimiter = .none, tight: Bool = true, _ closure: (Values.Element) -> String) where Values: Sequence
var kind: Kind
var delimiter: Delimiter
Whether the list is loose.
var loose: Bool
From 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: Bool
The 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)
Generated at 2021-03-03T19:19:22+0000 using swift-doc 1.0.0-beta.5.
Types
- BlockQuote
- Code
- CodeBlock
- CommonMarkBuilder
- Document
- Document.Error
- Document.ParsingOptions
- Document.Position
- Emphasis
- ForEach
- Fragment
- HTMLBlock
- HardLineBreak
- Heading
- Image
- Link
- List
- List.Delimiter
- List.Item
- List.Kind
- Node
- Node.RenderingFormat
- Node.RenderingOptions
- Paragraph
- RawHTML
- Section
- SoftLineBreak
- StringBuilder
- Strong
- Text
- ThematicBreak
- VisitorContinueKind