Function: markdown-backward-paragraph

markdown-backward-paragraph is an interactive and byte-compiled function defined in markdown-mode.el.

Signature

(markdown-backward-paragraph &optional ARG)

Documentation

Move the point to the start of the current paragraph.

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-paragraph (&optional arg)
  "Move the point to the start of the current paragraph.
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-paragraph (- arg))
    (dotimes (_ arg)
      ;; Skip over whitespace in between paragraphs when moving backward.
      (skip-chars-backward " \t\n")
      (beginning-of-line)
      ;; Skip over code block endings.
      (when (markdown-range-properties-exist
             (line-beginning-position) (line-end-position)
             '(markdown-gfm-block-end
               markdown-tilde-fence-end))
        (forward-line -1))
      ;; Skip over blank lines inside blockquotes.
      (while (and (not (eobp))
                  (looking-at markdown-regex-blockquote)
                  (= (length (match-string 3)) 0))
        (forward-line -1))
      ;; Proceed forward based on the type of block of paragraph.
      (let (bounds skip)
        (cond
         ;; Blockquotes
         ((looking-at markdown-regex-blockquote)
          (while (and (not (bobp))
                      (looking-at markdown-regex-blockquote)
                      (> (length (match-string 3)) 0)) ;; not blank
            (forward-line -1))
          (forward-line))
         ;; List items
         ((setq bounds (markdown-cur-list-item-bounds))
          (goto-char (nth 0 bounds)))
         ;; Other
         (t
          (while (and (not (bobp))
                      (not skip)
                      (not (markdown-cur-line-blank-p))
                      (not (looking-at markdown-regex-blockquote))
                      (not (markdown-range-properties-exist
                            (line-beginning-position) (line-end-position)
                            '(markdown-gfm-block-end
                              markdown-tilde-fence-end))))
            (setq skip (markdown-range-properties-exist
                        (line-beginning-position) (line-end-position)
                        '(markdown-gfm-block-begin
                          markdown-tilde-fence-begin)))
            (forward-line -1))
          (unless (bobp)
            (forward-line 1))))))))