Agent skill
pandoc-9-lua-filters
Sub-skill of pandoc: 9. Lua Filters.
Install this agent skill to your Project
npx add-skill https://github.com/vamseeachanta/workspace-hub/tree/main/.claude/skills/_archive/development/documentation/pandoc/9-lua-filters
SKILL.md
9. Lua Filters
9. Lua Filters
-- filters/word-count.lua
-- Count words in document
local word_count = 0
function Str(el)
word_count = word_count + 1
return el
end
function Pandoc(doc)
print("Word count: " .. word_count)
return doc
end
-- filters/uppercase-headers.lua
-- Convert all headers to uppercase
function Header(el)
return pandoc.walk_block(el, {
Str = function(s)
return pandoc.Str(string.upper(s.text))
end
})
end
-- filters/remove-links.lua
-- Remove all hyperlinks, keeping text
function Link(el)
return el.content
end
-- filters/custom-blocks.lua
-- Convert custom div blocks to styled output
function Div(el)
if el.classes:includes("warning") then
-- For LaTeX output
local latex_begin = pandoc.RawBlock('latex',
'\\begin{tcolorbox}[colback=yellow!10,colframe=orange]')
local latex_end = pandoc.RawBlock('latex', '\\end{tcolorbox}')
table.insert(el.content, 1, latex_begin)
table.insert(el.content, latex_end)
return el.content
end
if el.classes:includes("info") then
local latex_begin = pandoc.RawBlock('latex',
'\\begin{tcolorbox}[colback=blue!5,colframe=blue!50]')
local latex_end = pandoc.RawBlock('latex', '\\end{tcolorbox}')
table.insert(el.content, 1, latex_begin)
table.insert(el.content, latex_end)
return el.content
end
end
-- filters/include-files.lua
-- Include content from external files
function CodeBlock(el)
if el.classes:includes("include") then
local file = io.open(el.text, "r")
if file then
local content = file:read("*all")
file:close()
-- Get file extension for syntax highlighting
local ext = el.text:match("%.(%w+)$")
local lang = ext or ""
return pandoc.CodeBlock(content, {class = lang})
end
end
end
# Use Lua filters
pandoc document.md -o document.pdf \
--lua-filter=filters/uppercase-headers.lua \
--lua-filter=filters/custom-blocks.lua
# Chain multiple filters
pandoc document.md -o document.pdf \
--filter pandoc-crossref \
--lua-filter=filters/custom-blocks.lua \
--citeproc
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
gsd-complete-milestone
Archive completed milestone and prepare for next version
gsd-reapply-patches
Reapply local modifications after a GSD update
gsd-verify-work
Validate built features through conversational UAT
gsd-thread
Manage persistent context threads for cross-session work
clinical-trial-protocol
Generate clinical trial protocols for medical devices or drugs through a modular, waypoint-based architecture with research-only and full protocol modes.
single-cell-rna-qc
Performs quality control on single-cell RNA-seq data (.h5ad or .h5 files) using scverse best practices with MAD-based filtering and comprehensive visualizations.
Didn't find tool you were looking for?