fix: fix space removed after checkbox (#2971)
* fix: fix space removed after checkbox * add loose test
This commit is contained in:
parent
0ac8b78fe7
commit
9a2a4ad61a
@ -141,11 +141,11 @@ export class _Parser {
|
|||||||
} else {
|
} else {
|
||||||
item.tokens.unshift({
|
item.tokens.unshift({
|
||||||
type: 'text',
|
type: 'text',
|
||||||
text: checkbox
|
text: checkbox + ' '
|
||||||
} as Tokens.Text);
|
} as Tokens.Text);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
itemBody += checkbox;
|
itemBody += checkbox + ' ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,6 +33,20 @@ describe('inlineLexer', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('task', () => {
|
||||||
|
it('space after checkbox', () => {
|
||||||
|
const html = marked('- [ ] item');
|
||||||
|
|
||||||
|
expect(html).toBe('<ul>\n<li><input disabled="" type="checkbox"> item</li>\n</ul>\n');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('space after loose checkbox', () => {
|
||||||
|
const html = marked('- [ ] item 1\n\n- [ ] item 2');
|
||||||
|
|
||||||
|
expect(html).toBe('<ul>\n<li><p><input disabled="" type="checkbox"> \nitem 1</p>\n</li>\n<li><p><input disabled="" type="checkbox"> \nitem 2</p>\n</li>\n</ul>\n');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('parseInline', () => {
|
describe('parseInline', () => {
|
||||||
it('should parse inline tokens', () => {
|
it('should parse inline tokens', () => {
|
||||||
const md = '**strong** _em_';
|
const md = '**strong** _em_';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user