Function: markdown-ts--table-aligners

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

Signature

(markdown-ts--table-aligners TABLE)

Documentation

Extract the header line aligners from node TABLE.

Return a list of lists of the form:
  (:beg xxx :end xxx :align left)
:align is one of left center right unspecified.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/markdown-ts-mode.el.gz
(defun markdown-ts--table-aligners (table)
  "Extract the header line aligners from node TABLE.
Return a list of lists of the form:
  (:beg xxx :end xxx :align left)
:align is one of `left' `center' `right' `unspecified'."
  (let* ((delimiter-row (treesit-search-subtree
                         table
                         "\\`pipe_table_delimiter_row\\'"))
         (aligners
          (let (res)
            (dolist (elt (treesit-node-children delimiter-row 'named))
              (let ((align-beg (treesit-node-type
                                (treesit-node-child elt 0 'name)))
                    (align-end (treesit-node-type
                                (treesit-node-child elt -1 'name))))
                (push (list
                       :beg (treesit-node-start elt)
                       :end (treesit-node-end elt)
                       :align
                       (cond ((and
                               (equal align-beg "pipe_table_align_left")
                               (equal align-end "pipe_table_align_left"))
                              'left)
                             ((and
                               (equal align-beg "pipe_table_align_left")
                               (equal align-end "pipe_table_align_right"))
                              'center)
                             ((and
                               (equal align-beg "pipe_table_align_right")
                               (equal align-end "pipe_table_align_right"))
                              'right)
                             (t 'unspecified)))
                      res)))
            (nreverse res))))
    aligners))