Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/resources/extensions/quarto/placeholder/placeholder.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,24 @@ return {
local svg64 = "data:image/svg+xml;base64," .. quarto.base64.encode(svg)
local result

if kwargs["format"] == "svg" then
local output_format = pandoc.utils.stringify(kwargs["format"])
if output_format == "" then
if quarto.format.is_typst_output() then
output_format = "svg"
else
output_format = "png"
end
end

if output_format == "svg" then
result = svg64
else
local mt, contents = pandoc.mediabag.fetch("https://svg2png.deno.dev/" .. svg64)
if mt ~= "image/png" then
error("Expected image/png but got " .. mt)
error(contents)
return pandoc.Str("Error rendering placeholder")
end
result = "data:" .. mt .. ";base64," .. quarto.base64.encode(contents)
end

Expand Down
Loading