add space to task regex and disable xhtml for gfm testing

This commit is contained in:
Tom Theisen 2018-05-03 19:51:31 -07:00
parent 409cb0d841
commit aa73bb6ea7
3 changed files with 5 additions and 8 deletions

View File

@ -366,11 +366,11 @@ Lexer.prototype.token = function(src, top) {
}
// Check for task list items
istask = /^\[[ xX]\]/.test(item);
istask = /^\[[ xX]\] /.test(item);
ischecked = undefined;
if (istask) {
ischecked = item[1] !== ' ';
item = item.replace(/^\[[ xX]\] */, '');
item = item.replace(/^\[[ xX]\] +/, '');
}
this.tokens.push({

View File

@ -15,8 +15,7 @@ Messenger.prototype.test = function(spec, section, ignore) {
var shouldFail = ~ignore.indexOf(spec.example);
it('should ' + (shouldFail ? 'fail' : 'pass') + ' example ' + spec.example, function() {
var expected = spec.html;
var usexhtml = typeof spec.xhtml === 'boolean' ? spec.xhtml : true;
var actual = marked(spec.markdown, { headerIds: false, xhtml: usexhtml });
var actual = marked(spec.markdown, { headerIds: false, xhtml: false });
since(messenger.message(spec, expected, actual)).expect(
htmlDiffer.isEqual(expected, actual)
).toEqual(!shouldFail);

View File

@ -51,15 +51,13 @@
"section": "Task list items",
"html": "<ul>\n<li><input disabled=\"\" type=\"checkbox\"> foo</li>\n<li><input checked=\"\" disabled=\"\" type=\"checkbox\"> bar</li>\n</ul>",
"markdown": "- [ ] foo\n- [x] bar",
"example": 272,
"xhtml": false
"example": 272
},
{
"section": "Task list items",
"html": "<ul>\n<li><input checked=\"\" disabled=\"\" type=\"checkbox\"> foo\n<ul>\n<li><input disabled=\"\" type=\"checkbox\"> bar</li>\n<li><input checked=\"\" disabled=\"\" type=\"checkbox\"> baz</li>\n</ul>\n</li>\n<li><input disabled=\"\" type=\"checkbox\"> bim</li>\n</ul>",
"markdown": "- [x] foo\n - [ ] bar\n - [x] baz\n- [ ] bim",
"example": 273,
"xhtml": false
"example": 273
},
{
"section": "Strikethrough",