Skip to content

Commit

Permalink
chore(package): update marked 0.3.9 to 0.6.1 (#87)
Browse files Browse the repository at this point in the history
* marked 0.4.0 has Compliant with GFM task list
* markedjs/marked#1250

* fix: Remove extra inner linebreak from code blocks
  • Loading branch information
yoshinorin authored Apr 6, 2019
1 parent 88d39fb commit 3317aeb
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 40 deletions.
14 changes: 0 additions & 14 deletions lib/renderer.js
Original file line number Diff line number Diff line change
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 style="list-style: none">' + 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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"license": "MIT",
"dependencies": {
"hexo-util": "^0.6.2",
"marked": "^0.3.9",
"marked": "^0.6.1",
"object-assign": "^4.1.1",
"strip-indent": "^2.0.0"
},
Expand Down
26 changes: 1 addition & 25 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe('Marked renderer', function() {

result.should.eql([
'<h1 id="Hello-world"><a href="#Hello-world" class="headerlink" title="Hello world"></a>Hello world</h1>',
'<pre><code>' + util.highlight(code, {gutter: false, wrap: false}) + '\n</code></pre>',
'<pre><code>' + util.highlight(code, {gutter: false, wrap: false}) + '</code></pre>',
'<h2 id="Hello-world-1"><a href="#Hello-world-1" class="headerlink" title="Hello world"></a>Hello world</h2>',
'<p>hello</p>'
].join('') + '\n');
Expand Down 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 style="list-style: none"><input type="checkbox"></input> test unchecked</li>\n',
'<li style="list-style: none"><input type="checkbox" checked></input> 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 3317aeb

Please sign in to comment.