Skip to content

Markdown and directives

Lyra pages are blocks, but you can get Markdown in and out of them. This matters most for AI agents: they read pages as Markdown and write them as Markdown, with a few additions for Lyra’s own blocks.

Where What Lyra reads
Pasting into a page Standard Markdown: headings, lists, quotes, code, tables, links and formatting
An agent writing through MCP (create_page, edit_blocks, upload_markdown) Standard Markdown plus everything on this page
Creating or changing a page through the API Standard Markdown plus everything on this page
Where What Lyra writes
⋯ → Export as Markdown The page as a .md file, with its title as the first heading
An agent reading a page (read_page), or the API The page as Markdown, optionally with each block’s id

Everything you’d expect works:

# Heading 1
## Heading 2
A paragraph with **bold**, *italic*, ~~strike~~, `code` and a [link](https://example.com).
- A bulleted item
- A nested item
1. A numbered item
- [ ] An open to-do
- [x] A done to-do
> A quote
| Name | Status |
|---|---|
| Invoices | Done |
```js
console.log('a code block')
```
---

On top of standard Markdown, agents and the API can write these:

Write To get
A code block with the language mermaid A Mermaid diagram
A code block with the language html-block An HTML block
[TOC] on a line of its own A table of contents
@2026-11-03 A date
@2026-11-03 → @2026-11-05 A date range
@2026-11-03T14:30 A date with a time
![name](/api/files/ID) for an uploaded video or audio file A player instead of an image
The directives below Cards, columns, arrows, timelines, numbers and choices

To add a file, an agent uploads it first with the upload_file MCP tool, which answers with the ![name](/api/files/ID) line to put in the page.

Directives are lines that start with colons. There are two kinds.

Containers hold other blocks. They start with three colons and the block’s name on a line of their own, and end at a line with only ::::

:::card{label="Option A" color="blue"}
Anything can go in here: text, lists, tables, even other containers.
:::

One-line blocks start with two colons and take their text in square brackets:

::stat[bills stuck]{value="5" color="red"}

Attributes go in curly brackets after the name and the text, as key="value" pairs separated by spaces.

  • Start the colons at the very beginning of the line. An indented directive isn’t read, even inside a list.
  • Nothing else goes on a directive’s line.
  • Put each value in double quotes. Write \" for a quote inside a value.
  • The text in square brackets is Markdown: bold, italics, code and links work.
  • Nothing inside a code block is read as a directive.
  • Containers go inside each other. Each one needs its own closing :::.
  • color is one of default, gray, blue, green, yellow, orange, red, purple or pink.
Directive Kind Attributes What it makes
:::card Container label, color A card. A label of only digits shows as a numbered badge
:::columns Container none A row of columns. Holds only :::column blocks
:::column Container width One column. width is a number above 0, relative to the other columns. The default is 1
::arrow One line none An arrow down. Text in brackets shows next to it
:::timeline Container none A timeline. Holds ::item rows
::item One line, or a container label, color One timeline row. label is the “when” text
::stat One line value (required), color A big number. Text in brackets says what it counts
::choice One line options (required), value A question with answers to pick one from. Text in brackets is the question
:::card
A box around a few blocks.
:::
:::card{label="1" color="blue"}
**Step one.** A numbered card for the first step.
:::
:::card{label="Option B" color="green"}
A named card, to compare options.
:::

A card ignores text in square brackets. Write its label as {label="..."}.

:::columns
:::column
Left side.
:::
:::column{width="2"}
Right side, twice as wide.
:::
:::

Anything inside :::columns but outside a :::column becomes a column of its own. A :::columns with only one column shows its blocks without columns.

::arrow
::arrow[after the bank confirms]
:::timeline
::item[Invoice sent]{label="3 Nov"}
::item[Payment received]{label="10 Nov" color="green"}
:::item[Refund issued]{label="12 Nov" color="red"}
A row written as a container can hold more blocks, like this paragraph.
:::
:::
::stat[bills stuck]{value="5" color="red"}

A number with no value shows empty.

::choice[Ship on Friday?]{options="Yes|No|Not sure"}
::choice[Which plan?]{options="Free|Pro|Business" value="Pro"}

Separate the options with |, from 2 to 10. value is the option that’s picked, and it has to be one of the options exactly. Leave it out to pick nothing.

Put the HTML in a code block whose language is html-block. Write only what goes in the body, with its <style> and <script> elements:

```html-block
<div class="box">Hello from an HTML block</div>
<style>
.box { padding: 12px; border-radius: 8px; background: var(--lyra-surface); }
</style>
```

If the HTML itself has a line of three backticks in it, use four backticks around the block. See HTML blocks for what the HTML can do.

:::columns
:::column
:::card{label="1" color="blue"}
**Paid at the bank.** The money left on 3 Nov.
:::
:::
:::column
:::card{label="2" color="orange"}
**Still waiting in the books.** Nothing records the payment.
:::
:::
:::
::arrow[what fixes it]
::stat[bills to fix]{value="5" color="red"}

When an agent sends Markdown, Lyra answers with a warning for each line it read differently from what the agent seems to have meant, with the line number. The agent can then fix the Markdown. For example:

Problem What happens
A name Lyra doesn’t have, like :::box The line shows as text
A directive with spaces before it It isn’t read, and the line shows as text
::card with two colons It holds nothing. Containers need three
A color that isn’t in the list The block uses default
An attribute the block doesn’t take It’s ignored
Text in square brackets on a container It’s ignored
A container that never ends with ::: It runs to the end of the Markdown
A code block that never ends Everything after it shows as code
:::column outside :::columns Its blocks show without a column
A :::columns with no or one column It shows nothing, or shows its blocks without columns
A ::choice with one option, more than 10, or a value that isn’t one of them Only the first 10 show, and a value that isn’t an option picks nothing

Agents also get a count of the blocks the Markdown made, by type, so they can check that every card and HTML block they wrote is there.

When Lyra writes a page as Markdown, each block becomes:

Block Written as Read back as the same block
Headings, lists, to-dos, quotes, code, tables, dividers Standard Markdown Yes
Card, columns, arrow, timeline, number, choice The directives above Yes
HTML block An html-block code block, with the text people changed put in. For an agent, also the values its person saved Yes
Mermaid diagram A mermaid code block Yes
Table of contents [TOC] Yes
Date @2026-11-03, or @2026-11-03 → @2026-11-05 for a range Yes
Image ![caption](link) Yes
Uploaded video or audio ![name](/api/files/ID) Yes
Other video, audio or file [name](link) No, it becomes a link
Callout > 💡 text, a quote starting with its icon No, it becomes a quote
Chart A code block starting with chart type=bar title="..." and its CSV No, it stays a code block
Embed [name](link) No, it becomes a link
Database view [Database view](lyra://database/ID?view=ID) No
Button [Button: label](lyra://database/ID) No
Synced block Its content, or [Synced block](lyra://page/ID) for a copy No
Page link [Title](lyra://page/ID) No
Person mention @Name No, it stays text

A toggle list is written as HTML, <details><summary>text</summary></details>.

When an agent changes part of a page, it edits blocks by id with edit_blocks, so blocks it doesn’t touch, like databases and buttons, stay as they are.

Lyra reads up to 1,000,000 characters of Markdown at once. Containers can be nested up to 20 deep, quotes up to 20 deep, and lines indented up to 100 spaces. Past those, or when one paragraph has a very large number of *, _, ~, `, [ or < marks, Lyra answers:

Lyra can't read this Markdown in one go: <the reason>. Send it in smaller pieces.

With upload_markdown, an agent can send a file of up to 2 MB.