Backticks in snippets for Emacs

508 Views Asked by At

I am trying to create a code block snippet for Markdown in Emacs.

I tried to create a snippet like so:

# -*- mode: snippet -*-
# name: code-block
# key: cb
# ---

```${1:r}
${2:code}
```

but when I tried to save, it threw an error saying wrong type argument: stringp, nil.

How can I get this snippet to work?

1

There are 1 best solutions below

0
Chris On

You'll have to escape the backticks with a backslash.

From the documentation:

Plain Text

Arbitrary text can be included as the content of a template. They are usually interpreted as plain text, except $ and `. You need to use \ to escape them: \$ and \` . The \ itself may also needed to be escaped as \\ sometimes.