1

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?

ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
TheRimalaya
  • 4,232
  • 2
  • 31
  • 37
  • 1
    A pair of surrounding backticks within a snippet are a special way of telling yasnippet to evaluate the code in between the backticks. I would probably try escaping them with one or more backslashes and see if that has the desired effect. – lawlist Mar 05 '17 at 21:22

1 Answers1

2

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.

Community
  • 1
  • 1
ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257