Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(package): update marked 0.3.9 to 0.6.1 #87

Merged
merged 6 commits into from
Apr 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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