Emacs markdown-mode: Setup, Keys, and Live Preview

September 11, 2026 · 10 min read

Emacs markdown-mode: Setup, Keybindings, and Live Preview

Emacs markdown-mode is the major mode that gives Emacs syntax highlighting, structure editing, and preview for Markdown files. Install it from MELPA, point markdown-command at a converter, and you're editing in under ten minutes. This guide has the short setup, a one-screen keybinding table, and a comparison of the four ways to get a live preview.

Does Emacs Have a Markdown Mode?

Yes, though not built into Emacs until very recently. When people search for emacs markdown mode or markdown-mode emacs, they mean the same package. The one everyone uses is markdown-mode by Jason Blevins, at version 2.8 as of 8 March 2026. It's developed against GNU Emacs 27.1 and later, and its canonical repository is jrblevin/markdown-mode on GitHub (there are older forks with similar names; ignore them).

Emacs 31.1, released 24 August 2026, adds a second option: markdown-ts-mode, a tree-sitter based mode that lives in the Emacs source tree. It's a different codebase with a different feature set, covered below. For most people in 2026, markdown-mode remains the mode to install: it has the keybindings, the export commands, and the GitHub Flavored Markdown variant.

How Do You Install and Turn On markdown-mode?

Three steps: add MELPA Stable, install the package, and tell it which converter to run for previews.

Add the archive to init.el if it isn't there already, then M-x package-install RET markdown-mode RET:

