-
-
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
perf(tag): rendering optimization #4418
Conversation
95eb4b6
to
6f15416
Compare
lib/extend/tag.js
Outdated
@@ -5,7 +5,8 @@ const { cyan } = require('chalk'); | |||
const { Environment } = require('nunjucks'); | |||
const Promise = require('bluebird'); | |||
const placeholder = '\uFFFC'; | |||
const rPlaceholder = /(?:<|<)!--\uFFFC(\d+)--(?:>|>)/g; | |||
const rPlaceholder = /<!--\uFFFC(\d+)-->/g; |
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.
I wonder why the previous regex matches <
>
? I thought <>
is only escaped in code block?
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.
@curbengh IMHO, the regexp here might be copied from post.js
in which the <>
will be escaped by post renderer (like marked.js & our highlighter).
But inside tag rendering process, there will be no escape at all.
43f38ee
to
f439327
Compare
0470503
to
cf4ee3c
Compare
cf4ee3c
to
d6cb88b
Compare
91431ec
to
d477f57
Compare
d477f57
to
1d3506b
Compare
@seaoak @curbengh @stevenjoezhang The PR is ready for review now. |
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.
WFM
#### Multi-line raw
{% raw %}
{{ 1+1 }}
{% endraw %}
#### Same line raw
{% raw %}{{ 1+1 }}{% endraw %}
#### Single backquote
`{{ 1+1 }}`
#### Triple backquote
```
{{ 1+1 }}
```
#### Original
{{ 1+1 }}
#### C code
{% codeblock lang:objc %}
[rectangle setX: 10 y: 10 width: 20 height: 20];
{% endcodeblock %}
@curbengh A lot of test cases has been added during pre-hexo-5.0.0 development and I am sure most of the case has been covered in unit test now. |
What does it do?
Escape swig tag inside code block only once.
How to test
Screenshots
Pull request tasks