From 86a37cd01890ecf7e125de3c04669e684d1e7d1d Mon Sep 17 00:00:00 2001 From: YoshinoriN Date: Sat, 23 Feb 2019 11:09:23 +0900 Subject: [PATCH 1/6] chore: Bump to marked 0.4.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a399e57..57f4e54 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "license": "MIT", "dependencies": { "hexo-util": "^0.6.2", - "marked": "^0.3.9", + "marked": "^0.4.0", "object-assign": "^4.1.1", "strip-indent": "^2.0.0" }, From d59f4cf09af9d4aaa8a5bb520bd4d7ae7fddac9e Mon Sep 17 00:00:00 2001 From: YoshinoriN Date: Sat, 23 Feb 2019 11:13:27 +0900 Subject: [PATCH 2/6] fix: GFM to-do list * marked 0.4.0 is Compliant with GFM task list * https://github.com/markedjs/marked/pull/1250 --- lib/renderer.js | 2 +- test/index.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/renderer.js b/lib/renderer.js index a8a1d2a..5ab32a5 100644 --- a/lib/renderer.js +++ b/lib/renderer.js @@ -23,7 +23,7 @@ Renderer.prototype.listitem = function(text) { if (/^\s*\[[x ]\]\s*/.test(text)) { text = text.replace(/^\s*\[ \]\s*/, ' ').replace(/^\s*\[x\]\s*/, ' '); - result = '
  • ' + text + '
  • \n'; + result = '
  • ' + text + '
  • \n'; } else { result = '
  • ' + text + '
  • \n'; } diff --git a/test/index.js b/test/index.js index cce65cf..36f7244 100644 --- a/test/index.js +++ b/test/index.js @@ -74,8 +74,8 @@ describe('Marked renderer', function() { result.should.eql([ '\n', '

    normal text [x] [ ]

    \n', From f586ae45437849fff7ed5e223b6b76e30f288aed Mon Sep 17 00:00:00 2001 From: YoshinoriN Date: Sat, 23 Feb 2019 11:36:00 +0900 Subject: [PATCH 3/6] fix: Remove extra inner linebreak from code blocks * https://github.com/markedjs/marked/pull/1266 --- test/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/index.js b/test/index.js index 36f7244..b6b1093 100644 --- a/test/index.js +++ b/test/index.js @@ -31,7 +31,7 @@ describe('Marked renderer', function() { result.should.eql([ '

    Hello world

    ', - '
    ' + util.highlight(code, {gutter: false, wrap: false}) + '\n
    ', + '
    ' + util.highlight(code, {gutter: false, wrap: false}) + '
    ', '

    Hello world

    ', '

    hello

    ' ].join('') + '\n'); From c9844f713793355ab42199eddec44fdc19ac4380 Mon Sep 17 00:00:00 2001 From: YoshinoriN Date: Sat, 23 Feb 2019 11:46:11 +0900 Subject: [PATCH 4/6] chore: Bump to marked 0.6.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 57f4e54..3efe2dd 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "license": "MIT", "dependencies": { "hexo-util": "^0.6.2", - "marked": "^0.4.0", + "marked": "^0.6.0", "object-assign": "^4.1.1", "strip-indent": "^2.0.0" }, From 09a1feda66e0dfe9349b34e8ef3b7502dc7c0de6 Mon Sep 17 00:00:00 2001 From: YoshinoriN Date: Wed, 27 Feb 2019 21:11:22 +0900 Subject: [PATCH 5/6] chore: Bump to marked 0.6.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3efe2dd..cea4b7d 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "license": "MIT", "dependencies": { "hexo-util": "^0.6.2", - "marked": "^0.6.0", + "marked": "^0.6.1", "object-assign": "^4.1.1", "strip-indent": "^2.0.0" }, From f81890c575aacc2cf3ddba2f5527e8b65f9761d2 Mon Sep 17 00:00:00 2001 From: YoshinoriN Date: Wed, 27 Feb 2019 21:17:24 +0900 Subject: [PATCH 6/6] refactor: drop self implemented todo listitem * GFM list is implemented in marked 0.4.0 --- lib/renderer.js | 14 -------------- test/index.js | 24 ------------------------ 2 files changed, 38 deletions(-) diff --git a/lib/renderer.js b/lib/renderer.js index 5ab32a5..7bc02e3 100644 --- a/lib/renderer.js +++ b/lib/renderer.js @@ -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*/, ' ').replace(/^\s*\[x\]\s*/, ' '); - result = '
  • ' + text + '
  • \n'; - } else { - result = '
  • ' + text + '
  • \n'; - } - - return result; -}; - // Add id attribute to headings Renderer.prototype.heading = function(text, level) { var transformOption = this.options.modifyAnchors; diff --git a/test/index.js b/test/index.js index b6b1093..382a8c6 100644 --- a/test/index.js +++ b/test/index.js @@ -59,30 +59,6 @@ describe('Marked renderer', function() { result.should.eql('

    中文

    '); }); - 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([ - '
      \n', - '
    • test unchecked
    • \n', - '
    • test checked
    • \n', - '
    • normal list [x] [ ]
    • \n', - '
    \n', - '

    normal text [x] [ ]

    \n', - '

    [x] [ ] normal text

    \n' - ].join('')); - }); - // Description List tests it('should render description lists with a single space after the colon', function() {