---
title: "section.insert: Insert into a section — Note kit command — Kition"
description: "Inserts `markdown` as a new block before the heading, after the section and its subsections, right under the heading (`start`), or at the end of the section's own text before its subsections (`end`)."
canonical: "https://developer.kition.ai/docs/kits/note/commands/section.insert"
---

> Canonical HTML: [https://developer.kition.ai/docs/kits/note/commands/section.insert](https://developer.kition.ai/docs/kits/note/commands/section.insert)

# section.insert

**Insert into a section.** Inserts `markdown` as a new block before the heading, after the section and its subsections, right under the heading (`start`), or at the end of the section's own text before its subsections (`end`).

- Kit: Note 0.3.0 (Markdown (.md)); reference: [Note kit commands](https://developer.kition.ai/docs/kits/note.md)
- Changes the document: yes

## Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `heading` | `string[]` | no | The heading's path from the top, each element a heading's plain text, for example ["Plan", "Risks"]; or give line. |
| `line` | `integer` | no | The heading's line, from 1, instead of heading. |
| `markdown` | `string` | yes | The Markdown to insert. |
| `position` | `"before" \| "after" \| "start" \| "end"` | yes | Before the heading, after the section, or inside it at its start or end. |
| `section` | `string` | no | The section's id from outline.read ("section:3"), instead of heading or line: it names the same section after a rename or a move, for as long as the note stays open. |

## Call through note_run

```text
note_run {
  "path": "<file>.md",
  "steps": [{ "command": "section.insert", "params": { "markdown": <string>, "position": <"before" | "after" | "start" | "end"> } }]
}
```

The required parameters, with placeholders for their types: not a tested example. Optional: `heading`, `line`, `section`. note_run answers the step’s result in `completed[i].result`.

## Result

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `changed` | `boolean` | yes | Whether the note's text changed (false when it already read so). |

```json
{
  "additionalProperties": false,
  "properties": {
    "changed": {
      "description": "Whether the note's text changed (false when it already read so).",
      "type": "boolean"
    }
  },
  "required": [
    "changed"
  ],
  "type": "object"
}
```

## Parameter schema

```json
{
  "additionalProperties": false,
  "properties": {
    "heading": {
      "description": "The heading's path from the top, each element a heading's plain text, for example [\"Plan\", \"Risks\"]; or give line.",
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "line": {
      "description": "The heading's line, from 1, instead of heading.",
      "type": "integer"
    },
    "markdown": {
      "description": "The Markdown to insert.",
      "type": "string"
    },
    "position": {
      "description": "Before the heading, after the section, or inside it at its start or end.",
      "enum": [
        "before",
        "after",
        "start",
        "end"
      ],
      "type": "string"
    },
    "section": {
      "description": "The section's id from outline.read (\"section:3\"), instead of heading or line: it names the same section after a rename or a move, for as long as the note stays open.",
      "type": "string"
    }
  },
  "required": [
    "markdown",
    "position"
  ],
  "type": "object"
}
```

Generated from kition-sdk packages/script/kits/note.ts and the kit itself (kition-note@69e14d9).
