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

Has the parsing of tags changed in Hexo v7.1.0? #5401

Closed
5 tasks done
bianyukun1213 opened this issue Jan 20, 2024 · 4 comments · Fixed by #5402
Closed
5 tasks done

Has the parsing of tags changed in Hexo v7.1.0? #5401

bianyukun1213 opened this issue Jan 20, 2024 · 4 comments · Fixed by #5402
Labels
bug Something isn't working
Milestone

Comments

@bianyukun1213
Copy link

Check List

  • I have already read Docs page & Troubleshooting page.
  • I have already searched existing issues and they are not help to me.
  • I examined error or warning messages and it's difficult to solve.
  • I am using the latest version of Hexo. (run hexo version to check)
  • My Node.js is matched the required version.

Expected behavior

I use this image masonry tag to insert images in my post.

For example,

{% image_masonry
  "https://my.oss.bucket/an-image.webp |alt text 1|image title 1"
  "https://my.oss.bucket/another-image.webp |alt text 2|image title 2"
%}

should render an image masonry that contains 2 images with args[0] parsed as https://my.oss.bucket/an-image.webp |alt text 1|image title 1 and args[1] parsed as https://my.oss.bucket/another-image.webp |alt text 2|image title 2. It works in Hexo v7.0.0.

Actual behavior

However, in Hexo v7.1.0, the " character in the example above will be escaped to ", causing args[0] to change into "https://my.oss.bucket/an-image.webp and args[1] to change into |alt. Also, there will be args[2], args[3], etc…

Eventually, the image masonry will not be rendered correctly.

How to reproduce?

  1. Download the image masonry tag I mentioned and move it to the scripts directory.
  2. Insert an image masonry into a post, like the example above.
  3. Generate the site.

Is the problem still there under Safe mode?

I don’t know, since “Safe mode” will disable all the scripts. But I think the problem will still be there.

Your Node.js & npm version

v18.19.0
10.3.0

Your Hexo and Plugin version

[email protected] /user_shares/user_hollis/repos/blog-source/src
├── @minify-html/[email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

Your package.json

{
  "name": "hexo-site",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "build": "hexo generate",
    "clean": "hexo clean",
    "deploy": "hexo deploy",
    "server": "hexo server"
  },
  "hexo": {
    "version": "7.1.0"
  },
  "dependencies": {
    "@minify-html/node": "^0.15.0",
    "cheerio": "^1.0.0-rc.12",
    "crypto-js": "^4.2.0",
    "hexo": "^7.1.0",
    "hexo-abbrlink": "^2.2.1",
    "hexo-deployer-git": "^4.0.0",
    "hexo-draft-tags": "^0.1.1",
    "hexo-filter-nofollow": "^2.0.2",
    "hexo-generator-alias": "^1.0.0",
    "hexo-generator-archive": "^2.0.0",
    "hexo-generator-category": "^2.0.0",
    "hexo-generator-index": "^3.0.0",
    "hexo-generator-searchdb": "^1.4.1",
    "hexo-generator-sitemap": "^3.0.1",
    "hexo-generator-tag": "^2.0.0",
    "hexo-hide-posts": "^0.4.0",
    "hexo-renderer-ejs": "^2.0.0",
    "hexo-renderer-markdown-it": "^7.1.1",
    "hexo-renderer-stylus": "^3.0.1",
    "hexo-server": "^3.0.0",
    "hexo-tag-collapse-spoiler": "^1.0.0",
    "hexo-theme-redefine": "^2.6.0",
    "hexo-wordcount": "^6.0.1",
    "hexo-yam": "^8.0.0",
    "html-minifier-terser": "^7.2.0",
    "moment": "^2.30.1"
  }
}

Your site's _config.yml (Optional)

No response

Others

No response

@D-Sketon
Copy link
Member

Is #5395 causing this?

@uiolee
Copy link
Member

uiolee commented Jan 20, 2024

yes

Is #5395 causing this?

@uiolee
Copy link
Member

uiolee commented Jan 20, 2024

-{% image_masonry
-  "https://my.oss.bucket/an-image.webp |alt text 1|image title 1"
-  "https://my.oss.bucket/another-image.webp |alt text 2|image title 2"
-%}
+{% image_masonry "https://my.oss.bucket/an-image.webp |alt text 1|image title 1" "https://my.oss.bucket/another-image.webp |alt text 2|image title 2" %}

place them in one line will work in v7.1.0



I have check nunjucks and jinja both support that place {{ }} in different lines. But #5395 broken it.

@uiolee uiolee added the bug Something isn't working label Jan 20, 2024
@uiolee uiolee added this to the 7.1.1 milestone Jan 20, 2024
@uiolee uiolee mentioned this issue Jan 22, 2024
@yoshinorin
Copy link
Member

@bianyukun1213
Just now we published v7.1.1.

https://www.npmjs.com/package/hexo/v/7.1.1

Thank you for your reporting :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants