---
title: "diagram.import: Diagram from text — Board kit command — Kition"
description: "Makes a whole diagram from text in one step: a Markdown outline (headings and nested list items) as one mind map, or a Mermaid flowchart (nodes, shapes, edges, labels, subgraphs as frames) laid out without coordinates; leaves out styling lines (classDef, style, linkStyle, class, ::: classes) and says how many; refuses what it does not understand with the line number, changing nothing."
canonical: "https://developer.kition.ai/docs/kits/board/commands/diagram.import"
---

> Canonical HTML: [https://developer.kition.ai/docs/kits/board/commands/diagram.import](https://developer.kition.ai/docs/kits/board/commands/diagram.import)

# diagram.import

**Diagram from text.** Makes a whole diagram from text in one step: a Markdown outline (headings and nested list items) as one mind map, or a Mermaid flowchart (nodes, shapes, edges, labels, subgraphs as frames) laid out without coordinates; leaves out styling lines (classDef, style, linkStyle, class, ::: classes) and says how many; refuses what it does not understand with the line number, changing nothing.

- Kit: Board 0.1.0 (.kboard); reference: [Board kit commands](https://developer.kition.ai/docs/kits/board.md)
- Changes the document: yes

## Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `at` | `number[] \| object` | no | [x, y] for the diagram's centre; right of the page's content when absent |
| `format` | `"outline" \| "mermaid"` | yes | outline: a Markdown outline (headings and nested list items) made into one mind map; mermaid: a Mermaid flowchart (graph or flowchart) made into a laid-out flow chart |
| `page` | `string` | no | The page's id; the shown page when absent |
| `text` | `string` | yes | The outline or the flowchart, at most 100000 characters; a line it does not understand is refused with its number |

## Call through board_run

```text
board_run {
  "path": "<file>.kboard",
  "steps": [{ "command": "diagram.import", "params": { "format": <"outline" | "mermaid">, "text": <string> } }]
}
```

The required parameters, with placeholders for their types: not a tested example. Optional: `at`, `page`. board_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": {
    "at": {
      "description": "[x, y] for the diagram's centre; right of the page's content when absent",
      "oneOf": [
        {
          "items": {
            "description": "One component",
            "maximum": 1000000,
            "minimum": -1000000,
            "type": "number"
          },
          "type": "array"
        },
        {
          "additionalProperties": false,
          "properties": {
            "x": {
              "description": "One component",
              "maximum": 1000000,
              "minimum": -1000000,
              "type": "number"
            },
            "y": {
              "description": "One component",
              "maximum": 1000000,
              "minimum": -1000000,
              "type": "number"
            }
          },
          "required": [
            "x",
            "y"
          ],
          "type": "object"
        }
      ]
    },
    "format": {
      "description": "outline: a Markdown outline (headings and nested list items) made into one mind map; mermaid: a Mermaid flowchart (graph or flowchart) made into a laid-out flow chart",
      "enum": [
        "outline",
        "mermaid"
      ],
      "type": "string"
    },
    "page": {
      "description": "The page's id; the shown page when absent",
      "type": "string",
      "x-khp-types": [
        "Page"
      ]
    },
    "text": {
      "description": "The outline or the flowchart, at most 100000 characters; a line it does not understand is refused with its number",
      "type": "string"
    }
  },
  "required": [
    "format",
    "text"
  ],
  "type": "object"
}
```

Generated from the command list of @kition/board-darwin-arm64@0.1.0 and the kit itself (board_commands through @kition/cli@0.1.1, built from KitionAI/kition-board@e78c190).
