Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A Pandoc lua filter that applies Pandoc fenced Div styling (https://pandoc.org/MANUAL.html#divs-and-spans) to Word and Latex/PDF output, as well as HTML.
function Div (elem)
if FORMAT:match 'docx' then
if elem.classes[1] == "notes" then
elem.attributes['custom-style'] = 'Notes'
return elem
else
return elem
end
elseif FORMAT:match 'latex' then
if elem.classes[1] == "notes" then
return {
pandoc.RawBlock('latex', '\\begin{tcolorbox}[beforeafter skip=1cm, ignore nobreak=true, breakable, colframe=Apricot!20!white, colback=Apricot!8!white, boxsep=2mm, arc=0mm, boxrule=0.5mm]'),
elem,
pandoc.RawBlock('latex', '\\end{tcolorbox}')
}
else
return elem
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment