format

fun format(location: SectionLocation, allowMismatchingLength: Boolean = true): String

Converts the numbering format into a string. For example, the NumberingFormat 1.A.a would format the levels 1, 1, 0 as 2.B.a.

In case SectionLocation.levels and symbols have different lengths, the output will be truncated to the shortest of the two: for example, 1.A.a formats the levels 1, 1, 0, 0 as 2.B.a, and the levels 1, 1 as 2.B.

Return

the formatted string

Parameters

location

location to format. For example, when it comes to numbering headings, the level [1, 1, 0] correspond to:

# A
## A.A
# B
## B.A
## B.B
### B.B.A <-- This is the target level!
# C
allowMismatchingLength

if false, the result string is empty if the current format's length is too short to cover the nesting level of location. If true, the result is truncated to the format's length.