Closed alohaia closed 2 years ago
Please check followings before submitting a new issue.
hexo version
I simply included a single quote in an image's title and alt. It isn't rendered as expected. Actually, the image didn't even appear on the result.
{% asset_img "Gower's_sign.png" "Gower's sign'Gower's sign" %}
Node.js & npm version
# node -v v16.3.0 # npm -v 7.16.0
Hexo and Plugin version(npm ls --depth 0)
npm ls --depth 0
hexo-site@0.0.0 /home/aloha/blog ├── hexo-deployer-git@3.0.0 ├── hexo-generator-archive@1.0.0 ├── hexo-generator-category@1.0.0 ├── hexo-generator-feed@3.0.0 ├── hexo-generator-index@2.0.0 ├── hexo-generator-searchdb@1.3.3 ├── hexo-generator-sitemap@2.1.0 ├── hexo-generator-tag@1.0.0 ├── hexo-next-fireworks@1.0.2 (git+ssh://git@github.com/next-theme/hexo-next-fireworks.git#cccfe84bccccc91f4dae24b7ceb4050ee324fb59) ├── hexo-related-popular-posts@5.0.1 ├── hexo-renderer-ejs@1.0.0 ├── hexo-renderer-markdown-it-plus@1.0.4 (git+ssh://git@github.com/CHENXCHEN/hexo-renderer-markdown-it-plus.git#f2dd1b25738992efc391ba9da398a9c6a7efb105) ├── hexo-renderer-stylus@2.0.1 ├── hexo-server@2.0.0 ├── hexo@5.4.0 └── markdown-it-task-checkbox@1.0.6
Your package.json package.json
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": "5.4.0" }, "dependencies": { "hexo": "^5.0.0", "hexo-deployer-git": "^3.0.0", "hexo-generator-archive": "^1.0.0", "hexo-generator-category": "^1.0.0", "hexo-generator-feed": "^3.0.0", "hexo-generator-index": "^2.0.0", "hexo-generator-searchdb": "^1.3.3", "hexo-generator-sitemap": "^2.1.0", "hexo-generator-tag": "^1.0.0", "hexo-next-fireworks": "github:next-theme/hexo-next-fireworks", "hexo-related-popular-posts": "^5.0.1", "hexo-renderer-ejs": "^1.0.0", "hexo-renderer-markdown-it-plus": "github:CHENXCHEN/hexo-renderer-markdown-it-plus", "hexo-renderer-stylus": "^2.0.0", "hexo-server": "^2.0.0", "markdown-it-task-checkbox": "^1.0.6" } }
I edited node_modules/hexo/lib/plugins/tag/img.js so I can use \\sq and \\dq instead.
node_modules/hexo/lib/plugins/tag/img.js
\\sq
\\dq
title = typeof match[1] == 'string' ? match[1].replace(/\\sq/g, "'").replace(/\\dq/g, '"') : ''; alt = typeof match[2] == 'string' ? match[2].replace(/\\sq/g, "'").replace(/\\dq/g, '"') : '';
{% asset_img "Gower's sign.png" "Gowers\\sqs sign'Gowers\\sqs sign'" %}
Fixed in https://github.com/hexojs/hexo/pull/5112 Thanks for your feedback!
Check List
Please check followings before submitting a new issue.
hexo version
to check)Question
I simply included a single quote in an image's title and alt. It isn't rendered as expected. Actually, the image didn't even appear on the result.
Environment & Settings
Node.js & npm version
Hexo and Plugin version(
npm ls --depth 0
)Your package.json
package.json
Others
I edited
node_modules/hexo/lib/plugins/tag/img.js
so I can use\\sq
and\\dq
instead.