diff --git a/src/display_methods.jl b/src/display_methods.jl index 75e9b97..a28becf 100644 --- a/src/display_methods.jl +++ b/src/display_methods.jl @@ -31,7 +31,7 @@ const default_mime_types = ["image/svg+xml", "image/png", "text/html", "text/pla #From IJulia as a reminder #const supported_mime_types = [ "text/html", "text/latex", "image/svg+xml", "image/png", "image/jpeg", "text/plain", "text/markdown" ] -const mimetype_from_fig_ext = +const mimetype_ext = Dict(".png" => "image/png", ".jpg" => "image/jpeg", ".jpeg" => "image/jpeg", @@ -41,7 +41,7 @@ const mimetype_from_fig_ext = function Base.display(report::Report, data) #Set preferred mimetypes for report based on format fig_ext = report.cur_chunk.options[:fig_ext] - for m in Iterators.flatten(((mimetype_from_fig_ext[fig_ext], ), report.mimetypes)) + for m in unique([mimetype_ext[fig_ext] ; report.mimetypes]) if showable(m, data) try if !istextmime(m) diff --git a/src/run.jl b/src/run.jl index 56e2a6e..ac7e53e 100644 --- a/src/run.jl +++ b/src/run.jl @@ -155,7 +155,7 @@ function img2base64(fig, cwd) if ext == ".png" return "data:image/png;base64," * stringmime(MIME("image/png"), raw) elseif ext == ".svg" - return "data:image/svg+xml;base64," * stringmime(MIME("image/svg+xml"), raw) + return "data:image/svg+xml;base64," * stringmime(MIME("image/svg"), raw) elseif ext == ".gif" return "data:image/gif;base64," * stringmime(MIME("image/gif"), raw) else