15 lines
324 B
Bash
Executable File
15 lines
324 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
toc=$(zk-gen-dir-md-toc)
|
|
|
|
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\nSTART_TOC\n\n$toc\nEND_TOC" > index.md
|
|
fi
|
|
|
|
rm temp.md
|