Markdown Syntax Overview
ToastWrite is built on CommonMark with GitHub Flavored Markdown (GFM) extensions. The @toastwrite/parser package parses your Markdown incrementally, and the editor provides syntax highlighting, toolbar commands, and live preview for the same syntax.
Supported features
| Feature | Spec | Toolbar |
|---|---|---|
| Headings | ATX and Setext | Heading dropdown |
| Text formatting | CommonMark + GFM | Bold, italic, strike, code |
| Links | CommonMark + GFM autolinks | Link |
| Lists | CommonMark + GFM tasks | Bullet, ordered, task |
| Blockquotes | CommonMark | Blockquote |
| Alerts | GFM alerts | Blockquote |
| Tables | GFM | Table |
| Code | CommonMark fenced | Code, code block |
| Images | CommonMark | — |
| Horizontal rules | CommonMark | HR |
| Front matter | YAML, TOML, JSON | — (opt-in) |
| Reference definitions | CommonMark | — (opt-in) |
Toolbar keyboard shortcuts
Shortcuts use Mod as Cmd on macOS and Ctrl on Windows/Linux.
| Command | Shortcut |
|---|---|
| Bold | Mod-b |
| Italic | Mod-i |
| Strikethrough | Mod-Shift-s |
| Inline code | Mod-e |
| Code block | Mod-Shift-c |
| Link | Mod-Shift-k |
| Blockquote | Mod-Shift-q |
| Ordered list | Mod-Shift-7 |
| Bullet list | Mod-Shift-8 |
| Table | Mod-Alt-t |
| Heading 1–6 | Mod-Alt-1 … Mod-Alt-6 |
Optional parser features
Some syntax requires enabling options on the editor or viewer:
new Editor({
el: root,
frontMatter: true, // YAML/TOML/JSON front matter
referenceDefinition: true, // Reference-style links and images
});
Live preview
The editor renders preview HTML through @toastwrite/parser's renderer with DOMPurify sanitization. You can hook into rendering with beforePreviewRender:
new Editor({
el: root,
beforePreviewRender: (html) => html.replace(/<a /g, '<a target="_blank" '),
});
Browse the sections in this category for syntax examples and usage notes for each feature.