Function: htmlize-region

htmlize-region is an autoloaded, interactive and byte-compiled function defined in htmlize.el.

Signature

(htmlize-region BEG END &optional INTERACTIVE)

Documentation

Convert the region to HTML, preserving colors and decorations.

See htmlize-buffer for details.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/htmlize-20250724.1703/htmlize.el
;;;###autoload
(defun htmlize-region (beg end &optional interactive)
  "Convert the region to HTML, preserving colors and decorations.
See `htmlize-buffer' for details."
  (interactive "r\np")
  ;; Don't let zmacs region highlighting end up in HTML.
  (when (fboundp 'zmacs-deactivate-region)
    (zmacs-deactivate-region))
  (let ((htmlbuf (save-restriction
                   (narrow-to-region beg end)
                   (htmlize-buffer-1))))
    (when interactive
      (switch-to-buffer htmlbuf))
    htmlbuf))