Function: markdown-ts--list-item-new-marker

markdown-ts--list-item-new-marker is a byte-compiled function defined in markdown-ts-mode.el.gz.

Signature

(markdown-ts--list-item-new-marker ITEM)

Documentation

Return the marker string for a new item following ITEM.

For unordered items, reuse the same marker character. For ordered items, increment the number.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/markdown-ts-mode.el.gz
(defun markdown-ts--list-item-new-marker (item)
  "Return the marker string for a new item following ITEM.
For unordered items, reuse the same marker character.
For ordered items, increment the number."
  (let* ((marker (treesit-node-child item 0))
         (type (treesit-node-type marker))
         (indent (save-excursion
                   (goto-char (treesit-node-start item))
                   (current-indentation)))
         (prefix (make-string indent ?\s)))
    (pcase type
      ("list_marker_minus" (concat prefix "- "))
      ("list_marker_plus"  (concat prefix "+ "))
      ("list_marker_star"  (concat prefix "* "))
      ("list_marker_dot"
       (let ((num (string-to-number (treesit-node-text marker t))))
         (concat prefix (number-to-string (1+ num)) ". ")))
      ("list_marker_parenthesis"
       (let ((num (string-to-number (treesit-node-text marker t))))
         (concat prefix (number-to-string (1+ num)) ") ")))
      (_ (concat prefix "- ")))))