To edit markdown text I use Emacs's markdown-mode
. I'd like to express "newline" by " " (i.e. 2 spaces). But in that situation if I go to the next line by pressing return key, trailing whitespaces are automatically deleted.
I want that whitespace as it is. How can I achieve that? Do I need to add any extra configuration to my init.el
?
To find what RET is doing, you can try C-h k RET
, which shows that RET is bound to markdown-enter-key
which is clearing empty spaces at the end.
One way to solve this problem is to remove that binding in markdown mode. For that, you can add this to your config(init.el or .emacs.el).
(require 'markdown-mode)
(define-key markdown-mode-map (kbd "C-m") nil)
This prevents binding of RET to markdown-enter-key
and it works like normal return
An altertanate way to achieve it is setting
(custom-set-variables '(markdown-indent-on-enter nil))
This prevents deleting whitespace automatically.