This repository has been archived on 2025-12-28. You can view files and clone it, but cannot push or open issues or pull requests.
inks-scripts/scripts/zk-gen-index

15 lines
319 B
Bash
Executable File

#!/usr/bin/env bash
toc=$(./toc.sh)
echo -e "START_TOC\n$toc\n\nEND_TOC" > temp.md
if [ -f index.md ]; then
perl -i -p0e 's/START_TOC.*END_TOC/`cat temp.md`/se' index.md
# sed -i "s/START_TOC.*END_TOC/\${toc}/g" index.md
else
echo -e "# Index \n\n START_TOC \n $toc \n END_TOC" > index.md
fi
rm temp.md