diff options
| author | Volpeon <git@volpeon.ink> | 2021-11-16 17:43:15 +0100 | 
|---|---|---|
| committer | Volpeon <git@volpeon.ink> | 2021-11-16 17:43:15 +0100 | 
| commit | 28527ca2a2336c371966cef441247f11a6805686 (patch) | |
| tree | 2c940d0cd65116343d05ed75b9e7188e0a7cb133 /filters/code.lua | |
| parent | Slightly smaller cards (diff) | |
| download | volpeon.ink-28527ca2a2336c371966cef441247f11a6805686.tar.gz volpeon.ink-28527ca2a2336c371966cef441247f11a6805686.tar.bz2 volpeon.ink-28527ca2a2336c371966cef441247f11a6805686.zip  | |
Make variables accessible from content files
Diffstat (limited to 'filters/code.lua')
| -rw-r--r-- | filters/code.lua | 13 | 
1 files changed, 13 insertions, 0 deletions
diff --git a/filters/code.lua b/filters/code.lua new file mode 100644 index 0000000..aca3ce8 --- /dev/null +++ b/filters/code.lua  | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | function CodeBlock(el) | ||
| 2 | if el.classes[1] == "plain" then | ||
| 3 | el = pandoc.Div({ el }, { class = 's-code' }) | ||
| 4 | elseif el.classes[1] then | ||
| 5 | local formatted = pandoc.pipe('pygmentize', { | ||
| 6 | '-l', el.classes[1], '-f', 'html', '-O', 'cssclass=s-code s-code--highlight', | ||
| 7 | }, el.text) | ||
| 8 | |||
| 9 | if formatted then el = pandoc.RawBlock('html', formatted) end | ||
| 10 | end | ||
| 11 | |||
| 12 | return el | ||
| 13 | end | ||
