Skip to content

Commit 5d8dcec

Browse files
Revert "fix(backtick_code): handle empty code blocks (#5206)" (#5257)
This reverts commit c62909d.
1 parent 99e94cc commit 5d8dcec

File tree

2 files changed

+1
-15
lines changed

2 files changed

+1
-15
lines changed

lib/plugins/filter/before_post_render/backtick_code_block.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const rBacktick = /^((?:[^\S\r\n]*>){0,3}[^\S\r\n]*)(`{3,}|~{3,})[^\S\r\n]*((?:.*?[^`\s])?)[^\S\r\n]*\n((?:[\s\S]*?\n)*?)(?:(?:[^\S\r\n]*>){0,3}[^\S\r\n]*)\2[^\S\r\n]?(\n+|$)/gm;
1+
const rBacktick = /^((?:[^\S\r\n]*>){0,3}[^\S\r\n]*)(`{3,}|~{3,})[^\S\r\n]*((?:.*?[^`\s])?)[^\S\r\n]*\n((?:[\s\S]*?\n)?)(?:(?:[^\S\r\n]*>){0,3}[^\S\r\n]*)\2[^\S\r\n]?(\n+|$)/gm;
22
const rAllOptions = /([^\s]+)\s+(.+?)\s+(https?:\/\/\S+|\/\S+)\s*(.+)?/;
33
const rLangCaption = /([^\s]+)\s*(.+)?/;
44

test/scripts/filters/backtick_code_block.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -650,19 +650,5 @@ describe('Backtick code block', () => {
650650
codeBlock(data);
651651
data.content.should.eql('<hexoPostRenderCodeBlock>' + expected + '</hexoPostRenderCodeBlock>');
652652
});
653-
654-
it('handle empty code block', () => {
655-
const data = {
656-
content: [
657-
'``` js',
658-
'```',
659-
'# New line',
660-
'``` js',
661-
'```'
662-
].join('\n')
663-
};
664-
codeBlock(data);
665-
data.content.match(/<hexoPostRenderCodeBlock>/g).length.should.eql(2);
666-
});
667653
});
668654
});

0 commit comments

Comments
 (0)