github-markdown-toc icon indicating copy to clipboard operation
github-markdown-toc copied to clipboard

[Feature] Auto insert support recursive folders, and auto skip files without `<!--ts-->`

Open vikyd opened this issue 4 years ago • 2 comments

Wants 2 features:

  • Auto insert support recursive folders
  • Auto insert auto skip files without <!--ts-->

vikyd avatar Feb 03 '21 02:02 vikyd

Here is my temporary solution, it works in my repo :

getTocMdFiles(){
  find . -iname '*.md' \
  | xargs grep -nwlzP -e '<!--ts-->' | xargs grep -nwlzP -e '<!--te-->'
}

echo "Generate TOC begin: ..."
getTocMdFiles | xargs -L 1 -P 50 gh-md-toc --insert --no-backup 
echo "Generate TOC end."
echo "-----------------"

echo "Remove time row in TOC begin: ..."
# remove time content to aviod too many changes
getTocMdFiles | xargs sed -i '/<!-- Added by:/d' 
echo "Remove time row in TOC end."

vikyd avatar Feb 03 '21 08:02 vikyd

I have the same idea And https://github.com/ekalinin/github-markdown-toc/pull/115 https://github.com/ekalinin/github-markdown-toc/pull/117

yiranzai avatar Apr 09 '21 18:04 yiranzai