text_add_line_numbers
Add sequential line numbers to any text, with options for numbering style, start value, increment, and blank line handling. Ideal for annotating logs, code, or lists.
Instructions
Add Line Numbers. Prefix every line of the supplied text with a sequential number, returning the numbered text plus before/after statistics. Choose simple ("N: line"), zero-padded, or a custom template using {line} and {text} placeholders; control the starting number, increment, pad width, and whether blank lines are skipped (kept verbatim and uncounted). Use this to annotate logs, code, or lists; use text_remove_line_numbers for the inverse. Pure local compute: read-only, non-destructive, offline, and rate-limited (60 requests/min for anonymous callers). Returns the numbered result, the final number reached, and original/result line-word-character counts.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | Multi-line text to number; split on newline (\n). | |
| startNumber | No | First line number. Values below 1 are clamped to 1. | |
| increment | No | Amount added per numbered line. Values below 1 are clamped to 1. | |
| format | No | Output style. simple and padded emit "<number>: <line>"; padded zero-pads the number; custom uses the customFormat template. | simple |
| customFormat | No | Template used when format is custom; {line} is replaced by the number and {text} by the line content. | {line}: {text} |
| padding | No | Zero-pad width when format is padded; falls back to 3 when 0. Ignored for other formats. | |
| skipEmptyLines | No | When true, blank/whitespace-only lines are kept as-is, not numbered, and counted as skipped. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| success | No | Always true on success. | |
| result | No | The numbered text. | |
| stats | No | Counts for the input and output plus numbering summary. | |
| options | No | The effective settings applied after clamping/normalization. |