Function: gfm--table-at-point-p

gfm--table-at-point-p is a byte-compiled function defined in markdown-mode.el.

Signature

(gfm--table-at-point-p)

Documentation

Return non-nil when point is inside a gfm-compatible table.

Source Code

;; Defined in ~/.emacs.d/elpa/markdown-mode-20260321.143/markdown-mode.el
;; GFM simplified tables syntax is as follows:
;; - A header line for the column names, this is any text
;;   separated by `|'.
;; - Followed by a string -|-|- ..., the number of dashes is optional
;;   but must be higher than 1. The number of separators should match
;;   the number of columns.
;; - Followed by the rows of data, which has the same format as the
;;   header line.
;; Example:
;;
;; foo | bar
;; ------|---------
;; bar | baz
;; bar | baz
(defun gfm--table-at-point-p ()
  "Return non-nil when point is inside a gfm-compatible table."
  (or (markdown--table-at-point-p)
      (save-excursion
        (beginning-of-line)
        (when (looking-at-p gfm-table-line-regexp)
          ;; we might be at the first line of the table, check if the
          ;; line below is the hline
          (or (save-excursion
                (forward-line 1)
                (looking-at-p gfm-table-hline-regexp))
              ;; go up to find the header
              (catch 'done
                (while (looking-at-p gfm-table-line-regexp)
                  (cond
                   ((looking-at-p gfm-table-hline-regexp)
                    (throw 'done t))
                   ((bobp)
                    (throw 'done nil)))
                  (forward-line -1))
                nil))))))