Function: markdown-ts--node-containing

markdown-ts--node-containing is a byte-compiled function defined in markdown-ts-mode.el.gz.

Signature

(markdown-ts--node-containing POS TYPE)

Documentation

Return the innermost node matching TYPE that contains POS, or nil.

TYPE is as in treesit-parent-until. When no leaf node covers POS, treesit-node-at falls back to one that merely ends at POS, which does not contain POS and must not be reported here.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/markdown-ts-mode.el.gz
(defun markdown-ts--node-containing (pos type)
  "Return the innermost node matching TYPE that contains POS, or nil.
TYPE is as in `treesit-parent-until'.  When no leaf node covers POS,
`treesit-node-at' falls back to one that merely ends at POS, which does
not contain POS and must not be reported here."
  (and-let* ((node (treesit-node-at pos 'markdown))
             (parent (treesit-parent-until node type))
             ((<= (treesit-node-start parent) pos))
             ((< pos (treesit-node-end parent))))
    parent))