Function: markdown-ts--table-node-cell

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

Signature

(markdown-ts--table-node-cell &optional NODE POS ABUTTING)

Documentation

Compute table cell from named NODE at POS.

If NODE is nil, use the node at POS. If POS is nil, use point. If NODE is a cell type, return it. If NODE is a subtype, promote it. If ABUTTING is non-nil, adjust POS to the nearest non-blank character. Otherwise, return nil.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/markdown-ts-mode.el.gz
(defun markdown-ts--table-node-cell (&optional node pos abutting)
  "Compute table cell from named NODE at POS.
If NODE is nil, use the node at POS.
If POS is nil, use `point'.
If NODE is a cell type, return it.
If NODE is a subtype, promote it.
If ABUTTING is non-nil, adjust POS to the nearest non-blank character.
Otherwise, return nil."
  ;; We could sanity check via `treesit-node-named' and error if not.
  (setq pos (or pos (point)))
  (when abutting
    (setq pos (or (markdown-ts--table-abutting-pos pos) pos)))
  (when-let* ((node (or node
                        (treesit-node-at pos 'markdown 'named)))
              (type (treesit-node-type node)))
    (cond ((member type markdown-ts--table-cell-types)
           node)
          ((member type markdown-ts--table-delimiter-cell-subtypes)
           (treesit-node-parent node))
          ((member type markdown-ts--table-row-types)
           (cond ((eq abutting 'left)
                  (treesit-node-child node 0 'named))
                 ;; Account for 'right or t.
                 (t
                  (treesit-node-child node -1 'named)))))))