Function: markdown-ts--find-next-code-block-delimiter

markdown-ts--find-next-code-block-delimiter is a byte-compiled function defined in markdown-ts-mode.el.gz.

Signature

(markdown-ts--find-next-code-block-delimiter &optional POS BACKWARD REMAIN)

Documentation

Return the next or previous fenced_code_block_delimiter node, or nil.

Search starting at POS or point, if POS is nil. Search backward if BACKWARD is non-nil. If REMAIN is non-nil, move to the top or bottom of the current code block, if in one.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/markdown-ts-mode.el.gz
(defun markdown-ts--find-next-code-block-delimiter (&optional
                                                    pos backward remain)
  "Return the next or previous fenced_code_block_delimiter node, or nil.
Search starting at POS or `point', if POS is nil.
Search backward if BACKWARD is non-nil.
If REMAIN is non-nil, move to the top or bottom of the current code
block, if in one."
  (setq pos (or pos (point)))
  (and-let* ((node (markdown-ts--find-code-block-delimiter pos backward)))
    (let ((in-block (markdown-ts-at-code-block-p pos)))
      (cond
       ((and remain in-block)
        node)
       (remain
        nil)
       (t
        (while (and node
                    ;; If backward, skip the current block's
                    ;; starting delimiter.
                    (or (and backward in-block (treesit-node-next-sibling node))
                        (not (treesit-node-next-sibling node))))
          (setq in-block (markdown-ts-at-code-block-p pos))
          (setq pos (if backward
                        (treesit-node-start node)
                      (treesit-node-end node)))
          (setq node (markdown-ts--find-code-block-delimiter pos backward)))
        node)))))