Function: htmlize-buffer
htmlize-buffer is an autoloaded, interactive and byte-compiled
function defined in htmlize.el.
Signature
(htmlize-buffer &optional BUFFER INTERACTIVE)
Documentation
Convert BUFFER to HTML, preserving colors and decorations.
The generated HTML is available in a new buffer, which is returned. When invoked interactively (or if optional INTERACTIVE is non-nil), the new buffer is selected in the current window. The title of the generated document will be set to the buffer's file name or, if that is not available, to the buffer's name.
Note that htmlize doesn't fontify your buffers, it only uses the decorations that are already present. If you don't set up font-lock or something else to fontify your buffers, the resulting HTML will be plain. Likewise, if you don't like the choice of colors, fix the mode that created them, or simply alter the faces it uses.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/htmlize-20250724.1703/htmlize.el
;;;###autoload
(defun htmlize-buffer (&optional buffer interactive)
"Convert BUFFER to HTML, preserving colors and decorations.
The generated HTML is available in a new buffer, which is returned.
When invoked interactively (or if optional INTERACTIVE is non-nil),
the new buffer is selected in the current window. The title of the
generated document will be set to the buffer's file name or, if that
is not available, to the buffer's name.
Note that htmlize doesn't fontify your buffers, it only uses the
decorations that are already present. If you don't set up font-lock or
something else to fontify your buffers, the resulting HTML will be
plain. Likewise, if you don't like the choice of colors, fix the mode
that created them, or simply alter the faces it uses."
(interactive "i\np")
(let ((htmlbuf (with-current-buffer (or buffer (current-buffer))
(htmlize-buffer-1))))
(when interactive
(switch-to-buffer htmlbuf))
htmlbuf))