Function: treesit-outline-level

treesit-outline-level is a byte-compiled function defined in treesit.el.gz.

Signature

(treesit-outline-level)

Documentation

Return the depth of the current outline heading.

Source Code

;; Defined in /usr/src/emacs/lisp/treesit.el.gz
(defun treesit-outline-level ()
  "Return the depth of the current outline heading."
  (let* ((node (treesit-node-at (point) nil t))
         (level (if (treesit-node-match-p node treesit-outline-predicate)
                    1 0)))
    (while (setq node (treesit-parent-until node treesit-outline-predicate))
      (setq level (1+ level)))
    (if (zerop level) 1 level)))