public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Image styling md -> docx
@ 2023-04-27 13:29 Oskar Wood Hansen
       [not found] ` <8b721e7e-adfd-4a87-b4fa-fe1a2822b9c9n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Oskar Wood Hansen @ 2023-04-27 13:29 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 1680 bytes --]

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.

The working luafilter to align:

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. 

also once again praise to talber and jgm and co!

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/8b721e7e-adfd-4a87-b4fa-fe1a2822b9c9n%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 4322 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-05-09 12:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-27 13:29 Image styling md -> docx Oskar Wood Hansen
     [not found] ` <8b721e7e-adfd-4a87-b4fa-fe1a2822b9c9n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-05-09 12:14   ` Stephan Meijer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).