Split book's chapter as separated files

Feel free to use one line script for splitting one big markdown file into many files based on chapter). It works on MAC OS, WINDOWS, LINUX. I think this script can save a lot of time for all of us. Enjoy.

See the mini tutorial in the Github > here


Thanks for sharing, could be helpful! Does it keep the original file or replace it?

Hey thanks! I hope this functionality gets into Obsidian one day!

How do I alter the script to make the splits on H2 instead of H1?


It will keep the original file.


Just change part '/^# / to:

  • for Heading 1: '/^# /
  • for Heading 2: '/^## /
  • for Heading 3: '/^### /
  • for Heading 4: '/^#### /


Don’t withdraw the post, why?

Because I got suggestion from web, that better practice is when I reply to both user as one reply. So I merged them in one, and deleted previous. Not knowing that it will stay there for 24 hours :smiley:

1 Like

Very useful. :thinking:
Very, very useful :+1: