Skip to content

Instantly share code, notes, and snippets.

View torstenberg's full-sized avatar

Torsten Berg torstenberg

View GitHub Profile
@torstenberg
torstenberg / codeextract.lua
Created December 14, 2021 22:05
Lua filter for Pandoc, to extract all code blocks from a markdown file
-- reads all code blocks and discards
-- the remaining document
-- use this with a Pandoc call like this:
-- 'pandoc -t plain --lua-filter codeextract.lua'
function Block (b)
if (b.t == "CodeBlock") then
return pandoc.RawBlock('plain', b.text)
else