Function: htmlize-region-for-paste

htmlize-region-for-paste is a byte-compiled function defined in htmlize.el.

Signature

(htmlize-region-for-paste BEG END)

Documentation

Htmlize the region and return just the HTML as a string.

This forces the inline-css style and only returns the HTML body, but without the BODY tag. This should make it useful for inserting the text to another HTML buffer.

Source Code

;; Defined in ~/.emacs.d/elpa/htmlize-20250724.1703/htmlize.el
(defun htmlize-region-for-paste (beg end)
  "Htmlize the region and return just the HTML as a string.
This forces the `inline-css' style and only returns the HTML body,
but without the BODY tag.  This should make it useful for inserting
the text to another HTML buffer."
  (let* ((htmlize-output-type 'inline-css)
         (htmlbuf (htmlize-region beg end)))
    (unwind-protect
        (with-current-buffer htmlbuf
          (buffer-substring (plist-get htmlize-buffer-places 'content-start)
                            (plist-get htmlize-buffer-places 'content-end)))
      (kill-buffer htmlbuf))))