Skip to content

Commit b6bb438

Browse files
committed
fix checkbox rendering bug
it doesn't render multiline content properly
1 parent 49acd8a commit b6bb438

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

browser/lib/markdown.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ md.block.ruler.at('paragraph', function (state, startLine/*, endLine*/) {
9696
token.map = [ startLine, state.line ]
9797

9898
if (state.parentType === 'list') {
99-
let match = content.match(/\[( |x)\] ?(.+)/i)
99+
let match = content.match(/^\[( |x)\] ?(.+)/i)
100100
if (match) {
101-
content = `<label class='taskListItem' for='checkbox-${startLine + 1}'><input type='checkbox'${match[1] !== ' ' ? ' checked' : ''} id='checkbox-${startLine + 1}'/> ${match[2]}</label>`
101+
content = `<label class='taskListItem' for='checkbox-${startLine + 1}'><input type='checkbox'${match[1] !== ' ' ? ' checked' : ''} id='checkbox-${startLine + 1}'/> ${content.substring(4, content.length)}</label>`
102102
}
103103
}
104104

0 commit comments

Comments
 (0)