C-h k RET (or M-x describe-key RET) displays:
RET (translated from ) runs the command newline [...]
Insert a newline, and move to left margin of the new line if it’s blank. [...]
If ‘electric-indent-mode’ is enabled, this indents the final new line
that it adds, and reindents the preceding line. To just insert
a newline, use M-x electric-indent-just-...
You need to either set the default value of the variable, if you want it for every file:
(setq-default require-final-newline t)
;; or ...
(customize-set-variable 'require-final-newline t)
or to set it in the mode hook, if you only want it for files of that mode:
(add-hook 'some-mode-hook (lambda () (setq-local require-final-newline t)))
The reason that a ...
In Markdown, two spaces at the end of the line cause a hard line break. markdown-mode highlights those for you, because otherwise they are indistinguishable from soft line breaks. It seems you have trailing white space in your diagram.
However, this is a bug since it shouldn't apply that face to trailing whitespace inside a code block.
I don't know if there is a regular command for that (maybe there is one in the emacs-lisp state) but of course you could define your own custom function. e.g.
(defun custom-lisp-paste (&optional count)
(insert " ")
And bind it to your prefered key. you could ...