Layout kit command
toc.generate
Table of Contents
Generates a table of contents from paragraph styles with levels, a title and page numbers, in a new frame.
- Kit
- Layout 0.1.0 (.klayout)
- Changes the document
- yes
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
entries | object[] | no | |
page | integer | no | a page counted from 1 |
pageNumbers | boolean | no | |
rect | number[] | no | [x0, y0, x1, y1]; spread coords |
styles | any[] | no | [names]; one of several alternative parameters |
title | string | no | like Contents |
Call through layout_run
text
layout_run {
"path": "<file>.klayout",
"steps": [{ "command": "toc.generate" }]
}The required parameters, with placeholders for their types: not a tested example. Optional: entries, page, pageNumbers, rect, styles, title. layout_run answers the step’s result in completed[i].result.
Result
The kit gives no result schema for this command.
Parameter schema
json
{
"additionalProperties": false,
"properties": {
"entries": {
"items": {
"additionalProperties": true,
"description": "{style, level?}",
"properties": {
"style": {
"type": "string",
"x-khp-name": "paragraphName",
"x-khp-role": "object",
"x-khp-types": [
"Style"
]
}
},
"type": "object"
},
"type": "array"
},
"page": {
"description": "a page counted from 1",
"type": "integer"
},
"pageNumbers": {
"default": true,
"type": "boolean"
},
"rect": {
"description": "[x0, y0, x1, y1]; spread coords",
"items": {
"type": "number"
},
"type": "array"
},
"styles": {
"description": "[names]; one of several alternative parameters",
"items": {},
"type": "array",
"x-khp-name": "paragraphName",
"x-khp-types": [
"Style"
]
},
"title": {
"description": "like Contents",
"type": "string"
}
},
"returns": "{story, entries}",
"type": "object"
}Generated from the command list of @kition/[email protected] and the kit itself (layout_commands through @kition/[email protected], built from KitionAI/kition-layout@8767a18). As data: commands.jsonl.