Skip to content

Templates and Snippets ​

Two libraries of plain Markdown files save you from retyping the same structure:

LibraryFolderUse it to
Templates~/.config/Typora/Templates/Start a new document
Snippets~/.config/Typora/Snippets/Insert a fragment at the caret

Each .md file is one item; its file name is its name. Sub-folders group items. Add a file in Finder or Explorer and it shows up — no restart, no index. Manage both in Settings ▸ Shortcuts, where Open Folder takes you to the folder and New Template / New Snippet opens an editor with a variable reference.

A template ​

markdown
---
typora-template:
  description: Weekly 1:1 notes
  filename: "{{date}} 1on1"
title: "{{title}}"
tags: [meeting]
---

# {{title}}

{{cursor}}

Use it from:

  • File ▸ New from Template — opens a new tab named after filename (or after the document's title, per Settings ▸ Files ▸ Default File Name).
  • The file tree's New from Template — creates the file in that folder and lets you rename it.
  • The / menu in an empty document — fills the document in place.
  • The command palette — New from Template: name.

A snippet ​

markdown
---
typora-snippet:
  description: Action item with owner and due date
  prefix: [todo, action]
---
- [ ] {{1:Task}} — @{{2:owner}}, due {{3:Friday}}

Insert it by:

  • Typing / and the prefix (/todo), or your own Trigger, then Enter. The trigger can be changed in Settings ▸ Shortcuts ▸ Typing.
  • The / menu, Snippet group.
  • Edit ▸ Insert Snippet, or Insert Snippet: name in the command palette.

When a snippet has front matter, its keys are merged into the document's front matter: missing keys are added, existing ones are kept. A snippet that is only front matter is a quick way to add your default properties to an existing document.

Metadata ​

Metadata goes under one reserved key, which is removed when the item is used. Any other front matter is copied into the result.

KeyForMeaning
typora-template.descriptiontemplatesShown in menus and Settings
typora-template.filenametemplatesFile name for the new document (variables allowed)
typora-snippet.descriptionsnippetsShown in autocomplete and Settings
typora-snippet.prefixsnippetsTrigger word, or a list of them. Defaults to the file name

Variables ​

VariableValue
{{title}}The new file's name (templates) or the current document's name (snippets)
{{date}}Today, YYYY-MM-DD. Takes a format: {{date:dddd, MMMM D}}
{{time}}Now, HH:mm. Takes a format: {{time:h:mm A}}
{{selection}}The selected Markdown, when a snippet replaces a selection
{{clipboard}}Clipboard text
{{uuid}}A random UUID
{{cursor}}Where the caret goes afterwards
{{1:placeholder}}A tab stop

Format tokens follow Moment.js (so Obsidian templates work as-is): YYYY YY MMMM MMM MM M DD D dddd ddd HH H hh h mm m ss s A a, with [text] for literal text. Unknown variables are left as written; \{{ writes a literal {{.

Tab stops ​

After inserting, the first tab stop is selected. Tab and Shift+Tab move between stops in number order; Tab after the last one goes to {{cursor}} (or the end). Stops with the same number mirror each other. Esc or clicking elsewhere ends it.

Custom formats ​

Coloured text and highlights that you toggle on a selection are custom formats, not snippets. Typora ships five text colours and three highlights; edit and add your own — with an opening text, a closing text and an optional shortcut — in Settings ▸ Markdown ▸ Custom Formats. Apply them from Format ▸ Custom Formats, the / menu, the command palette or their shortcut.

Shortcuts for templates and snippets ​

Every template, snippet and custom format can get a key binding in Settings ▸ Shortcuts ▸ Key Bindings ▸ Customize….

From extensions ​

Extensions can ship templates and snippets too. They appear in their own group, named after the extension, and are read-only in Settings.

Theme adapted from Nimbus (MIT).