Open PeichengLiu opened 8 months ago
This is probably a feature of hexo and not easy to change.
If you don't use <!-- -->
to escape the tag, it will be wrapped in <p></p>
by the markdown renderer, which may have side effects on some tags or themes.
Check List
hexo version
to check)Expected behavior
Fyi, I'm using https://github.com/next-theme/hexo-theme-next.
with
I would expect two paragraphs generated.
Actual behavior
No paragraphs generated.
How to reproduce?
https://github.com/PeichengLiu/for-hexo-rendering-issue is ready for your convenience.
Is the problem still there under "Safe mode"?
No HTML generated.
Environment & Settings
Node.js & npm version(
node -v && npm -v
)Your site
_config.yml
(Optional)The only configuration I changed is
theme: next
, and no configuration for the theme itself.Hexo and Plugin version(
npm ls --depth 0
)Your package.json
package.json
Others
I tried to dig out the root cause and fix it. It seems to be related to the way how Hexo implements Tag Plugins. I change
https://github.com/hexojs/hexo/blob/ad056527cee2c55fa961cc84a56f44ea55404c63/lib/hexo/post.js#L16-L17
to
, and
https://github.com/hexojs/hexo/blob/ad056527cee2c55fa961cc84a56f44ea55404c63/lib/hexo/post.js#L37-L39
to
. It solves the problem above, while it breaks unit tests. Which is another part I do not quite understand. For example, should not the following test
https://github.com/hexojs/hexo/blob/ad056527cee2c55fa961cc84a56f44ea55404c63/test/scripts/hexo/post.js#L1249-L1276
expect
? With a single
\n
between texts, how canAnother Text
be wrapped in a paragraph?Finally, one another question, why Hexo is using an outdated
markedjs
with some copied code snippets and uncleared (to me) customization?Next
(in Chinese), 使用 label 标签外挂在开头时,会导致无法换行 #707Thanks for your work!