Skip to content

Commit 4dde4b9

Browse files
committed
typst,pandoc - explicitly encode units when none are given
1 parent 4398072 commit 4dde4b9

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/resources/filters/quarto-post/typst.lua

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,16 @@ function render_typst_fixups()
9696
traverse = "topdown",
9797
Image = function(image)
9898
image = _quarto.modules.mediabag.resolve_image_from_url(image) or image
99+
-- REMINDME 2024-09-01
100+
-- work around until https://github.com/jgm/pandoc/issues/9945 is fixed
101+
local height_as_number = tonumber(image.attributes["height"])
102+
local width_as_number = tonumber(image.attributes["width"])
103+
if image.attributes["height"] ~= nil and type(height_as_number) == "number" then
104+
image.attributes["height"] = tostring(image.attributes["height"] / PANDOC_WRITER_OPTIONS.dpi) .. "in"
105+
end
106+
if image.attributes["width"] ~= nil and type(width_as_number) == "number" then
107+
image.attributes["width"] = tostring(image.attributes["width"] / PANDOC_WRITER_OPTIONS.dpi) .. "in"
108+
end
99109
return image
100110
end,
101111
Div = function(div)

0 commit comments

Comments
 (0)