add initial "generic folding function"

...because sometimes it's just easier and prettier to pretend we're folding a
markdown document :)