prompts/skills/pandoc-markdown/SKILL.md
Convert Markdown files to HTML with pandoc, optionally add TOC + header backlinks via Lua filter, and optionally serve HTML remotely via a background Python HTTP server.
npx skillsauth add ramblurr/nix-devenv pandoc-markdownInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use this skill when a human asks to convert a Markdown file to an HTML file.
Optional behaviors:
--toc)If output path is not provided, write HTML next to the source file using the same base name.
Example:
/path/docs/ROADMAP.md/path/docs/ROADMAP.htmlpandoc is installed.Commands:
# 1) validate input
[ -f "$INPUT_MD" ]
# 2) check pandoc
command -v pandoc
# 3) convert (basic)
pandoc "$INPUT_MD" -o "$OUTPUT_HTML"
# 4) verify
[ -f "$OUTPUT_HTML" ] && file "$OUTPUT_HTML"
Use this when user asks for a table of contents in the generated HTML.
pandoc --standalone --toc "$INPUT_MD" -o "$OUTPUT_HTML"
Use this when user asks for heading links back to TOC.
Create a filter file (example path: pandoc-toc-backlink.lua in the working directory):
function Header(h)
if h.identifier ~= "table-of-contents" then
h.classes:insert("has-toc-backlink")
end
return h
end
function Pandoc(doc)
local css = pandoc.RawBlock('html', [[
<style>
.toc-backlink {
margin-left: 0.35em;
text-decoration: none;
font-size: 0.9em;
}
</style>
]])
local script = pandoc.RawBlock('html', [[
<script>
document.addEventListener('DOMContentLoaded', function () {
var tocId = 'TOC';
if (!document.getElementById(tocId)) return;
var selector = 'h1.has-toc-backlink, h2.has-toc-backlink, h3.has-toc-backlink, h4.has-toc-backlink, h5.has-toc-backlink, h6.has-toc-backlink';
document.querySelectorAll(selector).forEach(function (h) {
if (h.id === 'table-of-contents' || h.id === 'TOC') return;
var a = document.createElement('a');
a.href = '#'+tocId;
a.className = 'toc-backlink';
a.setAttribute('aria-label', 'Back to table of contents');
a.textContent = '↑';
h.appendChild(document.createTextNode(' '));
h.appendChild(a);
});
});
</script>
]])
table.insert(doc.blocks, 1, css)
table.insert(doc.blocks, 2, script)
return doc
end
Run pandoc with TOC + filter:
pandoc --standalone --toc \
--lua-filter pandoc-toc-backlink.lua \
"$INPUT_MD" -o "$OUTPUT_HTML"
Why this filter shape:
↑ text in TOC entries)#TOCVerification checks:
# TOC container exists
rg -n '<nav id="TOC"' "$OUTPUT_HTML"
# Filter marker/class exists
rg -n 'has-toc-backlink|toc-backlink' "$OUTPUT_HTML"
Only do this when the user asks to view the HTML remotely.
Requirements:
80818090, 3000, 3001Pick the first free port from: 8081 8090 3000 3001.
PORT=""
for p in 8081 8090 3000 3001; do
if ! ss -ltn "( sport = :$p )" | tail -n +2 | grep -q .; then
PORT="$p"
break
fi
done
[ -n "$PORT" ]
Serve from directory containing the HTML file.
HTML_DIR="$(dirname "$OUTPUT_HTML")"
HTML_FILE="$(basename "$OUTPUT_HTML")"
cd "$HTML_DIR"
nohup python3 -m http.server "$PORT" --bind 0.0.0.0 \
> "/tmp/pandoc-http-${PORT}.log" 2>&1 &
PID=$!
echo "$PID" > "/tmp/pandoc-http-${PORT}.pid"
# verify process is alive
kill -0 "$PID"
HOST_IP="$(hostname -I 2>/dev/null | awk '{print $1}')"
Share:
http://$HOST_IP:$PORT/$HTML_FILE (if HOST_IP is available)http://localhost:$PORT/$HTML_FILEkill "$(cat /tmp/pandoc-http-${PORT}.pid)"
pandoc is missing: report conversion cannot run until pandoc is installed./tmp/pandoc-http-<port>.log path.After execution, report:
tools
Use when working with Nixbot CI, forge commit statuses, Nix flake checks, nixbot.toml, Nixbot effects, or nixbot-cli - explains how Nixbot runs flake CI and how to inspect builds and logs.
testing
Use this OCP when executing or preparing to execute commands that change a live or important system, service reloads/restarts, package changes, deployments, migrations, firewall/network/access changes, credential rotation, NixOS switch/test/boot/deploy, or incident mitigation. It guides safe operations with a persisted ledger for scope, preflight, baseline, rollback, validation, and evidence.
development
Create new agent skills with proper structure, progressive disclosure, and bundled resources. Use when user wants to create, write, or build a new skill.
documentation
Naming conventions for workflow documents in prompts/. Use when creating plans, PRDs, research reports, idea capture or other workflow documents. Triggers on (1) creating new planning documents, (2) naming PRDs or research reports, (3) questions about document organization in prompts/.