diff --git a/lib/marked.js b/lib/marked.js index 49a4153a4b..2ed8d8f326 100644 --- a/lib/marked.js +++ b/lib/marked.js @@ -1267,7 +1267,19 @@ Parser.prototype.tok = function() { var task = this.token.task; if (this.token.task) { - body += this.renderer.checkbox(checked); + if (loose) { + if (this.peek().type === 'text') { + var nextToken = this.peek(); + nextToken.text = this.renderer.checkbox(checked) + ' ' + nextToken.text; + } else { + this.tokens.push({ + type: 'text', + text: this.renderer.checkbox(checked) + }); + } + } else { + body += this.renderer.checkbox(checked); + } } while (this.next().type !== 'list_item_end') {