---
title: "diagram.getPreview: Diagram from text preview — Board kit command — Kition"
description: "Answers what diagram.import would make of a text, without changing the board: the laid-out result drawn by the engine as SVG, its size and what it holds; a text the import refuses is refused with the same error."
canonical: "https://developer.kition.ai/docs/kits/board/commands/diagram.getPreview"
---

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

# diagram.getPreview

**Diagram from text preview.** Answers what diagram.import would make of a text, without changing the board: the laid-out result drawn by the engine as SVG, its size and what it holds; a text the import refuses is refused with the same error.

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

## Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `format` | `"outline" \| "mermaid"` | yes | outline (a Markdown outline) or mermaid (a Mermaid flowchart), as diagram.import takes it |
| `text` | `string` | yes | The text diagram.import would read |

## Call through board_run

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

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

## Result

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `box` | `number[]` | yes | [x0, y0, x1, y1] the result covers, centred on the origin |
| `edges` | `integer` | yes | How many connectors (edges or branches) it makes |
| `format` | `"outline" \| "mermaid"` | yes |  |
| `frames` | `integer` | yes | How many frames (subgraphs) it makes |
| `height` | `number` | yes | The SVG's height in board units |
| `ignored` | `integer` | yes | How many lines had styling the import leaves out (a flowchart's classDef, style, linkStyle, class and ::: classes; 0 for an outline) |
| `nodes` | `integer` | yes | How many boxes (flow-chart or mind-map nodes) it makes |
| `svg` | `string` | yes | The result drawn as the board draws it, as an SVG document whose viewBox is box with a margin of 32; colours are the editor's (var(--kb-…, #light)) |
| `width` | `number` | yes | The SVG's width in board units |

```json
{
  "additionalProperties": false,
  "properties": {
    "box": {
      "description": "[x0, y0, x1, y1] the result covers, centred on the origin",
      "items": {
        "type": "number"
      },
      "type": "array"
    },
    "edges": {
      "description": "How many connectors (edges or branches) it makes",
      "type": "integer"
    },
    "format": {
      "enum": [
        "outline",
        "mermaid"
      ],
      "type": "string"
    },
    "frames": {
      "description": "How many frames (subgraphs) it makes",
      "type": "integer"
    },
    "height": {
      "description": "The SVG's height in board units",
      "type": "number"
    },
    "ignored": {
      "description": "How many lines had styling the import leaves out (a flowchart's classDef, style, linkStyle, class and ::: classes; 0 for an outline)",
      "type": "integer"
    },
    "nodes": {
      "description": "How many boxes (flow-chart or mind-map nodes) it makes",
      "type": "integer"
    },
    "svg": {
      "description": "The result drawn as the board draws it, as an SVG document whose viewBox is box with a margin of 32; colours are the editor's (var(--kb-…, #light))",
      "type": "string"
    },
    "width": {
      "description": "The SVG's width in board units",
      "type": "number"
    }
  },
  "required": [
    "box",
    "edges",
    "format",
    "frames",
    "height",
    "ignored",
    "nodes",
    "svg",
    "width"
  ],
  "type": "object"
}
```

## Parameter schema

```json
{
  "additionalProperties": false,
  "properties": {
    "format": {
      "description": "outline (a Markdown outline) or mermaid (a Mermaid flowchart), as diagram.import takes it",
      "enum": [
        "outline",
        "mermaid"
      ],
      "type": "string"
    },
    "text": {
      "description": "The text diagram.import would read",
      "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).
