Created
January 30, 2021 17:23
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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