You can use
with-out-str to capture the output into a string.
Knowing that you can take the
cider-pprint-eval-last-sexp-to-comment function, copy/paste it and make a small change.
(define-key cider-mode-map (kbd "C-c C-p")
(let* ((insert-before nil)
(bounds (cider-last-sexp 'bounds))
(insertion-point (nth (if insert-before 0 1) bounds))
(comment-postfix (concat cider-comment-postfix
(if insert-before "\n" ""))))
(cider-interactive-eval (concat "(with-out-str " (cider-last-sexp) " )")
(set-marker (make-marker) insertion-point)
This function prints the captured output instead of the value. If you use it on something that doesn't write to
*out* it will print the empty string.