toc_insert
Insert a tracked table of contents after a chosen body paragraph in a .docx, with optional title and heading levels; the field remains stale until fields.update fills it.
Instructions
Insert a table of contents (a TOC field) after a body paragraph, as tracked insertions: an optional title, the field with a placeholder result and the paragraph that closes it. The result text is filled by fields.update; until then fields.list shows the field as stale. Returns the address of the field's paragraph.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| doc | Yes | Path to the .docx. | |
| tag | No | Appended to the author. | |
| after | Yes | Address of the body paragraph it goes after. | |
| title | No | Title paragraph above it (default "Contents"); "" for none. | |
| author | No | Revision author. | |
| expect | No | ||
| levels | No | Heading levels it lists, e.g. "1-3" (default) or "2". | |
| dry_run | No | Preview only; write nothing. |