Skip to content
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

perf(post): simplify codeblock escape #4254

Merged
merged 2 commits into from
Apr 28, 2020

Conversation

SukkaW
Copy link
Member

@SukkaW SukkaW commented Apr 21, 2020

What does it do?

Since #4171 is about to be discarded, I picked up some changes into this PR.

This PR improves the performance of code blocks escape.

Before this PR, backtick_code_filter will output code block like this <escape>highlighted code</escape>, which will become <!--\uFFc${index}--> after PostRenderCache.escapeContent().

This PR removes PostRenderCache.escapeContent() by using <!--hexoPostRenderEscape: & :hexoPostRenderEscape-->. Why it would work please refer to #4171 (comment).

How to test

git clone -b post-render-backtick-code-filter https://github.com/sukkaw/hexo.git
cd hexo
npm install
npm test

Screenshots

This PR improve generation speed by 3% without breaking current test cases.

Pull request tasks

  • Add test cases for the changes.
  • Passed the CI test.

stevenjoezhang
stevenjoezhang previously approved these changes Apr 24, 2020
@SukkaW SukkaW force-pushed the post-render-backtick-code-escape branch from e08cc70 to eef7d73 Compare April 27, 2020 03:28
@SukkaW SukkaW requested a review from stevenjoezhang April 27, 2020 03:28
@coveralls
Copy link

coveralls commented Apr 27, 2020

Coverage Status

Coverage decreased (-0.0006%) to 97.741% when pulling eef7d73 on SukkaW:post-render-backtick-code-escape into c51b87e on hexojs:master.

@SukkaW SukkaW merged commit 2b63f9f into hexojs:master Apr 28, 2020
@jerryc127
Copy link

It shows the ':hexoPostRenderEscape–>' in the post, it cause by this commit ?
image

@SukkaW SukkaW mentioned this pull request Aug 11, 2020
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants