diff --git a/lib/marked.js b/lib/marked.js index afd50197..d47ffec5 100644 --- a/lib/marked.js +++ b/lib/marked.js @@ -368,60 +368,95 @@ var next = function() { var tok = function() { switch (token.type) { - case 'space': + case 'space': { return ''; - case 'hr': + } + + case 'hr': { return '
'
+ escape(token.text)
+ '
';
- case 'blockquote_start':
+ }
+
+ case 'blockquote_start': {
var body = [];
+
while (next().type !== 'blockquote_end') {
body.push(tok());
}
+
return '' + body.join('') + ''; - case 'list_start': + } + + case 'list_start': { var type = token.ordered ? 'ol' : 'ul' , body = []; + while (next().type !== 'list_end') { body.push(tok()); } - return '<' + type + '>' + + return '<' + + type + + '>' + body.join('') - + '' + type + '>'; - case 'list_item_start': + + '' + + type + + '>'; + } + + case 'list_item_start': { var body = []; + while (next().type !== 'list_item_end') { body.push(token.type === 'text' ? text() : tok()); } + return '
' + text() + '
'; - } + } + } }; var text = function() {