node.js - hexo 如何解决markdown下划线要加反斜杠,以及如何使用其他markdown的渲染引擎?
怪我咯
怪我咯 2017-04-17 13:02:13
0
2
782
  1. 每当在一些markdown编辑器写完文章后,由于常用到LaTeX要用到大量下划线,所以在发文章前要在文章所有下划线前加反斜杠才不会乱。这样hexo的md就和所写的纯md不一样了。

  2. hexo自带的markdown渲染引擎对于一些复杂的公式无法支持渲染,这让我很头疼,写好的公式还要截成图才能发布。如何使用其他的markdown渲染引擎?

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(2)
阿神

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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template