Documentation

TableOfContents extends ListBlock
in package

Block-level element

Tags
deprecated

This class has moved to the Node sub-namespace; use that instead

Table of Contents

TYPE_BULLET  = 'bullet'
TYPE_ORDERED  = 'ordered'
TYPE_UNORDERED  = self::TYPE_BULLET
$data  : array<string, mixed>
Used for storage of arbitrary data.
$depth  : int
$endLine  : int
$firstChild  : Node|null
$lastChild  : Node|null
$lastLineBlank  : bool
$listData  : ListData
$next  : Node|null
$open  : bool
$parent  : Node|null
$previous  : Node|null
$startLine  : int
$tight  : bool
__clone()  : mixed
Clone the current node and its children
__construct()  : mixed
appendChild()  : void
canContain()  : bool
Returns true if this block can contain the given block as a child node
children()  : array<string|int, Node>
children()  :
detach()  : void
detachChildren()  : void
Detaches all child nodes of given node
endsWithBlankLine()  : bool
Whether the block ends with a blank line
finalize()  : void
Finalize the block; mark it closed for modification
firstChild()  : Node|null
getData()  : mixed
getDepth()  : int
getEndLine()  : int
getListData()  : ListData
getStartLine()  : int
hasChildren()  : bool
insertAfter()  : void
Inserts the $sibling node after $this
insertBefore()  : void
Inserts the $sibling node before $this
isCode()  : bool
Whether this is a code block
isContainer()  : bool
isOpen()  : bool
Whether the block is open for modifications
isTight()  : bool
lastChild()  : Node|null
matchesNextLine()  : bool
next()  : Node|null
parent()  : Node|null
parent()  :
prependChild()  : void
Adds $child as the very first child of $this
previous()  : Node|null
replaceChildren()  : $this
Replace all children of given node with collection of another
replaceWith()  : void
setEndLine()  : $this
setLastLineBlank()  : void
setStartLine()  : $this
setTight()  : self
shouldLastLineBeBlank()  : bool
Determines whether the last line should be marked as blank
walker()  : NodeWalker
setParent()  : void

Constants

TYPE_BULLET

public mixed TYPE_BULLET = 'bullet'

TYPE_ORDERED

public mixed TYPE_ORDERED = 'ordered'

TYPE_UNORDERED

public mixed TYPE_UNORDERED = self::TYPE_BULLET
Tags
deprecated

This constant is deprecated in league/commonmark 1.4 and will be removed in 2.0; use TYPE_BULLET instead

Properties

$data

Used for storage of arbitrary data.

public array<string, mixed> $data = []

$depth

protected int $depth = 0

Methods

__clone()

Clone the current node and its children

public __clone() : mixed

WARNING: This is a recursive function and should not be called on deeply-nested node trees!

Return values
mixed

appendChild()

public appendChild(Node $child) : void
Parameters
$child : Node
Return values
void

canContain()

Returns true if this block can contain the given block as a child node

public abstract canContain(AbstractBlock $block) : bool
Parameters
$block : AbstractBlock
Return values
bool

children()

public children() : array<string|int, Node>
Return values
array<string|int, Node>

children()

public children() :

AbstractBlock[]

Return values

detach()

public detach() : void
Return values
void

detachChildren()

Detaches all child nodes of given node

public detachChildren() : void
Return values
void

endsWithBlankLine()

Whether the block ends with a blank line

public endsWithBlankLine() : bool
Return values
bool

firstChild()

public firstChild() : Node|null
Return values
Node|null

getData()

public getData(string $key[, mixed $default = null ]) : mixed
Parameters
$key : string
$default : mixed = null
Return values
mixed

getDepth()

public getDepth() : int
Return values
int

getEndLine()

public getEndLine() : int
Return values
int

getStartLine()

public getStartLine() : int
Return values
int

hasChildren()

public hasChildren() : bool
Return values
bool

insertAfter()

Inserts the $sibling node after $this

public insertAfter(Node $sibling) : void
Parameters
$sibling : Node
Return values
void

insertBefore()

Inserts the $sibling node before $this

public insertBefore(Node $sibling) : void
Parameters
$sibling : Node
Return values
void

isCode()

Whether this is a code block

public abstract isCode() : bool

Code blocks are extra-greedy - they'll try to consume all subsequent lines of content without calling matchesNextLine() each time.

Return values
bool

isContainer()

public abstract isContainer() : bool
Return values
bool

isOpen()

Whether the block is open for modifications

public isOpen() : bool
Return values
bool

isTight()

public isTight() : bool
Return values
bool

lastChild()

public lastChild() : Node|null
Return values
Node|null

matchesNextLine()

public abstract matchesNextLine(Cursor $cursor) : bool
Parameters
$cursor : Cursor
Return values
bool

parent()

public parent() : Node|null
Return values
Node|null

prependChild()

Adds $child as the very first child of $this

public prependChild(Node $child) : void
Parameters
$child : Node
Return values
void

previous()

public previous() : Node|null
Return values
Node|null

replaceChildren()

Replace all children of given node with collection of another

public replaceChildren(iteratable<string|int, Node$children) : $this
Parameters
$children : iteratable<string|int, Node>
Return values
$this

replaceWith()

public replaceWith(Node $replacement) : void
Parameters
$replacement : Node
Return values
void

setEndLine()

public setEndLine(int $endLine) : $this
Parameters
$endLine : int
Return values
$this

setLastLineBlank()

public setLastLineBlank(bool $blank) : void
Parameters
$blank : bool
Return values
void

setStartLine()

public setStartLine(int $startLine) : $this
Parameters
$startLine : int
Return values
$this

setTight()

public setTight(bool $tight) : self
Parameters
$tight : bool
Return values
self

shouldLastLineBeBlank()

Determines whether the last line should be marked as blank

public shouldLastLineBeBlank(Cursor $cursor, int $currentLineNumber) : bool
Parameters
$cursor : Cursor
$currentLineNumber : int
Return values
bool

setParent()

protected setParent([Node|null $node = null ]) : void
Parameters
$node : Node|null = null
Return values
void

Search results