summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/lib/html.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/js/lib/html.js b/js/lib/html.js
index 5cf3def..37ee903 100644
--- a/js/lib/html.js
+++ b/js/lib/html.js
@@ -27,6 +27,7 @@ var renderNodes = function(block, options) {
var walker = block.walker();
var event, node, entering;
var buffer = "";
+ var lastOut = "\n";
var disableTags = 0;
var grandparent;
var out = function(s) {
@@ -35,11 +36,13 @@ var renderNodes = function(block, options) {
} else {
buffer += s;
}
+ lastOut = s;
};
var esc = this.escape;
var cr = function() {
- if (buffer.length > 0 && buffer.charAt[buffer.length - 1] !== '\n') {
- out('\n');
+ if (lastOut !== '\n') {
+ buffer += '\n';
+ lastOut = '\n';
}
};