Heading

class Heading(val depth: Int, val text: InlineContent, val customId: String? = null, val canBreakPage: Boolean = true, val canTrackLocation: Boolean = true, val excludeFromTableOfContents: Boolean = false) : TextNode, Identifiable, LocationTrackableNode, CrossReferenceableNode, LocalizedKind

A heading defined via prefix symbols. A heading is identifiable, as it can be looked up in the document and can be referenced. It is also location trackable, meaning its position in the document hierarchy is determined, and possibly displayed.

Parameters

depth

importance (depth=1 for H1, depth=6 for H6)

customId

optional custom ID. If null, the ID is automatically generated. If not null, the ID is used for cross-referencing.

canBreakPage

whether this heading can trigger an automatic page break. Decorative headings and auto-generated section headings typically disable this.

canTrackLocation

whether this heading's position in the document hierarchy is tracked and displayed. When false, the heading is not numbered.

excludeFromTableOfContents

if true, this heading is never included in the table of contents, even if its location is trackable. Useful for headings generated by functions such as .tableofcontents and .bibliography to prevent self-referencing.

Constructors

Link copied to clipboard
constructor(depth: Int, text: InlineContent, customId: String? = null, canBreakPage: Boolean = true, canTrackLocation: Boolean = true, excludeFromTableOfContents: Boolean = false)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val canBreakPage: Boolean = true
Link copied to clipboard
open override val canTrackLocation: Boolean = true
Link copied to clipboard
open override val children: List<Node>
Link copied to clipboard
val customId: String? = null
Link copied to clipboard
val depth: Int
Link copied to clipboard
Link copied to clipboard

Whether this heading is decorative, i.e. it cannot trigger page breaks and its location is not tracked.

Link copied to clipboard

Whether this heading is a marker.

Link copied to clipboard
open override val kindLocalizationKey: String

Key for localization of the kind of this node, used to look up localized strings in the default com.quarkdown.core.localization.LocalizationTable.

Link copied to clipboard
open override val referenceId: String?

If the heading has a custom ID, it can be used for cross-referencing.

Link copied to clipboard
open override val text: InlineContent

The text of the node as processed inline content.

Functions

Link copied to clipboard
open override fun <T> accept(visitor: IdentifierProvider<T>): T

Accepts an IdentifierProvider to generate an identifier for this element.

open override fun <T> accept(visitor: NodeVisitor<T>): T

Accepts a visitor.

Link copied to clipboard

Returns a sequence of all nodes in the tree, where this is the root node. The sequence is generated by traversing the tree in depth-first order. The root node is excluded from the sequence.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Retrieves the stored media associated with this node, if any.

Link copied to clipboard

Registers the location of this node within the document handled by context.

Link copied to clipboard

Registers the formatted location of this node within the document handled by context, according to this node's NumberingFormat.

Link copied to clipboard