Function: htmlize-css-insert-head
htmlize-css-insert-head is a byte-compiled function defined in
htmlize.el.
Signature
(htmlize-css-insert-head BUFFER-FACES FACE-MAP)
Source Code
;; Defined in ~/.emacs.d/elpa/htmlize-20250724.1703/htmlize.el
(defun htmlize-css-insert-head (buffer-faces face-map)
(insert " <style type=\"text/css\">\n <!--\n")
(insert " body {\n "
(mapconcat #'identity
(htmlize-css-specs (gethash 'default face-map))
"\n ")
"\n }\n")
(dolist (face (cl-sort (cl-copy-list buffer-faces) #'string-lessp
:key (lambda (f)
(htmlize-fstruct-css-name
(gethash f face-map)))))
(let* ((fstruct (gethash face face-map))
(cleaned-up-face-name
(let ((s
;; Use `prin1-to-string' rather than `symbol-name'
;; to get the face name because the "face" can also
;; be an attrlist, which is not a symbol.
(prin1-to-string face)))
;; If the name contains `--' or `*/', remove them.
(while (string-match "--" s)
(setq s (replace-match "-" t t s)))
(while (string-match "\\*/" s)
(setq s (replace-match "XX" t t s)))
s))
(specs (htmlize-css-specs fstruct)))
(insert " ." (htmlize-fstruct-css-name fstruct))
(if (null specs)
(insert " {")
(insert " {\n /* " cleaned-up-face-name " */\n "
(mapconcat #'identity specs "\n ")))
(insert "\n }\n")))
(insert htmlize-hyperlink-style
" -->\n </style>\n"))