Function: markdown-backward-block
markdown-backward-block is an interactive and byte-compiled function
defined in markdown-mode.el.
Signature
(markdown-backward-block &optional ARG)
Documentation
Move the point to the start of the current Markdown block.
Moves across complete code blocks, list items, and blockquotes, but otherwise stops at blank lines, headers, and horizontal rules. With argument ARG, do it ARG times; a negative argument ARG = -N means move forward N blocks.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/markdown-mode-20260321.143/markdown-mode.el
(defun markdown-backward-block (&optional arg)
"Move the point to the start of the current Markdown block.
Moves across complete code blocks, list items, and blockquotes,
but otherwise stops at blank lines, headers, and horizontal
rules. With argument ARG, do it ARG times; a negative argument
ARG = -N means move forward N blocks."
(interactive "^p")
(or arg (setq arg 1))
(if (< arg 0)
(markdown-forward-block (- arg))
(dotimes (_ arg)
;; Skip over whitespace in between blocks when moving backward,
;; unless at a block boundary with no whitespace.
(skip-syntax-backward "-")
(beginning-of-line)
;; Proceed forward based on the type of block.
(cond
;; Code blocks
((and (markdown-code-block-at-pos (point)) ;; this line
(markdown-code-block-at-pos (line-beginning-position 0))) ;; previous line
(forward-line -1)
(while (and (markdown-code-block-at-point-p) (not (bobp)))
(forward-line -1))
(forward-line))
;; Headings
((markdown-heading-at-point)
(goto-char (match-beginning 0)))
;; Horizontal rules
((looking-at markdown-regex-hr))
;; Blockquotes
((looking-at markdown-regex-blockquote)
(forward-line -1)
(while (and (looking-at markdown-regex-blockquote)
(not (bobp)))
(forward-line -1))
(forward-line))
;; List items
((markdown-cur-list-item-bounds)
(markdown-beginning-of-list))
;; Other
(t
;; Move forward in case it is a one line regular paragraph.
(unless (markdown-next-line-blank-p)
(forward-line))
(unless (markdown-prev-line-blank-p)
(markdown-backward-paragraph)))))))