-
|
I have this code in a Lua filter: function Image(el)
if el.classes:includes('png_full') then
el.src = resolve_url(el.src)
el.attributes["style"] = "border: none;"
el.attributes["loading"] = "lazy"
-- line 27 below
return pandoc.Div(
{ el },
{ style = "text-align: center;" }
)
end
return el
endRunning this code, I get: Is this not the indended use of <div style="text-align: center;">
<img loading="lazy" style="border: none;" src="$resolved_source$"></img>
</div> |
Beta Was this translation helpful? Give feedback.
Answered by
jgm
Dec 10, 2025
Replies: 1 comment 4 replies
-
|
Image is an Inline element, while Div is a Block element. You can't replace an Inline with a Block; the types don't match. (I'm not sure why this precise error message was produced, though. @tarleb may be able to clarify.) |
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
l1mey112
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Image is an Inline element, while Div is a Block element. You can't replace an Inline with a Block; the types don't match. (I'm not sure why this precise error message was produced, though. @tarleb may be able to clarify.)