diff --git a/bin/table_of_contents_markdown.awk b/bin/table_of_contents_markdown.awk new file mode 100755 index 0000000..052d9de --- /dev/null +++ b/bin/table_of_contents_markdown.awk @@ -0,0 +1,89 @@ +#!/usr/bin/env -S awk -f +# Create a table of contents for a markdown file. Respects code blocks! +# +# ARGS (use these with -v[name]=[value] when calling): +# int heading : Indenting level for the "highest" heading. DEFAULT = 1 +# int table_only : Only print the table of contents. DEFAULT = 0 +# +# EXAMPLE RUN: +# $ table_of_contents_markdown.awk -vtable_only=1 -vheading=2 < uniques.txt Removes duplicate lines. This exploits awk's automatic initialization of variables with falsey values, 0 here, then turns that index truthy with `++` - - -