Refactoring markdown folding.