heading

.heading content:{InlineMarkdownContent} \
depth:{Int} \
ref:{String? = null} \
numbered:{Boolean = true} \
indexed:{Boolean = true} \
breakpage:{Boolean = true} \
foreground:{Color? = null} \
background:{Color? = null} \
border:{Color? = null} \
borderwidth:{Sizes? = null} \
borderstyle:{NodeStyle.BorderStyle? = null} \
alignment:{NodeStyle.Alignment? = null} \
textalignment:{NodeStyle.TextAlignment? = null} \
margin:{Sizes? = null} \
padding:{Sizes? = null} \
radius:{Sizes? = null} \
fontsize:{TextTransformData.Size? = null} \
fontweight:{TextTransformData.Weight? = null} \
fontstyle:{TextTransformData.Style? = null} \
fontvariant:{TextTransformData.Variant? = null} \
textdecoration:{TextTransformData.Decoration? = null} \
textcase:{TextTransformData.Case? = null}
-> Node

Creates a heading with fine-grained control over its behavior.

Unlike standard Markdown headings (#, ##, etc.), this function allows explicit control over numbering, page breaks, table of contents indexing, and custom identifiers.

Example:

.heading {My heading} depth:{2} numbered:{no}

As a Heading primitive, this function can be used in .extend to affect all headings in the document:

.extend {heading} where:{depth: .depth::equals {1}}
content:
.super foreground:{blue}
*.content*

Return

a wrapped Heading node

Parameters

content

inline content of the heading

depth

importance level of the heading (1 for H1, 6 for H6). For 0-depth, see marker instead

ref
  • Optional

optional custom identifier for cross-referencing. If unset, the ID is automatically generated

numbered
  • Optional

whether the heading can be numbered and has its position tracked in the document hierarchy. Actual numbering depends on numbering.

indexed
  • Optional

whether the heading should appear in the table of contents and navigation sidebar. Can be used independently from numbered.

breakpage
  • Optional

whether the heading triggers an automatic page break

foreground
  • Optional

text color. Default if unset

background
  • Optional

background color. Transparent if unset

border
  • Optional

border color. Default if unset and borderwidth is set

borderwidth
  • Optional

border width. Default if unset and border is set

borderstyle
  • Optional

border style. Normal (solid) if unset and border or borderwidth is set

Values

  • normal
  • dashed
  • dotted
  • double
alignment

alignment of the content. Default if unset

Values

  • start
  • center
  • end
textalignment
  • Optional

alignment of the text. alignment if unset

Values

  • start
  • center
  • end
  • justify
margin
  • Optional

whitespace outside the content. None if unset

padding
  • Optional

whitespace around the content. None if unset

radius
  • Optional

corner (and border) radius. None if unset

fontsize
  • Optional

relative font size of the text. Normal if unset

Values

  • tiny
  • small
  • normal
  • medium
  • large
  • larger
  • huge
fontweight
  • Optional

font weight of the text. Normal if unset

Values

  • normal
  • bold
fontstyle
  • Optional

font style of the text. Normal if unset

Values

  • normal
  • italic
fontvariant
  • Optional

font variant of the text. Normal if unset

Values

  • normal
  • smallcaps
textdecoration
  • Optional

text decoration of the text. None if unset

Values

  • none
  • underline
  • overline
  • underoverline
  • strikethrough
  • all
textcase
  • Optional

text case of the text. Normal if unset

Values

  • none
  • uppercase
  • lowercase
  • capitalize

Throws

if depth is not in the 1-6 range