Function: htmlize-escape-or-link

htmlize-escape-or-link is a byte-compiled function defined in htmlize.el.

Signature

(htmlize-escape-or-link STRING)

Source Code

;; Defined in ~/.emacs.d/elpa/htmlize-20250724.1703/htmlize.el
(defun htmlize-escape-or-link (string)
  ;; Escape STRING and/or add hyperlinks.  STRING comes from a
  ;; `display' property.
  (let ((pos 0) (end (length string)) outlist)
    (while (< pos end)
      (let* ((link (get-char-property pos 'htmlize-link string))
             (next-link-change (next-single-property-change
                                pos 'htmlize-link string end))
             (chunk (substring string pos next-link-change)))
        (push
         (cond (link
                (htmlize-format-link link chunk))
               ((get-char-property 0 'htmlize-literal chunk)
                chunk)
               (t
                (htmlize-protect-string chunk)))
         outlist)
        (setq pos next-link-change)))
    (htmlize-concat (nreverse outlist))))