Charts and code blocks
A fenced code block (three backticks on their own lines) holds text that Return leaves exactly as you wrote it: a clause in its original wording, a snippet of a statute, a SQL query. One kind of block is different. A block tagged mermaid is drawn as a chart or diagram, from the same plain text.
Both live in the markdown file as text. Nothing about them depends on Return: the file opens in any editor.
Code blocks
```sql
SELECT * FROM invoices WHERE due < date('now');
```
- Insert one with the
+at the caret or by typing/code, then pick a language or leave it blank. The block renders highlighted when Return knows the language, plain otherwise; either way it is a block. - Edit it by clicking into it. The block keeps its card and its monospace face while you type, and the two fence lines turn into the header and the bottom edge. Click the header line itself to change the language.
- Copy the whole block with the Copy button in its header.
- It is literal. Nothing inside a code block is interpreted: a
$nameis not a formula, a[NAME]is not a placeholder, and the AI never edits a block it was not asked to change.
Charts
A block tagged mermaid is drawn from mermaid syntax: a chart type on the first line, then its data as text.
```mermaid
pie title Cost structure
"Materials" : 45
"Shipping" : 25
"Marketing" : 30
```
Insert one with the + at the caret or with /chart (also /pie, /bar, /gantt), then pick the type. Return inserts a minimal scaffold with the title selected, so the first thing you type is the title; replace the sample labels and numbers with your own. The types on offer:
| Type | For | Syntax |
|---|---|---|
| Pie | shares of a whole | pie, one "Label" : value per slice |
| Bar, Line | comparing values, trends | xychart-beta with x-axis, y-axis and a bar [...] or line [...] series |
| Timeline | schedules and deadlines | gantt, tasks as Name :id, start date, duration |
| Flow | a process or a decision | flowchart TD, nodes joined with --> |
Anything else mermaid can draw (sequence diagrams, mind maps, and more) works the same way; type it into a mermaid block by hand.
- Edit a chart by double-clicking it. The source opens in place; move the caret out and the chart draws again. A single click leaves the chart as it is.
- Colors follow labels. Every label gets its own color, and the same label is the same color in every chart of the document, so “Marketing” in the pie matches “Marketing” in the bar chart below it. Colors adapt to the Light and Dark themes.
- Values from formulas. Where a number goes, a
$namefrom your calculations can stand instead, and the chart follows the value as it changes. See the “Values in charts” section of Formulas. - Errors are shown, not hidden. A chart that does not parse shows its source with a one-line message above it, so a typo never turns into a silently wrong picture.
- Turning drawing off. Settings, Appearance, “Render diagrams” switches every
mermaidblock back to a plain code block. The file does not change.
What to know
- Other editors. Obsidian, VS Code and most markdown viewers draw
mermaidblocks too. A chart that references a$namevalue is the exception: only Return resolves it, other editors report a syntax error for that chart. - Export. PDF and HTML export draw charts as pictures, in the light colors, with your prose font and with any
$namevalues filled in. A chart that does not parse is exported as its source text, so is a chart placed inside a list item or a quote (keep charts at the top level of the document), and with “Render diagrams” off every chart exports as a code block. Images you placed in the document (for example from theassetsfolder next to it) are embedded in the exported file too; in a PDF an image keeps its natural size and is scaled down only when it is wider than the page. - The AI can draw. Ask the assistant for a chart of the numbers in your document and it writes the
mermaidblock; when your numbers are formulas, it references them instead of copying them.