Function: markdown-insert-table
markdown-insert-table is an interactive and byte-compiled function
defined in markdown-mode.el.
Signature
(markdown-insert-table &optional ROWS COLUMNS ALIGN)
Documentation
Insert an empty pipe table.
Optional arguments ROWS, COLUMNS, and ALIGN specify number of rows and columns and the column alignment.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/markdown-mode-20260321.143/markdown-mode.el
(defun markdown-insert-table (&optional rows columns align)
"Insert an empty pipe table.
Optional arguments ROWS, COLUMNS, and ALIGN specify number of
rows and columns and the column alignment."
(interactive)
(let* ((rows (or rows (read-number "Number of Rows: ")))
(columns (or columns (read-number "Number of Columns: ")))
(align (or align (read-string "Alignment ([l]eft, [r]ight, [c]enter, or RET for default): ")))
(align (cond ((equal align "l") ":--")
((equal align "r") "--:")
((equal align "c") ":-:")
(t "---")))
(pos (point))
(indent (make-string (current-column) ?\ ))
(line (concat
(apply 'concat indent "|"
(make-list columns " |")) "\n"))
(hline (apply 'concat indent "|"
(make-list columns (concat align "|")))))
(if (string-match
"^[ \t]*$" (buffer-substring-no-properties
(line-beginning-position) (point)))
(beginning-of-line 1)
(newline))
(dotimes (_ rows) (insert line))
(goto-char pos)
(if (> rows 1)
(progn
(end-of-line 1) (insert (concat "\n" hline)) (goto-char pos)))
(markdown-table-forward-cell)))