Skip to content

Commit

Permalink
refactor: drop self implemented todo listitem
Browse files Browse the repository at this point in the history
* GFM list is implemented in marked 0.4.0
  • Loading branch information
yoshinorin committed Feb 27, 2019
1 parent 09a1fed commit f81890c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 38 deletions.
14 changes: 0 additions & 14 deletions lib/renderer.js
Expand Up @@ -17,20 +17,6 @@ function Renderer() {

require('util').inherits(Renderer, MarkedRenderer);

// Support To-Do List
Renderer.prototype.listitem = function(text) {
var result;

if (/^\s*\[[x ]\]\s*/.test(text)) {
text = text.replace(/^\s*\[ \]\s*/, '<input type="checkbox"></input> ').replace(/^\s*\[x\]\s*/, '<input type="checkbox" checked></input> ');
result = '<li>' + text + '</li>\n';
} else {
result = '<li>' + text + '</li>\n';
}

return result;
};

// Add id attribute to headings
Renderer.prototype.heading = function(text, level) {
var transformOption = this.options.modifyAnchors;
Expand Down
24 changes: 0 additions & 24 deletions test/index.js
Expand Up @@ -59,30 +59,6 @@ describe('Marked renderer', function() {
result.should.eql('<h1 id="中文"><a href="#中文" class="headerlink" title="中文"></a>中文</h1>');
});

it('to-do list testing', function() {
var body = [
'- [ ] test unchecked',
'- [x] test checked',
'- normal list [x] [ ]',
'',
'normal text [x] [ ]',
'',
'[x] [ ] normal text'
].join('\n');

var result = r({text: body});

result.should.eql([
'<ul>\n',
'<li><input disabled="" type="checkbox"> test unchecked</li>\n',
'<li><input checked="" disabled="" type="checkbox"> test checked</li>\n',
'<li>normal list [x] [ ]</li>\n',
'</ul>\n',
'<p>normal text [x] [ ]</p>\n',
'<p>[x] [ ] normal text</p>\n'
].join(''));
});

// Description List tests

it('should render description lists with a single space after the colon', function() {
Expand Down

0 comments on commit f81890c

Please sign in to comment.