jrblevin / markdown-mode

Emacs Markdown Mode
http://jblevins.org/projects/markdown-mode/
GNU General Public License v3.0
892 stars 162 forks source link

indent-and-new-item within a code block that is under a list should not add a new bullet #841

Open shipmints opened 1 month ago

shipmints commented 1 month ago

I expected that within a properly formed code block that is under a list item, that pressing RET with markdown-indent-on-enter set to 'indent-and-new-item would not add a new list item within the code block.

Is there a way to control this behavior? I perused the code, but it didn't obviously jump out at me.

shipmints commented 1 month ago

For the time being, I'm using this hack:

  (defun my/markdown-enter-key-advice (orig-fun &rest args)
    (let* ((bounds (markdown-get-enclosing-fenced-block-construct))
           (markdown-indent-on-enter (if bounds t markdown-indent-on-enter)))
      (apply orig-fun args)))
  (advice-add 'markdown-enter-key :around #'my/markdown-enter-key-advice)