Skip to content
Dev Tools Article

Emacs 31 Refines Tree-Sitter and Introduces Native Markdown

Upcoming features in the pre-release branch make the editor's built-in experience smoother and more powerful than ever.

Lenn Voss
Lenn Voss
Cloud & Infrastructure Writer · Jun 18, 2026 · 4 min read
Emacs 31 Refines Tree-Sitter and Introduces Native Markdown

The upcoming release of Emacs 31 is currently in its pre-release phase, but developers compiling directly from the emacs-31 branch or master are already daily-driving some of its most impactful quality-of-life improvements. While Emacs has spent the last few major releases laying the groundwork for modern IDE features, version 31 is shaping up to be the release that finally polishes those features into a seamless, "batteries-included" experience.

From automated grammar management to a brand-new native Markdown mode, the upcoming version aims to drastically reduce the amount of boilerplate configuration required to get a modern development environment up and running.

Tree-Sitter Without the Ceremony

For the past few releases, adopting Tree-sitter in Emacs meant wrestling with a fair amount of manual setup. Developers had to manually populate treesit-language-source-alist, trigger treesit-install-language-grammar, and hope their local C toolchain behaved.

Emacs 31 eliminates much of this friction by introducing two new configuration variables that automate the heavy lifting:

(setq treesit-auto-install-grammar t)
(setq treesit-enabled-modes t)

Setting treesit-enabled-modes to t automatically switches major modes over to their Tree-sitter equivalents (*-ts-mode) whenever they are available. Meanwhile, treesit-auto-install-grammar instructs Emacs to automatically fetch and compile missing language grammars on the fly rather than failing silently or throwing errors. This brings the seamless experience of popular third-party packages directly into the Emacs core.

Furthermore, the grammar sources for several popular languages—including TypeScript, TSX, Rust, TOML, YAML, and Dockerfile—are now defined directly inside the modes themselves. This means developers can safely delete lines of boilerplate configuration previously used to teach Emacs where these repositories live.

The Architecture Foot-Gun

While the automated grammar installation is a massive upgrade, there is a notable caveat for developers who share their .emacs.d directory across multiple machines. The auto-installed Tree-sitter grammars are compiled as shared libraries (such as .so or .dylib files) but are not segregated by CPU architecture in the default storage path. If you build a grammar on an x86_64 machine and sync your configuration directory to an arm64 machine, Emacs will fail to load the binary.

Despite this minor hurdle, the overall Tree-sitter experience continues to evolve at a remarkable pace, thanks to continuous contributions from developers like Yuan Fu and the broader community.

A Built-In, Experimental Markdown Mode

One of the most exciting additions to the Emacs 31 core is markdown-ts-mode, a native, Tree-sitter-powered Markdown major mode. Originally proposed on the emacs-devel mailing list in early 2025 by developer Rahul M. Juliato and co-authored with Stéphane Marks, the mode is currently experimental and requires explicit opt-in:

(use-package markdown-ts-mode
  :ensure nil
  :defer t)

Rather than simply acting as a basic syntax highlighter, markdown-ts-mode brings a rich, document-centric editing experience to plain text files.

Org-Style Navigation and Folding

For developers accustomed to Org mode, the transition to markdown-ts-mode will feel incredibly natural. The mode adopts Org-like keybindings and structural editing behaviors, allowing users to easily navigate headings, fold and unfold sections, and shift structural elements around without breaking their flow.

Live, Polyglot Code Blocks

One of the standout features of the new mode is its handling of fenced code blocks. Instead of rendering code samples as flat, unformatted monospace text, markdown-ts-mode fontifies the block using the actual major mode of the specified language.

This feature even works for non-Tree-sitter languages and Emacs' own internal modes. For example, an ````elisp` block will light up with true Emacs Lisp font-locking. Beyond syntax highlighting, the mode allows developers to edit these fenced blocks using the target language's native editing commands. However, the developers note that completion inside these blocks remains a bit of a "rough spot" due to the complex underlying infrastructure, so expect a few bugs in that area during the pre-release phase.

Inline Image Rendering

To make reading documentation and READMEs more comfortable, markdown-ts-mode supports inline image viewing. Instead of displaying raw markdown image links like ![](path/to/image.png), the mode renders the images directly in the buffer, turning a wall of text and markup into a readable, visual document.

Looking Ahead

Emacs 31 is proving that the editor's future isn't just about adding more features, but about making the powerful tools already built into the core easier and more pleasant to use out of the box. For developers willing to run pre-release builds, these changes are already stable and useful enough to integrate into daily workflows today.

Sources & further reading

  1. Emacs 31 Is Around the Corner: The Changes I'm Daily Driving — rahuljuliato.com
  2. Changes in Emacs 31 I'm Already Daily Driving — rahuljuliato.com
Lenn Voss
Written by
Lenn Voss · Cloud & Infrastructure Writer

Lenn writes about cloud platforms, Kubernetes internals, and the infrastructure decisions that quietly make or break engineering organizations. Based in Berlin's vibrant tech scene, they have a talent for turning dense platform-engineering topics into prose that people actually finish reading.

Discussion 3

Join the discussion

Sign in or create an account to comment and vote.

Oleg Petrov @db_nerd_oleg · 5 hours ago

i'm curious to see how the new markdown mode handles syntax highlighting for code blocks, hopefully it's as robust as the tree-sitter integration 📝

Noor Haddad @indiehacker_noor · 7 hours ago

i'm intrigued by the native markdown mode, wonder if it's something i can integrate into my side project's editor, could be a nice mrr booster

Dee Robinson @data_eng_dee · 1 hour ago

@indiehacker_noor that's a great point, but how does the native markdown mode handle backfills of existing markdown files, is it a seamless import or do you have to reformat everything

Related Reading