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

fix(escapeAllSwigTags): backtrack when tag is incomplete #5618

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

D-Sketon
Copy link
Member

@D-Sketon D-Sketon commented Jan 18, 2025

What does it do?

fix #5571
fix #5301
fix hexojs/hexo-renderer-pandoc#60

Screenshots

Pull request tasks

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

Copy link

How to test

git clone -b fix/render https://github.com/D-Sketon/hexo.git
cd hexo
npm install
npm test

@coveralls
Copy link

Pull Request Test Coverage Report for Build 12845848268

Details

  • 144 of 145 (99.31%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.01%) to 99.496%

Changes Missing Coverage Covered Lines Changed/Added Lines %
lib/hexo/post.ts 144 145 99.31%
Totals Coverage Status
Change from base Build 12702421469: 0.01%
Covered Lines: 9473
Relevant Lines: 9521

💛 - Coveralls

@D-Sketon D-Sketon marked this pull request as draft January 19, 2025 07:20
@D-Sketon D-Sketon marked this pull request as ready for review January 19, 2025 07:32
@uiolee
Copy link
Member

uiolee commented Jan 22, 2025

if there are more incomplete tag, issue still existed.

123

`{#}`

234

`{{x}}`

qwe

`{#}`

asd

`{{x}}`

image

@D-Sketon
Copy link
Member Author

In fact, this is a tricky problem—when the incomplete first part of the tag and the incomplete second part of the tag are concatenated, they form a complete tag, which is then parsed as Swig.

For the following text 123 {#} 123 {#} 123, I think Hexo could parse it as either 123 {#} 123 {#} 123 or 123 <!-- swig 0 --> 123.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants