Monday, July 10, 2023

Markdown TOC Generator

The long wait is finally over! Announcing the most revolutionary innovation since punched cards! A command-line tool that inserts a table of contents into a markdown file!!!


Um ... according to my notes, this is where I'm supposed to wait for the cheering to die down.

(crickets get bored and leave)

Man, what a tough neighborhood.

Yeah, I know. There might be one or two similar tools out there. Like the web-based tool, but I don't like the cut-and-paste. Or the command-line tool at, but I don't like the curl dependency or the code (although credit to it for showing me the GitHub rendering API that I used in my test script).

So I wrote my own in Perl:

Most of my other tools have either a build script or a test script; I'll probably change most of them to have something like:

# Update doc table of contents (see

if which >/dev/null; then -b "";

elif [ -x ../mdtoc/ ]; then ../mdtoc/ -b "";

else echo "FYI: not found; see"


No comments: