Skip to content

Commit

Permalink
Revert "fix(backtick_code): handle empty code blocks (#5206)" (#5257)
Browse files Browse the repository at this point in the history
This reverts commit c62909d.
  • Loading branch information
stevenjoezhang committed Aug 1, 2023
1 parent 99e94cc commit 5d8dcec
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 15 deletions.
@@ -1,4 +1,4 @@
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;
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;
const rAllOptions = /([^\s]+)\s+(.+?)\s+(https?:\/\/\S+|\/\S+)\s*(.+)?/;
const rLangCaption = /([^\s]+)\s*(.+)?/;

Expand Down
14 changes: 0 additions & 14 deletions test/scripts/filters/backtick_code_block.js
Expand Up @@ -650,19 +650,5 @@ describe('Backtick code block', () => {
codeBlock(data);
data.content.should.eql('<hexoPostRenderCodeBlock>' + expected + '</hexoPostRenderCodeBlock>');
});

it('handle empty code block', () => {
const data = {
content: [
'``` js',
'```',
'# New line',
'``` js',
'```'
].join('\n')
};
codeBlock(data);
data.content.match(/<hexoPostRenderCodeBlock>/g).length.should.eql(2);
});
});
});

0 comments on commit 5d8dcec

Please sign in to comment.