From 05bc34bf66bb37070dae08685ea0208aab6899e5 Mon Sep 17 00:00:00 2001 From: Sukka Date: Sat, 20 Jun 2020 13:33:29 +0800 Subject: [PATCH] test(#4087): add related cases (#4364) --- test/scripts/hexo/post.js | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/test/scripts/hexo/post.js b/test/scripts/hexo/post.js index 918e28a2cb..0311c1e00b 100644 --- a/test/scripts/hexo/post.js +++ b/test/scripts/hexo/post.js @@ -1082,4 +1082,42 @@ describe('Post', () => { data.content.trim().should.not.contains('{% endraw %}'); data.content.trim().should.contains(highlightedHtml); }); + + // https://github.com/hexojs/hexo/issues/4087 + it('render() - issue #4087', async () => { + // Adopted from https://github.com/hexojs/hexo/issues/4087#issuecomment-596999486 + const content = [ + '## Quote', + '', + ' {% pullquote %}foo foo foo{% endpullquote %}', + '', + 'test001', + '', + '{% pullquote %}bar bar bar{% endpullquote %}', + '', + '## Insert', + '', + ' {% youtube https://example.com/demo.mp4 %}', + '', + 'test002', + '', + '{% youtube https://example.com/sample.mp4 %}' + ].join('\n'); + + const data = await post.render(null, { + content, + engine: 'markdown' + }); + + // indented pullquote + data.content.trim().should.contains('
{% pullquote %}foo foo foo{% endpullquote %}
'); + data.content.trim().should.contains('

test001

'); + // pullquote tag + data.content.trim().should.contains('

bar bar bar

\n
'); + data.content.trim().should.contains('

test002

'); + // indented youtube tag + data.content.trim().should.contains('
{% youtube https://example.com/demo.mp4 %}
'); + // youtube tag + data.content.trim().should.contains('
'); + }); });