HTML Ordered List Counter Sequence
Calculate ordered-list counters with explicit start, reversed/default-start policy and per-item integer value overrides; operates on supplied item records, not a DOM tree.
Description
Calculate ordered-list counters with explicit start, reversed/default-start policy and per-item integer value overrides; operates on supplied item records, not a DOM tree.
Ordered lists can count upward or downward, and an item value can reset the sequence. This calculator follows those declarations on supplied item records.
When to use this tool
Calculate ordered-list counters with explicit start, reversed/default-start policy and per-item integer value overrides; operates on supplied item records, not a DOM tree.
- Prepare the supplied itemsJson, start, reversed, useDefaultStart fields for this operation.
- Compare the complete example with the representation used by your own input before carrying the result into another step.
How to use the tool and how it works
- Enter itemsJson, start, reversed, useDefaultStart. Use the exact text syntax, units and index conventions explained below.
- Run the tool. If input validation fails, correct the supplied fields before interpreting any result.
- Read result.counters, result.next. Interpret false, null and empty lists using the distinctions below; they can be valid outputs.
Read itemsJson as objects, with optional integer value overrides. With useDefaultStart, begin at 1 or, when reversed, the item count; otherwise use start. Each override replaces the next counter before emission. Step by +1 or -1 and return counters plus the following next value.1
| Input field | Meaning and representation | Accepted input |
|---|---|---|
| itemsJson | JSON text, entered as one text field. The decoded structure is illustrated below; it is not a separate file. | Text |
| start | start. | Integer from -1e9 to 1e9 inclusive |
| reversed | Explicit choice for reversed; supply a boolean rather than a text label. | true or false |
| useDefaultStart | Explicit choice for use default start; supply a boolean rather than a text label. | true or false |
For the JSON text fields, the following decoded structures show the example records before they are serialized into input strings. Keep field names, list nesting and value types as shown.
[
{
"field": "itemsJson",
"decoded": [
{},
{
"value": 7
},
{},
{}
]
}
] | Output field | Interpretation |
|---|---|
| result | Object containing the named outputs below. |
| result.counters | The counters list in the ordering and representation described above. |
| result.next | The next value under the stated formula or text convention. |
{
"input": {
"itemsJson": "[{},{\"value\":7},{},{}]",
"start": 3,
"reversed": true,
"useDefaultStart": false
},
"output": {
"result": {
"counters": [
3,
7,
6,
5
],
"next": 4
}
}
} Limitations and assumptions
- No DOM or CSS counters are inspected. start is required even when ignored by the default policy; declared start and overrides are bounded to plus or minus one billion.
- All declared input fields are required and unexpected top-level fields are rejected. Numbers must be finite; lists are limited to 128 entries and ordinary text fields to 8,192 UTF-16 code units, with tighter limits where stated.
- JSON text inputs must parse within bounded nesting and size limits. Numeric outputs outside the safe finite range are rejected; large exact integer results use decimal strings. Indexes and half-open spans are zero-based unless a rank is explicitly described as one-based.
Alternative or Complementary methods
For actual document behavior, inspect a parsed DOM and the relevant HTML algorithm. These tools transform supplied tokens, observations or coordinates; compare the browser result when parsing or layout matters.
References
Similar or alternative tools
- heading level order sequence checker
Heading levels describe a document’s structure.
- tag counter
Start-tag counts measure lexical markup occurrences rather than the number of browser DOM elements.