How to write Markdown in Markup
This guide explains the Markdown features supported by Markup (the app), with examples and notes about special syntax (Mermaid, KaTeX, admonitions, backlinks, etc.). The app uses react-markdown + remark/rehype plugins (remark-gfm, remark-math, remark-supersub, remark-definition-list, rehype-katex, rehype-highlight, rehype-raw), mermaid, and node-emoji.Quick summary
Supported features:- GitHub-Flavored Markdown (tables, task lists, strikethrough)
- Math (KaTeX): inline and display
- Mermaid diagrams
- Syntax-highlighted code blocks
- Admonitions using GitHub-style blockquote markers
- Backlinks using [[Page Title]]
- Emoji shortcodes (:smile:)
- Inline highlights with
==text== - Superscript (^x^) and subscript (
x) - Footnotes
- Definition lists (term: definition)
- Per-line inline editing behavior in the inline editor
Quickstart
- Open or create a document in Markup.
- Type Markdown normally; the preview updates live (split view or standalone preview).
- Use fenced code blocks for code and diagrams:
- Mermaid diagrams:
mermaid ... - Code blocks:
js ...
Examples and usage
1) Headings
2) Paragraphs, bold, italic, strikethrough
3) Lists and task lists (GFM)
4) Tables (GFM)
5) Code blocks and syntax highlighting
Use a fenced code block with the language to get syntax highlighting:6) Mermaid diagrams
Use a fenced block withmermaid:
- Single-line mermaid diagrams with double-space separators are normalized by the preview (two spaces become newlines).
- If Mermaid fails, the preview shows an error block with the Mermaid error message.
7) Math (KaTeX)
- Inline:
- Block/display:
8) Emoji shortcodes
Emoji shortcodes are converted via node-emoji:9) Inline highlight
Use== to create a highlight:
10) Superscript and subscript
- Superscript:
- Subscript:
11) Footnotes
12) Definition lists
Use the definition list form supported by remark-definition-list:13) Admonitions (Note / Tip / Warning / etc.)
Use GitHub-style blockquotes with[!TYPE]:
14) Backlinks (graph/refs)
Double-bracket references are parsed for backlink/graph features:\[\[([^\]]+)\]\]. In previews these are typically shown as emphasized or as internal links depending on the view.
15) Inline editing & per-line preview
The inline editor renders each line as formatted Markdown when it loses focus; clicking/focusing a line returns it to raw Markdown for editing. Per-line preprocessing includes emoji and highlight conversion.Export & rendering details
When exporting, Markup’s conversion includes:- Footnotes collection and numbering
- Fenced code →
<pre><code class="language-..."> - Inline code, headings, emphasis, and strikethrough handling
- Highlighting (==text== →
<mark>) - Superscript/subscript handling
- Image and link conversion
- Horizontal rules, task lists, tables conversion
- Admonition parsing from blockquote
[!TYPE]into styled admonition blocks
src/components/editor/markdown-preview.tsx— main preview + preprocess + Mermaid block + admonition parsingsrc/components/editor/markdown-preview-standalone.tsx— standalone preview versionsrc/components/editor/inline-markdown-editor.tsx— inline per-line renderer/preprocessorsrc/components/editor/markdown-editor.tsx— CodeMirror-based editor setupsrc/components/shell/export-dialog.tsx—markdownToRichHtmlexport logicpackage.json— shows dependencies (react-markdown, mermaid, rehype-katex, remark-gfm, etc.)
Tips
- Mermaid: If you write a mermaid diagram as a single line, separate diagram parts with two spaces to let the preview normalize them to newlines.
- Mermaid errors show in the preview — check syntax on error.
- Raw HTML is processed (rehype-raw is enabled) — avoid embedding untrusted HTML in shared notes.
- Mermaid initializes with a relaxed security level to permit expected diagrams; be mindful if exposing user-supplied Mermaid in public/shared notes.
- Editor settings (auto-close, list continuation, tab handling) live in workspace settings and affect editing behavior (CodeMirror configuration).
- If you need a different export or to disable a plugin, check the preview components to see the remark/rehype pipeline.