Markdown Text Splitting content
Created
Description
Splits one Markdown file Into multiple by heading
Last Edited
Tags
Automation
Code
Split by H1 (#)
csplit --prefix='note' --suffix-format='%02d.md' --elide-empty-files notes.md '/^#\s.*/' '{*}'Use Pandoc to shift headings by one level
find ./ -iname "*.md" -type f -exec sh -c 'pandoc --shift-heading-level-by=-1 --wrap=preserve "${0}" -o "${0}"' {} \;Parameters
--prefix
'/^#\s.*/'
prefix for output file name
Matches H1
Use Case
Source
ย

