Skip to content

Instantly share code, notes, and snippets.

@jmablog
Created January 30, 2021 17:23
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jmablog/d1d1e1e4907b18a3374ebcc486a2812d to your computer and use it in GitHub Desktop.
Save jmablog/d1d1e1e4907b18a3374ebcc486a2812d to your computer and use it in GitHub Desktop.
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