if FORMAT:match 'latex' then -- Setting custom `listings` style function Meta(m) m["header-includes"] = pandoc.MetaBlocks({pandoc.RawBlock("latex",[[ \lstdefinestyle{weaver}{ basicstyle=\small\ttfamily, backgroundcolor=\color{gray!10}, xleftmargin=0.5cm, numbers=left, numbersep=5pt, numberstyle=\tiny\color{gray}, captionpos=b } \lstset{style=weaver} ]])}) return m end function CodeBlock(b) -- Remove `path` attribute and merge it with `id` if b.attributes.path and b.identifier then b.identifier = b.attributes.path .. b.identifier b.attributes.path = nil end -- Add ID to caption if b.identifier then if b.attributes.caption then b.attributes.caption = b.identifier .. ": " .. b.attributes.caption else b.attributes.caption = b.identifier end end return b end end