Function: markdown-ts--fontify-checkbox
markdown-ts--fontify-checkbox is a byte-compiled function defined in
markdown-ts-mode.el.gz.
Signature
(markdown-ts--fontify-checkbox NODE OVERRIDE START END &rest _)
Documentation
Fontify task list checkbox NODE, show a Unicode 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-checkbox (node override start end &rest _)
"Fontify task list checkbox NODE, show a Unicode symbol when markup is hidden.
OVERRIDE, START, and END are passed through to
`treesit-fontify-with-override'."
(let* ((node-start (treesit-node-start node))
(node-end (treesit-node-end node))
(checked (equal (treesit-node-type node) "task_list_marker_checked"))
(face (if checked 'markdown-ts-task-checked
'markdown-ts-task-unchecked))
(value (if checked
markdown-ts-checked-checkbox
markdown-ts-unchecked-checkbox))
(replacement
(cond ((eq value 'icon)
(icon-string (if checked
'markdown-ts-checked-checkbox-icon
'markdown-ts-unchecked-checkbox-icon)))
(t (markdown-ts--resolve-display-value value))))
;; If `icon-string' returned an image, its `display' property
;; on char 0 holds the actual image spec; nested `display'
;; props are not honored when a string is the value of a
;; `display' text-property, so apply the spec directly.
(display-spec
(or (and (eq value 'icon) replacement
(get-text-property 0 'display replacement))
replacement)))
(treesit-fontify-with-override node-start node-end face
override start end)
(if (and markdown-ts-hide-markup replacement
(or (eq value 'icon)
(char-displayable-p (aref replacement 0))))
(put-text-property node-start node-end 'display display-spec)
(remove-text-properties node-start node-end '(display nil)))))