From a43ca52aa2d102c7499c7fd8478304a26ea2cd0a Mon Sep 17 00:00:00 2001 From: Volpeon Date: Sat, 18 Jun 2022 15:51:18 +0200 Subject: Improved Lua filters, improved exhibit pages --- filters/code.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 filters/code.lua (limited to 'filters/code.lua') diff --git a/filters/code.lua b/filters/code.lua new file mode 100644 index 0000000..2d6e5a5 --- /dev/null +++ b/filters/code.lua @@ -0,0 +1,15 @@ +local common = require 'filters.lib.common' + +function CodeBlock(el) + if el.classes[1] == "plain" then + el = pandoc.Div({ el }, { class = 's-code' }) + elseif el.classes[1] then + local formatted = pandoc.pipe('pygmentize', { + '-l', el.classes[1], '-f', 'html', '-O', 'cssclass=s-code s-code--highlight', + }, el.text) + + if formatted then el = pandoc.RawBlock('html', formatted) end + end + + return common.wide(el) +end -- cgit v1.2.3-70-g09d2