Function: markdown-ts--fontify-delimiter

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

Signature

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

Documentation

Fontify delimiter NODE and optionally hide its markup.

NODE is the tree-sitter node representing the delimiter. 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
;;; Font-lock:

(defun markdown-ts--fontify-delimiter (node override start end &rest _)
  "Fontify delimiter NODE and optionally hide its markup.
NODE is the tree-sitter node representing the delimiter.
OVERRIDE, START, and END are passed through to
`treesit-fontify-with-override'."
  (treesit-fontify-with-override
   (treesit-node-start node) (treesit-node-end node)
   'markdown-ts-delimiter override start end)
  (when markdown-ts-hide-markup
    (if (and (derived-mode-p 'markdown-ts-view-mode)
             (equal (treesit-node-type node) "fenced_code_block_delimiter"))
        ;; In view-mode only, hide the whole line containing the fence
        ;; (including its terminating newline) so Eldoc/LSP markdown
        ;; snippets render without stray blank lines around the code
        ;; block.  Restricted to view-mode because hide-markup while
        ;; editing already has UX hazards (point movement, backspace
        ;; across invisible regions) and we should not tune rendering
        ;; for that mode.  Restricted to fenced_code_block_delimiter
        ;; because the same handler is shared by inline delimiters
        ;; (emphasis, code span, link brackets) where munching
        ;; surrounding whitespace would collapse word separators.
        (save-excursion
          (goto-char (treesit-node-start node))
          (let ((bol (pos-bol))
                (eol+1 (progn (goto-char (treesit-node-end node))
                              (min (point-max) (1+ (pos-eol))))))
            (put-text-property bol eol+1
                               'invisible 'markdown-ts--markup)))
      (put-text-property (treesit-node-start node) (treesit-node-end node)
                         'invisible 'markdown-ts--markup))))