Emacs 31: An unofficial guide to Markdown-ts-mode
Emacs 31 has recently been released, bringing with it a variety of new features, including the experimental markdown-ts-mode. This mode is currently marked as an experimental mode in Emacs version 31, indicating that it may not work flawlessly out of the box and could benefit from additional testing and feedback.
To get started with markdown-ts-mode, you will need to enable it in your Emacs configuration. One way to do this is by using the use-package system, as demonstrated in the source material. If you prefer not to use use-package, you can manually load the necessary libraries to activate the mode.
Markdown-ts-mode is a very feature-rich mode that supports a wide range of specifications, including the CommonMark spec and most of the GitHub Flavored Markdown (GFM) spec. It also includes additional features like code blocks for various programming languages, table of contents utilities, and interfaces with external converters such as pandoc and gfm.
Before diving into using markdown-ts-mode, you may need to install the Tree-sitter language server. This mode leverages the power of Tree-sitter, which can be a new experience for some users. The source material provides a quick installation guide for Tree-sitter, as it is not enabled by default in Emacs 31.
Once you have enabled markdown-ts-mode and installed Tree-sitter, you can begin using it to edit Markdown files. The source material emphasizes that markdown-ts-mode is not automatically enabled in Emacs 31, so you will need to load the library yourself. The mode can be loaded using the use-package system or by manually loading the necessary libraries.
The source material also highlights the importance of having the correct grammars installed for markdown-ts-mode to function properly. If you encounter issues with fontification (coloring syntax), it is likely that a grammar is missing. In such cases, you can install the required grammar using the treesit-install-language-grammar command.
The source material provides a test file for you to use as a starting point for experimenting with markdown-ts-mode. It also mentions the importance of having the correct grammar for YAML in the test file, as fontification issues may arise if the necessary grammar is not installed. The source material provides guidance on how to install the YAML grammar using treesit-install-language-grammar and evaluate the necessary code in the source file to install the grammar manually.
Written by urgent.news from Hacker News's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.