Constructor
new MultiLevelAutoNumbering(startValueopt)
- Description:
- Creates a new multi-level auto-numbering generator. Only the default format `"{0}. "` is supported — other formats are not allowed.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
startValue |
number |
<optional> |
1
|
The starting number for the top-level counter. |
Throws:
-
If a custom numbering format is provided.
- Type
- Error
Classes
Members
level
- Description:
- Gets the current nesting level (1 = root).
- Source:
Gets the current nesting level (1 = root).
Methods
nest(startValueopt) → {MultiLevelAutoNumbering}
- Description:
- Increases the nesting level (e.g., goes from `2.` to `2.1.`, or from `1.2.` to `1.2.1.`). The new level resets its own counter, while prefixing the last generated parent string.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
startValue |
number |
<optional> |
1
|
Starting number for the new level. |
Returns:
The current instance (for chaining).
next(textopt) → {string}
- Description:
- Returns the next string in the current nesting level.
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
text |
string |
<optional> |
Optional content to append after the number (e.g., a title). |
Returns:
Formatted numbered string like `1. Title` or `2.3. Another`.
- Type
- string
reset()
- Description:
- Resets this instance of MultiLevelAutoNumbering.
- Source:
unnest() → {MultiLevelAutoNumbering}
- Description:
- Decreases the nesting level (e.g., goes from `1.1.1.` to `1.1.`). Does nothing if already at the top-level (level 1).
- Source:
Returns:
The current instance (for chaining).