Skip to content

Command Line ​

The typora command opens files in the running app, runs Typora's export, import and format pipelines from a terminal without opening a window, and lets agents work with what is open.

sh
typora notes.md todo.md              # open as tabs
typora README.md:42                  # open at line 42
git config core.editor "typora -w"   # edit commit messages in Typora
typora export notes.md notes.pdf     # export without a window
typora export -r docs -d site        # export a folder tree
echo "- [ ] call Alice" | typora append inbox.md

Every command prints its own help: typora --help, typora export --help. On macOS, man typora has the same text in one place.

Installing ​

PlatformHow
macOSSettings ▸ General ▸ System Integration ▸ Install Command Line Tool. This links /usr/local/bin/typora (and the man page) to the app. Moving Typora.app means installing again.
Windowstypora.cmd ships next to Typora.exe. Add that folder to your PATH.
LinuxRun the typora binary with the same arguments: typora export ….

Commands ​

CommandWhat it does
typora [paths…] / typora openOpen files as tabs, or a folder as the workspace
typora new [path]A new document, optionally saved to path on first save
typora append <file>Append text from stdin or --text to a Markdown file
typora statusList the documents open in Typora, for agents and scripts
typora read [file]Print a document as it is in Typora, unsaved changes included
typora edit [file] <change>Propose a change for you to review in Typora
typora mcpRun Typora's MCP server for AI agents
typora export <input…>Export to HTML, PDF, image or a Pandoc format
typora import <file>Convert a document to Markdown with Pandoc
typora format <file…>Apply the line-ending and final-newline rules
typora publish <path…>Publish changed Markdown files to a blog
typora completions <shell>Print a completion script for zsh, bash, fish (and PowerShell on Windows)

Global options: -h / --help, --version, --verbose.

open ​

typora open [options] [path[:line[:column]] …]
  • Files open as tabs in the frontmost window, in order. Folders become the window's workspace.
  • A path that doesn't exist opens as an untitled tab named after it; the first save writes to that path without asking.
  • No paths brings Typora to the front.
OptionEffect
-w, --waitReturn only when every opened document has been closed
-n, --new-windowOpen in a new window
-l, --line <n>, -c, --column <n>Put the caret there. file:line:col does the same for one file
--sidebar / --no-sidebarShow or hide the sidebar
--outline / --no-outlineShow or hide the outline
--focus, --typewriterTurn on Focus or Typewriter Mode
--sourceOpen in Source Code Mode

Lines and columns count lines of the Markdown source, like any editor's file:line:col.

new ​

typora new [--text <text> | --content -] [-w] [-n] [path]

Creates an untitled document with the given text. With a path that doesn't exist yet, the first save goes there.

append ​

typora append [--text <text>] [--raw] <file>
  • If the file is open in Typora, the text is added in the editor as one undoable edit; you save as usual. Unsaved changes are never overwritten.
  • Otherwise the text is appended to the file on disk (created if missing), without launching the app.
  • The text starts on a new line and ends with a newline, unless --raw.

export ​

typora export <input> [<output>] [options]
typora export <input…> [--out-dir <folder>] [options]

Export runs the same code as File ▸ Export, with your settings and export profiles.

  • Inputs: Markdown files, - for stdin, or folders with -r.
  • Output: -o <file>, a second argument, -d <folder>, or next to each input. -d with -r keeps the folder layout.
  • Profile: -p takes a profile id, name or type (html, html-plain, pdf, image, docx, epub, …). Without it, the output extension decides; HTML is the default. --list-profiles lists them.
  • Overrides: --set key=value (repeatable) changes one profile option for this run.
  • HTML: --embed-images, --css <file> (also used for PDF and images), --math svg|latex, --no-highlight.
  • Scripting: --stdout writes HTML for one input to stdout; --json prints a result object per file.
  • Extensions: installed extensions (TeX macros, diagram languages) are used; --no-extensions ignores them.
sh
typora export chapter.md -p pdf --set paper=A5
typora export notes.md --stdout --embed-images > notes.html

In CI and over SSH ​

format, import and completions run anywhere. export needs a renderer:

  • macOS exports everything, including over SSH or in CI with nobody logged in.
  • Linux without a display uses a built-in fallback that writes HTML and Pandoc formats; PDF and images need a display (xvfb-run -a typora export …), and diagrams stay as source.
  • Windows uses a hidden WebView2 page.

import ​

typora import <file> [<output.md>] [-o <path>] [--stdout] [--pandoc <path>] [--json] [-q]

Runs the File ▸ Import conversion with Pandoc.

format ​

typora format [--check] [--stdout] [--eol auto|lf|crlf] [--[no-]final-newline] [-q] <file… | ->

Applies only Typora's save rules — line endings and the final newline — keeping each file's encoding. --check changes nothing, lists files that would change, and exits with 1 if there are any; handy as a pre-commit hook.

status, read, edit and mcp ​

These let an agent or a script work with what is open in Typora, including unsaved changes, and propose edits you review. See Agents and MCP.

publish ​

typora publish <path…> [--to <extension>:<adapter>] [--dry-run] [--draft] [--bind <remote-id>]
typora publish status <path…> [--to <extension>:<adapter>] [--refresh] [--comments] [--metrics] [--json]

Publishes new and changed files through a publishing extension, and needs a running Typora. See Publish.

completions ​

sh
typora completions zsh  > "${fpath[1]}/_typora"
typora completions bash > /usr/local/etc/bash_completion.d/typora
typora completions fish > ~/.config/fish/completions/typora.fish

Exit status ​

CodeMeaning
0Success
1The operation failed, or format --check found changes
2Usage error
3An input couldn't be read
4The renderer or the app is unavailable

Errors go to stderr as typora: …; stdout carries only results, so it is safe to pipe.

Theme adapted from Nimbus (MIT).