Function: htmlize-default-transform-image
htmlize-default-transform-image is a byte-compiled function defined in
htmlize.el.
Signature
(htmlize-default-transform-image IMGPROPS TEXT)
Documentation
Default transformation of image descriptor to something usable in HTML.
If htmlize-use-images is nil, the function always returns nil, meaning
use original text. Otherwise, it tries to find the image for images that
specify a file name. If htmlize-force-inline-images is non-nil, it also
converts the :file attribute to :data and returns the modified property
list.
Source Code
;; Defined in ~/.emacs.d/elpa/htmlize-20250724.1703/htmlize.el
(defun htmlize-default-transform-image (imgprops _text)
"Default transformation of image descriptor to something usable in HTML.
If `htmlize-use-images' is nil, the function always returns nil, meaning
use original text. Otherwise, it tries to find the image for images that
specify a file name. If `htmlize-force-inline-images' is non-nil, it also
converts the :file attribute to :data and returns the modified property
list."
(when htmlize-use-images
(when (plist-get imgprops :file)
(let ((location (plist-get (cdr (find-image (list imgprops))) :file)))
(when location
(setq imgprops (plist-put (cl-copy-list imgprops) :file location)))))
(if htmlize-force-inline-images
(let ((location (plist-get imgprops :file))
data)
(when location
(with-temp-buffer
(condition-case nil
(progn
(insert-file-contents-literally location)
(setq data (buffer-string)))
(error nil))))
;; if successful, return the new plist, otherwise return
;; nil, which will use the original text
(and data
(plist-put (plist-put imgprops :file nil)
:data data)))
imgprops)))