(require 'package)
(add-to-list 'package-archives
             '("melpa-stable" . "https://stable.melpa.org/packages/"))
(package-initialize)

MELPA Stable tracks tagged releases; plain MELPA builds from the latest commit. Either works. The use-package form from the official docs does everything in one block and routes README.md files to gfm-mode:

(use-package markdown-mode
  :ensure t
  :mode ("README\\.md\\'" . gfm-mode)
  :init (setq markdown-command "multimarkdown"))

markdown-command defaults to markdown, which most systems don't have. Set it to whatever converter you install. Pandoc is the better pick: it also handles the math and footnote syntax the other converters skip.

PlatformInstall a converterThen set
macOS (Homebrew)brew install pandoc(setq markdown-command "pandoc")
Ubuntu / Debiansudo apt install pandoc(setq markdown-command "pandoc")
Any, with MultiMarkdownbrew install multimarkdown(setq markdown-command "multimarkdown")

Open any .md file and the mode activates through auto-mode-alist. If it doesn't, M-x markdown-mode turns it on for the current buffer. Test the setup with C-c C-c p, which converts the buffer and opens the HTML in your browser. If nothing happens, the converter isn't on Emacs's exec-path, which is the single most common markdown mode emacs problem on macOS.

markdown-mode Keybindings on One Screen

Every command sits under C-c. The full manual is long; this table is the subset worth memorising, grouped by task.

TaskKeyCommand
Bold, italic, codeC-c C-s b, C-c C-s i, C-c C-s cWrap region or word
Heading level 1 to 6C-c C-s 1 to C-c C-s 6Insert or convert heading
Blockquote, code blockC-c C-s q, C-c C-s pWrap region
GFM fenced blockC-c C-s CInsert backtick fence
Strikethrough (gfm-mode)C-c C-s sWrap region
FootnoteC-c C-s fInsert marker and definition
LinkC-c C-lInsert or edit link
ImageC-c C-iInsert image
Follow linkC-c C-oOpen URL or wiki link
New list itemM-RETContinue list with same marker
Move item up/downC-c UP, C-c DOWNReorder list items or subtrees
Indent/outdent itemC-c RIGHT, C-c LEFTChange nesting
Do what I meanC-c C-dToggle checkbox, jump reference, align table
Kill markupC-c C-kRemove markup, keep text
Renumber listsC-c C-c nFix ordered list numbers
Check referencesC-c C-c cList undefined link references
Next/previous headingC-c C-n, C-c C-pMove between visible headings
Parent headingC-c C-uMove up one level
Fold headingTAB on a headingCycle visibility
Fold whole bufferS-TABCycle overview, contents, all
Hide markupC-c C-x C-mToggle markdown-hide-markup
Inline imagesC-c C-x C-iToggle image display

The C-c C-d binding is the one to learn first. On a - [ ] line it toggles the checkbox, in a table it realigns the columns, and on a reference link it jumps to the definition. The syntax it manipulates is all in our Markdown cheat sheet.

Live Preview in Emacs: Four Options Compared

"Emacs markdown preview" is the most-searched need after installation, and there are four different answers.

1. markdown-live-preview-mode (built in). C-c C-c l toggles it. It runs markdown-command on every save and shows the HTML in an eww buffer beside the source. No extra packages, but the rendering is eww's: plain, no CSS, no syntax highlighting in code blocks. It's fine for quick checks of structure.

2. Browser preview (built in). C-c C-c p converts once and opens the result in your default browser. C-c C-c v exports to an HTML file next to the source and opens that. Not live, but it renders with real CSS.

3. grip-mode (GitHub rendering). grip-mode previews through GitHub's own Markdown API, so what you see is what a README will look like. It needs a backend: pip install grip, or the API-free go-grip or mdopen alternatives. Set a GitHub token or you'll hit the unauthenticated API rate limit within a few saves:

(use-package grip-mode
  :ensure t
  :hook ((markdown-mode org-mode) . grip-mode)
  :config (setq grip-command 'auto))

4. markdown-ts-mode (Emacs 31.1). Not a preview, but worth listing because people ask. It uses tree-sitter grammars for faster, more accurate highlighting on large files, and fenced code blocks get their language's own mode inside the block. It needs the markdown and markdown-inline tree-sitter grammars. Install them with M-x treesit-install-language-grammar, or set the new treesit-auto-install-grammar option so Emacs fetches them when the mode first runs. Its own commentary still calls it experimental. It has no export or preview commands of its own, so pair it with grip-mode or the browser.

If none of these are set up on a machine you're borrowing, paste the buffer into the editor for a rendered preview with no configuration.

Try the Sample Document

The document below exercises what markdown-mode highlights and manipulates: a heading, emphasis, a task list for C-c C-d, a table it can align, and a fenced block. Open it here, then paste it into Emacs and run through the keybinding table.

Weekly plan

Written in Emacs markdown-mode 2.8.

  • Install from MELPA Stable
  • Set markdown-command to pandoc
  • Try C-c C-c l for live preview
Key Action
C-c C-s b Bold
C-c C-d Do what I mean
M-x markdown-live-preview-mode

Math works with markdown-enable-math: E=mc2E = mc^2

64 words329 characters18 lines
Markdown

GitHub Flavored Markdown, Math, and Other Extensions

gfm-mode is a derived mode for GitHub's dialect. It adds strikethrough with C-c C-s s, task-list checkboxes, fenced code blocks, and stops underscores inside words from being read as emphasis. The use-package snippet above already sends README.md there; add CONTRIBUTING.md and CHANGELOG.md to the :mode list if you write those often. What GFM changes versus CommonMark is in the GitHub Markdown cheat sheet.

Math highlighting is off by default. (setq markdown-enable-math t) turns on fontification for $...$ and $$...$$ spans; the converter still has to support them (Pandoc does). See writing equations in Markdown for the syntax.

markdown-hide-markup hides the asterisks and hashes so the buffer reads like rendered text. It's pleasant for prose and confusing when you're debugging a list, so we keep it bound to the toggle rather than on permanently.

Doom Emacs and Spacemacs

Doom users get markdown-mode through the :lang markdown module. Enable it in init.el, and add the +grip flag for grip-mode previews: (markdown +grip). Doom's module docs note that a converter such as Pandoc or MultiMarkdown still has to be installed for its preview command. That command sits under the module's local leader bindings. README files open in gfm-mode automatically.

Spacemacs ships a markdown layer with the same package underneath; add it to dotspacemacs-configuration-layers. In both distributions the C-c bindings in the table above still work alongside the leader-key versions.

One limitation applies to every setup on this page: markdown-mode highlights with regular expressions, so a 5,000-line file with many code blocks can lag on scroll. markdown-ts-mode in Emacs 31.1 addresses that with an incremental parser. The trade is that you give up the export commands until you add them back through grip-mode or a shell command bound to C-c C-c.

Common Emacs markdown-mode Problems

C-c C-c p does nothing or errors. markdown-command points at a program Emacs can't find. Check with M-x shell-command RET which pandoc. On macOS, GUI Emacs often has a shorter PATH than your terminal; the exec-path-from-shell package fixes it.

Wrong mode for README.md. If README.md opens in plain markdown-mode, the :mode entry is missing or another package claimed the extension. M-x gfm-mode switches the buffer; the use-package snippet makes it permanent.

Live preview shows unstyled HTML. That's eww. It doesn't load stylesheets. Use C-c C-c p for a browser render or grip-mode for GitHub styling.

Emacs markdown-mode FAQ

Emacs markdown-mode turns Emacs into a capable Markdown editor with three lines of configuration: MELPA Stable, package-install, and a markdown-command that exists on your PATH. Learn C-c C-s for styling, C-c C-d for everything else, and pick the preview backend that matches where the file will be read. When you're away from your config, the editor renders the same file in a browser tab. For the VS Code equivalent of this setup, see our VS Code Markdown guide.