# Edit the diagram's text

Every Line9 diagram is Mermaid text. Where to see it, how to change it, and what Line9 writes into it for you.

## Every diagram is Mermaid text

A Line9 diagram is written as Mermaid text, with a line for each node and each edge. This text:

```mermaid
---
title: Approval
---
flowchart LR
  limit{"Over £500?"}
  manager["Line manager approves"]
  director["Departmental executive approves"]
  limit -->|"No"| manager
  limit -->|"Yes"| director
```

draws this diagram:

![A small flowchart titled Approval: the Over £500? decision leads to Line manager approves when No, and to Departmental executive approves when Yes.](/images/docs/diagrams/approval-decision.svg)

The text is the diagram: a shared link, an exported `.mmd` file and a published diagram all carry it.

## Open the source panel

Click the mode button, **VIEW**, at the bottom of the diagram page and choose **SOURCE**, or press **⌘U** (Mac) or **Ctrl+U** (Windows). The text opens on the left. Choose **VIEW** again, or click **×**, to close it.

![The mode menu: View, Source and Edit. Edit needs Line9 Pro.](/images/docs/screens/diagram-text/mode-menu.png)

**Copy source**, at the bottom of the panel, copies the whole text.

## Change the text

Type in the source panel. Line9 redraws the diagram as you type. Some common changes:

| To                  | Write                                         |
| ------------------- | --------------------------------------------- |
| Rename a node       | Change the text in quotes                     |
| Add a node          | `audit["Spot-check by Audit"]`                |
| Connect two nodes   | `manager --> audit`                           |
| Change a node shape | Change the brackets: `{"…"}` draws a decision |

[Nodes, edges and groups](/docs/nodes-edges-and-groups) lists every shape and line style.

## What Line9 writes into the text

When you change the theme or another style setting, Line9 writes it at the top of the text:

```yaml
---
title: Expense approval
line9:
  theme: linen
---
```

The settings travel with the text, so the diagram looks the same wherever it is opened. Changing the orientation changes the `flowchart` line instead: `flowchart LR` runs left to right, `flowchart TD` top to bottom.

## When the text has a mistake

Line9 keeps showing the last version it could draw. A message appears at the top, and the line with the mistake is highlighted in the source panel.

![A message reading Parse error, with a Show source button, above the source panel. The line for the Over £500? decision is highlighted because its closing bracket is missing.](/images/docs/screens/diagram-text/mistake.png)

Click **Show source** to go to the line. When you correct it, the diagram updates.

## Next

- [Nodes, edges and groups](/docs/nodes-edges-and-groups): the parts a flowchart is made of.
- [Theme, orientation and spacing](/docs/theme-orientation-and-spacing): change how the diagram looks.
