Persisted results
Run results are saved into the note itself as plain markdown — they survive restarts, travel with the file, and render in Obsidian and any markdown reader.
Setting
Settings → Editor → General → "Persist code block results" — default on, saved per vault. Override per block with the save; / noSave; fence params.
Text results → output blocks
A finished node / bash / batch / powershell run writes its output right below the code fence:
```js
//exec: node
console.log(1 + 1)
```
```output znote
2
```outputrenders as a plain code block everywhere; theznoteword marks the block as managed — safe for Znote to replace or remove. A hand-writtenoutputblock without the marker is never touched.- The persisted block is the single on-screen representation of a text result; the live display only streams during longer runs, then hands over to the block.
- Clear (✕) on the runner removes the block from the note.
- To keep notes git-friendly, persisted output is capped at 10 000 chars / 200 lines (then
… [output truncated by znote]), with ANSI codes stripped. The live display keeps the full output.
AI answers → rendered markdown
AI block answers are persisted differently: as regular rendered markdown, delimited by invisible HTML-comment markers, right below the block:
```ai tools=github
Draft my standup brief from yesterday's commits on acme/webapp.
```
<!-- znote-ai-start -->
### Standup — Tuesday
- Shipped the retry logic for webhook delivery…
<!-- znote-ai-end -->- The answer reads as normal note content — headings, tables, lists render everywhere, including Obsidian. The markers are hidden in live preview.
- Re-running the block replaces the previous answer instead of piling up; Clear (✕) removes it.
- Combined with MCP servers, a note becomes prompt + tools + latest result in one file: open it Monday, press play, fresh data.
- The same setting and
save;/noSave;params apply.
Rich results → PNG snapshots
Browser/JS runs that render into the result area (Plotly, tables, DOM…) can be persisted on demand: click the camera button ("Save result to note") on the runner. The rendered result is captured as a hi-dpi PNG into the vault attachments and embedded below the block:
![[znote-run-20260724103528.png|900]]- The
znote-run-filename prefix marks the snapshot as managed — hand-written embeds are never touched. - The embed carries the captured width in Obsidian's
|widthsyntax, so it displays at the right size in both apps. - Running the block again, or Clear, removes the stale snapshot.
- Hover a saved snapshot for a copy button that puts the PNG on the clipboard at full resolution.
Runner controls
| Button | Action |
|---|---|
▶ Play (Cmd/Ctrl+Enter) | Run the block |
| ⏹ Stop | Interrupt the run |
| ✕ Clear | Clear the result (and remove the persisted block/snapshot) |
| 📷 Camera | Save a rich result as a snapshot (browser results only) |
Run permission
Code execution is opt-in per note: toggle Allow to Run code (code icon) in the action bar.
