Skip to content

Commit ae03e85

Browse files
authored
Add svg rendering support (#2990)
1 parent 2a46c60 commit ae03e85

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

cider-repl.el

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -910,6 +910,13 @@ Part of the default `cider-repl-content-type-handler-alist'."
910910
(cider-repl--image image 'png t)
911911
show-prefix bol))
912912

913+
(defun cider-repl-handle-svg (_type buffer image &optional show-prefix bol)
914+
"A handler for inserting an svg IMAGE into a repl BUFFER.
915+
Part of the default `cider-repl-content-type-handler-alist'."
916+
(cider-repl--display-image buffer
917+
(cider-repl--image image 'svg t)
918+
show-prefix bol))
919+
913920
(defun cider-repl-handle-external-body (type buffer _ &optional _show-prefix _bol)
914921
"Handler for slurping external content into BUFFER.
915922
Handles an external-body TYPE by issuing a slurp request to fetch the content."
@@ -924,7 +931,8 @@ Handles an external-body TYPE by issuing a slurp request to fetch the content."
924931
(defvar cider-repl-content-type-handler-alist
925932
`(("message/external-body" . ,#'cider-repl-handle-external-body)
926933
("image/jpeg" . ,#'cider-repl-handle-jpeg)
927-
("image/png" . ,#'cider-repl-handle-png))
934+
("image/png" . ,#'cider-repl-handle-png)
935+
("image/svg+xml" . ,#'cider-repl-handle-svg))
928936
"Association list from content-types to handlers.
929937
Handlers must be functions of two required and two optional arguments - the
930938
REPL buffer to insert into, the value of the given content type as a raw

0 commit comments

Comments
 (0)