These are a few scripts I've used to help me out while writing a novel where each chapter is a markdown file. A repo might have a format like this:
book/
├── part-1
│ ├── chapter-01.md
│ ├── chapter-02.md
│ ├── chapter-03.md
│ ├── chapter-04.md
│ ├── chapter-05.md