Skip to content

Commit

Permalink
add checkbox to next token in loose task list
Browse files Browse the repository at this point in the history
  • Loading branch information
UziTech committed Aug 14, 2019
1 parent bee3e99 commit d2336d9
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/marked.js
Expand Up @@ -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') {
Expand Down

0 comments on commit d2336d9

Please sign in to comment.