Note kit command

link.insert

Insert a link

Inserts a link to `destination` at a text position, as a wikilink or a Markdown link, with optional display text, or as an embed with `embed: true`.

Kit
Note 0.3.0 (Markdown (.md))
Changes the document
yes

Parameters

Parameters of link.insert
NameTypeRequiredDescription
atintegeryesWhere to insert.
destinationstringyesWhat the link points at, as the note writes it: Plan, Plan#Risks, docs/plan.md.
embedbooleannoEmbed it (![[...]]) instead of linking.
style"wikilink" | "markdown"no[[wikilink]] or [text](markdown).
textstringnoThe text shown (a wikilink's alias).
unit"scalar" | "utf16"noHow positions are counted: Unicode characters (scalar, the default), or UTF-16 code units as the editor counts them.

Call through note_run

text
note_run {
  "path": "<file>.md",
  "steps": [{ "command": "link.insert", "params": { "at": <integer>, "destination": <string> } }]
}

The required parameters, with placeholders for their types: not a tested example. Optional: embed, style, text, unit. note_run answers the step’s result in completed[i].result.

Result

Result of link.insert
NameTypeRequiredDescription
changedbooleanyesWhether the note's text changed (false when it already read so).
Result JSON Schema
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": {
    "at": {
      "description": "Where to insert.",
      "type": "integer"
    },
    "destination": {
      "description": "What the link points at, as the note writes it: Plan, Plan#Risks, docs/plan.md.",
      "type": "string"
    },
    "embed": {
      "description": "Embed it (![[...]]) instead of linking.",
      "type": "boolean"
    },
    "style": {
      "default": "wikilink",
      "description": "[[wikilink]] or [text](markdown).",
      "enum": [
        "wikilink",
        "markdown"
      ],
      "type": "string"
    },
    "text": {
      "description": "The text shown (a wikilink's alias).",
      "type": "string"
    },
    "unit": {
      "default": "scalar",
      "description": "How positions are counted: Unicode characters (scalar, the default), or UTF-16 code units as the editor counts them.",
      "enum": [
        "scalar",
        "utf16"
      ],
      "type": "string"
    }
  },
  "required": [
    "at",
    "destination"
  ],
  "type": "object"
}

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