// HACKER NEWS — CYBERSECURITY
Emacs 31: An unofficial guide to Markdown-ts-mode
So, Emacs 31 has been released, and a lot of shiny new stuff is
there, ready for us to play with.
You probably heard of this new markdown-ts-mode and decided to check
it out. And guess what? On Emacs version 31, this is marked as an
experimental mode. What does this mean? Should you use it or not? Is
this ready? Is this just a sketch of a mode?
Treat this post as a quick guide to getting this mode up and running
and helping yourself find answers to these questions.
This is an experimental mode, right? You need to opt in, so probably
not everything will work flawlessly yet, and it needs more testing and
feedback.
That said, don't let this title mislead you. This does not mean the
mode is premature in terms of features. As you will see, this is a
very feature-rich mode. This mode already covers all of the
https://commonmark.org/ spec, as well as
most of
https://github.github.com/gfm/, with
some extras like code blocks even for non-ts-modes, like elisp,
table of contents utilities, and interfaces with external converters,
such as pandoc and gfm.
Before deep diving into it yourself, you may need some help simply
turning this mode on. Tree-sitter is tricky. It might even be your
first time with tree-sitter, so a quick "install guide" is on our
agenda.
Experimental means Emacs does not enable the mode by default so it is
not there waiting for you to simply open a .md file or call it with
M-x markdown-ts-mode RET. You need to load this library.
As always on Emacs, there's more than one way of doing everything, I
am a big fan of use-package so I tend to use it to organize my
init file. Here is my suggested initial setup:
Now both the mode and the x (nice extra goodies) libraries are
loaded, and you can simply visit your Markdown files using it.
If you want to experiment with it without touching your own
configuration, do the following: