Function: markdown-end-of-subtree

markdown-end-of-subtree is a byte-compiled function defined in markdown-mode.el.

Signature

(markdown-end-of-subtree &optional INVISIBLE-OK)

Documentation

Move to the end of the current subtree.

Only visible heading lines are considered, unless INVISIBLE-OK is non-nil. Derived from org-end-of-subtree.

Source Code

;; Defined in ~/.emacs.d/elpa/markdown-mode-20260321.143/markdown-mode.el
(defun markdown-end-of-subtree (&optional invisible-OK)
  "Move to the end of the current subtree.
Only visible heading lines are considered, unless INVISIBLE-OK is
non-nil.
Derived from `org-end-of-subtree'."
  (markdown-back-to-heading invisible-OK)
  (let ((first t)
        (level (markdown-outline-level)))
    (while (and (not (eobp))
                (or first (> (markdown-outline-level) level)))
      (setq first nil)
      (markdown-next-heading))
    (if (memq (preceding-char) '(?\n ?\^M))
        (progn
          ;; Go to end of line before heading
          (forward-char -1)
          (if (memq (preceding-char) '(?\n ?\^M))
              ;; leave blank line before heading
              (forward-char -1)))))
  (point))