Function: htmlize-generate-image
htmlize-generate-image is a byte-compiled function defined in
htmlize.el.
Signature
(htmlize-generate-image IMGPROPS ORIGTEXT)
Source Code
;; Defined in ~/.emacs.d/elpa/htmlize-20250724.1703/htmlize.el
(defun htmlize-generate-image (imgprops origtext)
(let* ((alt-text (htmlize-alt-text imgprops origtext))
(alt-attr (if alt-text
(format " alt=\"%s\"" (htmlize-attr-escape alt-text))
"")))
(cond ((plist-get imgprops :file)
;; Try to find the image in image-load-path
(let* ((found-props (cdr (find-image (list imgprops))))
(file (or (plist-get found-props :file)
(plist-get imgprops :file))))
(format "<img src=\"%s\"%s />"
(htmlize-attr-escape (file-relative-name file))
alt-attr)))
((plist-get imgprops :data)
(let ((image-type (plist-get imgprops :type)))
(format "<img src=\"data:image/%s;base64,%s\"%s />"
(or (alist-get image-type htmlize-image-mime-type-alist)
image-type "")
(base64-encode-string (plist-get imgprops :data))
alt-attr))))))