Function: cider--popup-insert-rich-content

cider--popup-insert-rich-content is a byte-compiled function defined in cider-eval.el.

Signature

(cider--popup-insert-rich-content BUFFER BODY CONTENT-TYPE)

Documentation

Insert BODY of CONTENT-TYPE at the end of the popup BUFFER.

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260822.1520/cider-eval.el
(defun cider--popup-insert-rich-content (buffer body content-type)
  "Insert BODY of CONTENT-TYPE at the end of the popup BUFFER."
  (with-current-buffer buffer
    (let ((inhibit-read-only t))
      (goto-char (point-max))
      (cond
       ((when-let* ((image-type (cdr (assoc (car content-type)
                                            cider--image-content-types))))
          (insert-image (create-image body image-type t) " ")
          (insert "\n")
          t))
       ((when-let* ((url (cider--external-body-url content-type)))
          (insert-text-button url
                              'follow-link t
                              'help-echo "Open in the browser"
                              'action (lambda (_button) (browse-url url)))
          (insert " ")
          (insert-text-button "[show content]"
                              'follow-link t
                              'help-echo (format "Fetch %s and render it here" url)
                              'action (lambda (_button)
                                        (cider--popup-fetch-external-body buffer url)))
          (insert "\n")
          t))
       ((equal (car content-type) "text/html")
        (insert (cider--render-html-string body) "\n"))
       (t (insert body "\n"))))))