File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -47,14 +47,27 @@ function limitstringmime(mime::MIME, x)
4747 return String (take! (buf))
4848end
4949
50+ const ipy_mime_json = [
51+ " application/vnd.dataresource+json" ,
52+ " application/vnd.vegalite.v2+json" ,
53+ " application/vnd.vega.v3+json" ,
54+ ]
55+ _display_dict (m:: MIME , m_str, x) = Dict (m_str=> limitstringmime (m, x))
56+ # escape JSON string correctly before send_ipython
57+ for mime in ipy_mime_json
58+ @eval begin
59+ _display_dict (m:: MIME{Symbol($mime)} , m_str, x) = Dict (m_str=> JSON. JSONText (limitstringmime (m, x)))
60+ end
61+ end
62+
5063for mime in ipy_mime
5164 @eval begin
5265 function display (d:: InlineDisplay , :: MIME{Symbol($mime)} , x)
5366 send_ipython (publish[],
5467 msg_pub (execute_msg, " display_data" ,
5568 Dict (
5669 " metadata" => metadata (x), # optional
57- " data" => Dict ( $ mime => limitstringmime ( MIME ($ mime), x) ))))
70+ " data" => _display_dict ( MIME ($ mime), $ mime, x ))))
5871 end
5972 displayable (d:: InlineDisplay , :: MIME{Symbol($mime)} ) = true
6073 end
You can’t perform that action at this time.
0 commit comments