diff --git a/lib/plugins/filter/before_post_render/backtick_code_block.js b/lib/plugins/filter/before_post_render/backtick_code_block.js
index 8120b39f4f..ce01af6770 100644
--- a/lib/plugins/filter/before_post_render/backtick_code_block.js
+++ b/lib/plugins/filter/before_post_render/backtick_code_block.js
@@ -63,7 +63,7 @@ function backtickCodeBlock(data) {
.replace(/{/g, '{')
.replace(/}/g, '}');
- return `${start}
some content
\n', + '\nsome content
\n', '', 'quote content
\n', @@ -41,7 +41,7 @@ exports.expected = [ exports.expected_disable_nunjucks = [ 'Title
', util.highlight(code, {lang: 'python'}), - '\n\nsome content
\n', + '\nsome content
\n', 'Another title
', '{% blockquote %}
', 'quote content
', diff --git a/test/scripts/hexo/post.js b/test/scripts/hexo/post.js index 5aab2c8055..9ed1d2a42f 100644 --- a/test/scripts/hexo/post.js +++ b/test/scripts/hexo/post.js @@ -734,8 +734,7 @@ describe('Post', () => { content }).then(data => { data.content.trim().should.eql([ - '' + highlighted, - '' + '' + highlighted + '' ].join('\n')); }); }); @@ -802,4 +801,40 @@ describe('Post', () => { }); }); + // test for Issue #3767 + it('render() - backtick cocde block (followed by a paragraph) in blockquote', () => { + const code = 'alert("Hello world")'; + const highlighted = util.highlight(code); + const quotedContent = [ + 'This is a code-block', + '', + '```', + code, + '```', + '', + 'This is a following paragraph' + ]; + + const content = [ + 'Hello', + '', + ...quotedContent.map(s => '> ' + s) + ].join('\n'); + + return post.render(null, { + content, + engine: 'markdown' + }).then(data => { + data.content.trim().should.eql([ + 'Hello
', + '', + '' + ].join('\n')); + }); + }); + });This is a code-block
', + highlighted, + '', + 'This is a following paragraph
', + '