Thank you h404bi for your answer. This pitfall has been around for a long time. Now I’ll fix it...
Mainly the articles edited on some md editors are pasted to hexo. If {% raw %}{% endraw %} is added, it will be different from the original article. It needs to be modified every time it is published =_= Later I found a way to directly modify the Markdown Content:
The conflict is mainly caused by escaping of and _. Find the marked script file, usually in
hexo\node_modules\marked\lib\marked.js
Back up first, then modify line 449
escape: /^\([\`*{}\[\]()#+\-.!_>])/,
is
escape: /^\([`*\[\]()#+\-.!_>])/,
Line 847
return '<em>' + text + '</em>';
was changed to:
return '_' + text + '_';
Not recommended, but this is how I solved it so far.
The default selection of Hexo is Markdown and the rendering engine is marked (hexo-renderer-marked).
In addition to the default marked, other good Markdown rendering engines currently available on Hexo and still being maintained include hexo-renderer-markdown-it and hexo-renderer-pandoc, of which the former markdown-it supports CommonMark standard, the latter supports Pandoc (markup language converter, I haven’t used it, but after looking at it, it seems to support LaTeX to HTML).
If you want to write formulas, you can try MathJax. The MathJax renderer is also implemented on Hexo. Google for details: Hexo MathJax.
How to use other Markdown rendering engines. Just replace the Markdown renderer dependency of package.json in hexo, for example, replace hexo-renderer-marked with hexo-renderer-markdown-it.
By the way, if you want to avoid underscores and backslashes, you can try the Tag Plugins that come with Hexo. Content within {% raw %}{% endraw %} will not be rendered.
Mainly the articles edited on some md editors are pasted to hexo. If
{% raw %}{% endraw %}
is added, it will be different from the original article. It needs to be modified every time it is published =_= Later I found a way to directly modify the Markdown Content:The conflict is mainly caused by escaping of and _. Find the marked script file, usually in
Back up first, then modify line 449
is
Line 847
was changed to:
Not recommended, but this is how I solved it so far.
The default selection of Hexo is Markdown and the rendering engine is marked (hexo-renderer-marked).
In addition to the default marked, other good Markdown rendering engines currently available on Hexo and still being maintained include hexo-renderer-markdown-it and hexo-renderer-pandoc, of which the former markdown-it supports
CommonMark
standard, the latter supportsPandoc
(markup language converter, I haven’t used it, but after looking at it, it seems to support LaTeX to HTML).If you want to write formulas, you can try MathJax. The MathJax renderer is also implemented on Hexo. Google for details: Hexo MathJax.
How to use other Markdown rendering engines. Just replace the Markdown renderer dependency of
package.json
in hexo, for example, replacehexo-renderer-marked
withhexo-renderer-markdown-it
.By the way, if you want to avoid underscores and backslashes, you can try the Tag Plugins that come with Hexo. Content within
{% raw %}{% endraw %}
will not be rendered.