Emacs 31: An unofficial guide to Markdown-ts-mode

So,Emacs 31has been released, and a lot of shiny new stuff is
there, ready for us to play with.

You probably heard of this newmarkdown-ts-modeand decided to check
it out. And guess what? On Emacs version31, 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 thehttps://commonmark.org/spec, as well as
most ofhttps://github.github.com/gfm/, with
some extras like code blocks even for non-ts-modes, likeelisp,
table of contents utilities, and interfaces with external converters,
such aspandocandgfm.

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.mdfile or call it withM-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 ofuse-packageso I tend to use it to organize myinitfile. Here is my suggested initial setup:

Or if you keepuse-packageout of your tool belt:

Now both the mode and thex(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:

And there you have it, a bare Emacs session with your testing ground
set up. This is what I will use for the rest of this guide.