Ricardo Pietrobon
Ricardo Pietrobon

Reputation: 858

Multi-line Markdown comments in Emacs

How can I select a couple of Markdown lines in Emacs to have a multi-line comment? Currently, if I use Alt-; I will get:

<!-- line 1 -->
<!-- line 2 -->

But I would like to get:

<!-- line 1
line 2 -->

Upvotes: 1

Views: 2083

Answers (1)

Chris
Chris

Reputation: 136880

The closest built-in commenting style to what you want seems to be multi-line, though it adds some additional characters:

<!-- line 1
 !-- line 2 -->

You can partially get rid of the !-- by setting comment-continue, but on my machine the empty string doesn't seem to work. This is the best I was able to come up with:

(setf comment-continue " ")
(setf comment-style 'multi-line)

and then use M-; as usual:

<!-- line 1
  line 2 -->

Upvotes: 1

Related Questions