Function: markdown-ts--fontify-unordered-list-marker

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

Signature

(markdown-ts--fontify-unordered-list-marker NODE OVERRIDE START END &rest _)

Documentation

Fontify unordered list marker NODE, show a symbol when markup is hidden.

OVERRIDE, START, and END are passed through to treesit-fontify-with-override.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/markdown-ts-mode.el.gz
(defun markdown-ts--fontify-unordered-list-marker (node override start end &rest _)
  "Fontify unordered list marker NODE, show a symbol when markup is hidden.
OVERRIDE, START, and END are passed through to
`treesit-fontify-with-override'."
  ;; The tree-sitter markdown grammar includes the leading indentation
  ;; in the first list_marker_minus/plus/star node of a list, so skip
  ;; over any leading whitespace to avoid overwriting the indent with
  ;; the replacement glyph.
  (let* ((raw-start (treesit-node-start node))
         (node-end (treesit-node-end node))
         (node-start (save-excursion
                       (goto-char raw-start)
                       (skip-chars-forward " \t" node-end)
                       (point)))
         (face 'markdown-ts-list-marker))
    (treesit-fontify-with-override node-start node-end face
                                   override start end)
    (cond (markdown-ts-hide-markup
           (let* ((depth (markdown-ts--list-item-depth node))
                  (value (if markdown-ts-unordered-list-marker
                             (nth (mod depth (length markdown-ts-unordered-list-marker))
                                  markdown-ts-unordered-list-marker)
                           nil))
                  (display-spec (markdown-ts--resolve-display-value value)))
             (put-text-property node-start node-end 'display display-spec)))
          (t
           (remove-text-properties node-start node-end '(display nil))))))