Function: markdown-ts--fontify-entity

markdown-ts--fontify-entity is a byte-compiled function defined in markdown-ts-mode.el.gz.

Signature

(markdown-ts--fontify-entity NODE OVERRIDE START END &rest _)

Documentation

Fontify entity NODE and show its decoded value 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-entity (node override start end &rest _)
  "Fontify entity NODE and show its decoded value 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))
        (face (if (equal (treesit-node-type node) "entity_reference")
                  'markdown-ts-entity-reference
                'markdown-ts-numeric-character-reference)))
    (treesit-fontify-with-override node-start node-end face
                                   override start end)
    (if markdown-ts-hide-markup
        (when-let* ((decoded (markdown-ts--decode-entity
                              (treesit-node-text node t)))
                    ((char-displayable-p (aref decoded 0))))
          (put-text-property node-start node-end 'display decoded))
      (remove-text-properties node-start node-end '(display nil)))))