When i convert from markdown to docx I would like to use a luafilter to add styling to my images. I have a css snippet that does the styling I want within obsidian, but this doesnt affect pandoc conversion to docx. I also have another luafiler that emables to center-align the images i want (I haven't written it my self). Ideally I'd like to have another luafilter, that enables me to toggle the custom styling (add borders) to my images.
function Image (img)
align = 'left'
for k, v in pairs(img.classes) do
if v == 'center' then
align = 'center'
elseif v == 'right' then
align = 'right'
end
end
ret_img = {
pandoc.RawInline('openxml', string.format('<w:pPr><w:jc w:val="%s"/></w:pPr>', align)),
img
}
return ret_img
end
which allows me to add ![text that isnt transferred to docx anyway](imgpath.png){.center}.
The CCS to add border styling is simple:
img {
border: 1px solid #d8d5d4;
padding: 5px;
border-radius: 5px;
}
I would also like to be able to invoke that with for instance .border.
I've been searching for a full day, trying different things out - so I hope my possible rookie question is acceptable.