Function: markdown-ts--latex-block-valid-p

markdown-ts--latex-block-valid-p is a byte-compiled function defined in markdown-ts-mode.el.gz.

Signature

(markdown-ts--latex-block-valid-p NODE)

Documentation

Return non-nil if latex block NODE is within a single inline scope.

The global inline parser can create false latex_block matches spanning across paragraph boundaries. Check that the opening and closing delimiters share the same markdown inline ancestor.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/markdown-ts-mode.el.gz
(defun markdown-ts--latex-block-valid-p (node)
  "Return non-nil if latex block NODE is within a single inline scope.
The global inline parser can create false `latex_block' matches
spanning across paragraph boundaries.  Check that the opening and
closing delimiters share the same markdown `inline' ancestor."
  (let ((node-start (treesit-node-start node))
        (node-end (1- (treesit-node-end node))))
    (when-let* ((md-start (treesit-node-at node-start 'markdown))
                (md-end (treesit-node-at node-end 'markdown))
                (inline-start (treesit-parent-until
                               md-start
                               (lambda (n)
                                 (equal (treesit-node-type n) "inline"))))
                (inline-end (treesit-parent-until
                             md-end
                             (lambda (n)
                               (equal (treesit-node-type n) "inline")))))
      (eq (treesit-node-start inline-start)
          (treesit-node-start inline-end)))))