-
-
Notifications
You must be signed in to change notification settings - Fork 5k
Open
Description
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
The Post:
---
title: Hello World
date: 2021-10-09 21:50:25
refplus: true
---
<!-- more -->
Test {% ref self %}.
## Ref
{% references %}
[self] {% post_link hello-world hello-world %}
{% endreferences %}
All Markdown content between the ref
and endreferences
tags is rendered properly. And ## Ref
is rendered as an h2
element.
Actual behavior
All Markdown content between the ref and endreferences tags is escaped, resulting in unrendered text.

How to reproduce?
sudo apt install npm
sudo npm install [email protected] -g
hexo init testenv
cd testenv
npm install hexo-reference-plus
cd source/_posts/
tee >hello-world.md <<EOF
---
title: Hello World
date: 2021-10-09 21:50:25
refplus: true
---
<!-- more -->
Test {% ref self %}.
## Ref
{% references %}
[self] {% post_link hello-world hello-world %}
{% endreferences %}
EOF
Is the problem still there under Safe mode
?
Yes
Your Node.js & npm version
v18.19.1
9.2.0
Your Hexo and Plugin version
[email protected] /home/admin/test/testenv
├── [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.3.0"
},
"dependencies": {
"hexo": "^7.3.0",
"hexo-generator-archive": "^2.0.0",
"hexo-generator-category": "^2.0.0",
"hexo-generator-index": "^4.0.0",
"hexo-generator-tag": "^2.0.0",
"hexo-reference-plus": "^1.1.0",
"hexo-renderer-ejs": "^2.0.0",
"hexo-renderer-marked": "^7.0.0",
"hexo-renderer-stylus": "^3.0.1",
"hexo-server": "^3.0.0",
"hexo-theme-landscape": "^1.0.0"
}
}
Your site's _config.yml
(Optional)
Others
I discovered this bug is caused by the escapeAllSwigTags
function:
The ref
and references
tags share the same prefix. When escapeAllSwigTags
uses endref
to identify block-level tags, all content between {% ref xxx %}
and {% endreferences %}
is incorrectly escaped, resulting in unrendered Markdown.
This is clearly a bug:
- The tag plugin functioned correctly with Hexo four years ago.
- Plugins are restricted from sharing prefixes, and patterns like
end${plugin_name}
in text will also cause ambiguity.
Metadata
Metadata
Assignees
Labels
No labels