---
title: "heading.setLevel: Set a heading's level — Note kit command — Kition"
description: "Sets the level (1 to 6) of the heading at a path or line by rewriting only its `#` run (an underlined heading's underline); its subsections keep their own levels."
canonical: "https://developer.kition.ai/docs/kits/note/commands/heading.setLevel"
---

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

# heading.setLevel

**Set a heading's level.** Sets the level (1 to 6) of the heading at a path or line by rewriting only its `#` run (an underlined heading's underline); its subsections keep their own levels.

- 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. |
| `level` | `integer (≥ 1, ≤ 6)` | yes | The new level, 1 to 6. |
| `line` | `integer` | no | The heading's line, from 1, instead of heading. |
| `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. |
| `style` | `"atx"` | no | Rewrite an underlined heading as a # heading. |

## Call through note_run

```text
note_run {
  "path": "<file>.md",
  "steps": [{ "command": "heading.setLevel", "params": { "level": <integer> } }]
}
```

The required parameters, with placeholders for their types: not a tested example. Optional: `heading`, `line`, `section`, `style`. 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"
    },
    "level": {
      "description": "The new level, 1 to 6.",
      "maximum": 6,
      "minimum": 1,
      "type": "integer"
    },
    "line": {
      "description": "The heading's line, from 1, instead of heading.",
      "type": "integer"
    },
    "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"
    },
    "style": {
      "description": "Rewrite an underlined heading as a # heading.",
      "enum": [
        "atx"
      ],
      "type": "string"
    }
  },
  "required": [
    "level"
  ],
  "type": "object"
}
```

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