Home / Rendering guide

Rendering guide

Updated 2026-10-15

Everything in the preview is produced on this machine: the parse happens in Rust, and the highlighter and the formula typesetter load inside the app on demand. None of it uses the network, and none of it is collected.

Code fences

Name a language on the fence and it is highlighted as that language:

```rust
fn main() { println!("hello"); }
```
  • 57 grammars ship with the app (Rust, Python, JavaScript / TypeScript, Go, Java, C / C++, C#, PHP, Ruby, SQL, Shell, PowerShell, Dockerfile, YAML, TOML, JSON, INI, Diff, Markdown, LaTeX and more), and they load on demand: a document with no code fence pays nothing for them.
  • Every code block carries a caption row — fenced or indented, named or bare: the caption names the language and the copy this code button beside it copies the whole block.
  • A language that is not shipped stays plain text — no error, no badge, nothing in the status bar. Aliases (js, ts, yml, c++, sh …) match Prism's own list.
  • When the fence names a diagram engine (mermaid / dot / graphviz / d2) the block becomes a diagram card instead — see the diagram guide.

YAML frontmatter

The YAML between the opening --- of a file never reaches the body: it is stripped out and shown as a row of pills above it (title, tags, date, one pill each). A document without frontmatter looks no different.

Formulas

Inline $…$ and a paragraph of its own starting $$…$$ are typeset by KaTeX, chemistry (\ce{}) included:

Written Rendered
$a^2 + b^2 = c^2$ an inline formula
$$ on a paragraph of its own a centred display block
$$ sharing a paragraph with text inline — a centred block in the middle of a sentence breaks that sentence

Math is off by default; turn it on in Settings → math. The reason is specific: enabling it takes $ away from ordinary text, and Revenue rose from $13B to $24B. should stay a sentence about money. While it is off, $…$ shows as written. A formula that will not parse keeps its place on the line with KaTeX's own error marker, and the reason is in its tooltip.

Footnotes

[^1] becomes a numbered reference in the text, and every note is collected into one section at the end of the document, each with a ↩ back to the citation that cited it — a note cited more than once gets one back-link per citation (↩, ↩2, …).

  • Notes are numbered by the order their references appear, not by where the definitions are written.
  • A definition nothing refers to is not printed, and a reference with no definition reverts to the literal [^1] instead of leaving a dead link.

Emphasis in Chinese and Japanese

Chinese and Japanese have no word spacing, so 中文**"加粗"**中文 is ordinary prose — and CommonMark refuses it: its flanking rules treat an ideograph exactly like a Latin letter, so a ** before a quote cannot open and the run after the closing quote cannot close. Exactly that one shape is widened here:

Written Rendered
中文**"加粗"**中文 "加粗" renders bold
中文**加粗 **中文 stays as written — a space before a closer never closes
word**"x"**word stays as written — the refused neighbour is not CJK, so CommonMark decides
中文__"加粗"__中文 stays as written — the intraword rules for _ are untouched

The widening is additive: a run can only gain the emphasis its author typed, never lose emphasis that already worked. marktext, Typora and the VS Code preview widen the same shape.

Tables and task lists

GFM tables hug their content (a wide one scrolls horizontally instead of stretching the page), the header tint and the zebra stripes follow the theme, and alignment comes from :--- / :---: / ---:. Task-list checkboxes carry no bullet marker and are read-only — change the [x] in the source view.

Images that will not load

An image that fails to load does not leave a broken-image icon: its alt stays visible inside a dashed box with the reason beside it (no such path, cannot be read). A relative path resolves against the folder of the document that carries it.