Variable: markdown-indent-on-enter
markdown-indent-on-enter is a customizable variable defined in
markdown-mode.el.
Value
t
Documentation
Determines indentation behavior when pressing RET (newline).
Possible settings are nil, t, and 'indent-and-new-item.
When non-nil, pressing RET (newline) will call newline-and-indent
to indent the following line according to the context using
markdown-indent-function. In this case, note that
C-j (electric-newline-and-maybe-indent) can still be used to insert
a newline without indentation.
When set to 'indent-and-new-item and the point is in a list item
when RET (newline) is pressed, the list will be continued on the next
line, where a new item will be inserted.
When set to nil, simply call newline as usual. In this case,
you can still indent lines using M-x markdown-cycle (markdown-cycle) and continue
lists with M-x markdown-insert-list-item (markdown-insert-list-item).
Note that this assumes the variable electric-indent-mode(var)/electric-indent-mode(fun) is
non-nil (enabled). When it is *disabled*, the behavior of
RET (newline) and C-j (electric-newline-and-maybe-indent) are
reversed.
Source Code
;; Defined in ~/.emacs.d/elpa/markdown-mode-20260321.143/markdown-mode.el
(defcustom markdown-indent-on-enter t
"Determines indentation behavior when pressing \\[newline].
Possible settings are nil, t, and \\='indent-and-new-item.
When non-nil, pressing \\[newline] will call `newline-and-indent'
to indent the following line according to the context using
`markdown-indent-function'. In this case, note that
\\[electric-newline-and-maybe-indent] can still be used to insert
a newline without indentation.
When set to \\='indent-and-new-item and the point is in a list item
when \\[newline] is pressed, the list will be continued on the next
line, where a new item will be inserted.
When set to nil, simply call `newline' as usual. In this case,
you can still indent lines using \\[markdown-cycle] and continue
lists with \\[markdown-insert-list-item].
Note that this assumes the variable `electric-indent-mode' is
non-nil (enabled). When it is *disabled*, the behavior of
\\[newline] and `\\[electric-newline-and-maybe-indent]' are
reversed."
:group 'markdown
:type '(choice (const :tag "Don't automatically indent" nil)
(const :tag "Automatically indent" t)
(const :tag "Automatically indent and insert new list items" indent-and-new-item)))