That's due to electric-indent-mode
, which is a global minor mode.
You could add (electric-indent-mode -1)
to your init file to disable it entirely, or you could try using a custom electric-indent-functions
function.
The following is only minimally tested, but might do the trick:
(add-hook 'html-mode-hook 'my-html-mode-hook)
(defun my-html-mode-hook ()
"Custom `html-mode' behaviours."
(add-hook 'electric-indent-functions
'my-html-mode-electric-indent-maybe nil :local))
(defun my-html-mode-electric-indent-maybe (_char)
"Used in `electric-indent-functions'."
(save-excursion
(when (ignore-errors
(string= (sgml-tag-name (sgml-parse-tag-backward))
"script"))
'no-indent)))
RET
is already binding tomarkdown-enter-key
by default.C-h c RET
outputsRET (translated from <return>) runs the command markdown-enter-key
from here. – xuchunyang Aug 11 '18 at 8:00