Skip to content

Commit

Permalink
handle edgecase
Browse files Browse the repository at this point in the history
  • Loading branch information
dominictarr committed Mar 7, 2013
1 parent f10a820 commit ccc0476
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Expand Up @@ -9,11 +9,11 @@ module.exports = function (text) {
sections.push(section.join('\n'))
}
text.split('\n').forEach(function (line) {
if(/^#/.test(line)) { // new section
if(/^\s*#/.test(line)) { // new section
add()
section = []
}
section.push(line)
(section = section || []).push(line)
})

//add the last section
Expand Down

0 comments on commit ccc0476

Please sign in to comment.