Permalink
Browse files

Improve the count_lines fucntion

don't consider empty lines.
  • Loading branch information...
1 parent 712b1b4 commit d1e8f07fa39b4d45126492f1f18cff819cedf6f7 @UncleBill committed Nov 28, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/markdown.js
View
@@ -153,7 +153,7 @@ var mk_block = Markdown.mk_block = function(block, trail, line) {
};
function count_lines( str ) {
- return str.split( '\n' ).length + 1;
+ return str.trim().split( /\n+/ ).length;
}
// Internal - split source into rough blocks

0 comments on commit d1e8f07

Please sign in to comment.