function CodeBlock(el) if next(el.classes) == nil then el.classes = el.classes .. {'c-page__prefixed', 'c-page__prefixed--pre'} elseif el.classes[1] == "plain" then el = pandoc.Div({el}, {class = 'c-page__code s-code s-code--plain'}) else local formatted = pandoc.pipe('pygmentize', { '-l', el.classes[1], '-f', 'html', '-O', 'cssclass=c-page__code s-code' }, el.text) el = pandoc.RawBlock('html', formatted) end return el end function Header(el) if el.level == 1 then el.classes = el.classes .. {'c-page__prefixed', 'c-page__prefixed--h1'} elseif el.level == 2 then el.classes = el.classes .. {'c-page__prefixed', 'c-page__prefixed--h2'} elseif el.level == 3 then el.classes = el.classes .. {'c-page__prefixed', 'c-page__prefixed--h3'} end return el end function Div(el) if el.attributes.macro == nil then return el end if el.attributes.macro == 'refs' and el.content[1].tag == 'BulletList' then local newchildren = pandoc.List() newchildren:insert(pandoc.RawBlock('html', '')) el.content = newchildren end return el.content end