Function: markdown-back-to-heading-over-code-block

markdown-back-to-heading-over-code-block is a byte-compiled function defined in markdown-mode.el.

Signature

(markdown-back-to-heading-over-code-block &optional INVISIBLE-OK NO-ERROR)

Documentation

Move back to the beginning of the previous heading.

Returns t if the point is at a heading, the location if a heading was found, and nil otherwise. Only visible heading lines are considered, unless INVISIBLE-OK is non-nil. Throw an error if there is no previous heading unless NO-ERROR is non-nil. Leaves match data intact for markdown-regex-header.

Source Code

;; Defined in ~/.emacs.d/elpa/markdown-mode-20260321.143/markdown-mode.el
(defun markdown-back-to-heading-over-code-block (&optional invisible-ok no-error)
  "Move back to the beginning of the previous heading.
Returns t if the point is at a heading, the location if a heading
was found, and nil otherwise.
Only visible heading lines are considered, unless INVISIBLE-OK is
non-nil.  Throw an error if there is no previous heading unless
NO-ERROR is non-nil.
Leaves match data intact for `markdown-regex-header'."
  (beginning-of-line)
  (or (and (markdown-heading-at-point)
           (not (markdown-code-block-at-point-p)))
      (let (found)
        (save-excursion
          (while (and (not found)
                      (re-search-backward markdown-regex-header nil t))
            (when (and (or invisible-ok (not (outline-invisible-p)))
                       (not (markdown-code-block-at-point-p)))
              (setq found (point))))
          (if (not found)
              (unless no-error (user-error "Before first heading"))
            (setq found (point))))
        (when found (goto-char found)))))