Skip to content

Commit

Permalink
fix(hexojs#4780): curly brackets (hexojs#4784)
Browse files Browse the repository at this point in the history
  • Loading branch information
SukkaW authored Sep 24, 2021
1 parent a342422 commit 9c9b2a5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/hexo/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ class PostRenderEscape {
swig_tag_name = '';
swig_full_tag_start_buffer = '';
swig_tag_name_begin = false; // Mark if it is the first non white space char in the swig tag
} else {
output += char;
}
} else {
output += char;
Expand Down
22 changes: 22 additions & 0 deletions test/scripts/hexo/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,28 @@ describe('Post', () => {
].join('\n'));
});

it('render() - shouln\'t break curly brackets', async () => {
hexo.config.prismjs.enable = true;
hexo.config.highlight.enable = false;

const content = [
'\\begin{equation}',
'E=h\\nu',
'\\end{equation}'
].join('\n');

const data = await post.render(null, {
content,
engine: 'markdown'
});

data.content.should.include('\\begin{equation}');
data.content.should.include('\\end{equation}');

hexo.config.prismjs.enable = false;
hexo.config.highlight.enable = true;
});

// #2321
it('render() - allow backtick code block in "blockquote" tag plugin', async () => {
const code = 'alert("Hello world")';
Expand Down

0 comments on commit 9c9b2a5

Please sign in to comment.