Function: markdown-insert-gfm-checkbox

markdown-insert-gfm-checkbox is an interactive and byte-compiled function defined in markdown-mode.el.

Signature

(markdown-insert-gfm-checkbox)

Documentation

Add GFM checkbox at point.

Returns t if added. Returns nil if non-applicable.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/markdown-mode-20260321.143/markdown-mode.el
(defun markdown-insert-gfm-checkbox ()
  "Add GFM checkbox at point.
Returns t if added.
Returns nil if non-applicable."
  (interactive)
  (let ((bounds (markdown-cur-list-item-bounds)))
    (if bounds
        (unless (cl-sixth bounds)
          (let ((pos (+ (cl-first bounds) (cl-fourth bounds)))
                (markup "[ ] "))
            (if (< pos (point))
                (save-excursion
                  (goto-char pos)
                  (insert markup))
              (goto-char pos)
              (insert markup))
            (syntax-propertize (+ (cl-second bounds) 4))
            t))
      (unless (save-excursion
                (back-to-indentation)
                (or (markdown-list-item-at-point-p)
                    (markdown-heading-at-point)
                    (markdown-in-comment-p)
                    (markdown-code-block-at-point-p)))
        (let ((pos (save-excursion
                     (back-to-indentation)
                     (point)))
              (markup (concat (or (save-excursion
                                    (beginning-of-line 0)
                                    (cl-fifth (markdown-cur-list-item-bounds)))
                                  markdown-unordered-list-item-prefix)
                              "[ ] ")))
          (if (< pos (point))
              (save-excursion
                (goto-char pos)
                (insert markup))
            (goto-char pos)
            (insert markup))
          (syntax-propertize (line-end-position))
          t)))))