-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor/perf(post): use state machine to escape swig tag #4780
Conversation
a20b4d7
to
8e7ceec
Compare
const restored = str.replace(rSwigPlaceHolder, _restoreContent(this.cache)); | ||
if (restored === str) return restored; | ||
return this.restoreAllSwigTags(restored); // self-recursive for nexted escaping | ||
const restored = str.replace(rSwigPlaceHolder, _restoreContent(this.stored)); | ||
return restored; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The self-recursive escaping is firstly introduced by @seaoak in #2321 trying to mitigate a back_tick_code
inside a swig tag
issue when the year is 2016. Since then, Hexo's post rendering mechanics has changed dramatically. When #2321 being merged in 2019, there is no longer required self-recursive as nested escaping will never happen. After this change, the unit test case still passed.
The rendering of left curly brackets has been changed in this pull request, which will affect the display of mathematical formulas ( Unit tests: https://github.com/hexojs/hexo/tree/post-render |
Ouch. I thought I have solved the issue. I will look into it now. |
There is another issue, the following markdown document will cause a rendering error
|
What does it do?
Replace regexp with the state machine.
How to test
Screenshots
Pull request tasks