New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug:marked 和 Mathjax冲突 #524

Closed
fuzihaofzh opened this Issue Mar 12, 2014 · 16 comments

Comments

@fuzihaofzh

fuzihaofzh commented Mar 12, 2014

你好! 默认的markdown解析器会把公式里的一些字符转义,导致mathjax无法解析。不知道能否更换markdown解析器?

@fuzihaofzh

This comment has been minimized.

fuzihaofzh commented Mar 12, 2014

附上latex代码:
$$ \int _ \Omega f\nabla \cdot \boldsymbol{A} d\Omega+\int _ \Omega$$
两个下划线被转移成斜体

@chenall

This comment has been minimized.

Contributor

chenall commented Mar 12, 2014

试试rawblock

 {% rawblock %}
$$ \int _ \Omega f\nabla \cdot \boldsymbol{A} d\Omega+\int _ \Omega$$
 {% endrawblock %}
@wzpan

This comment has been minimized.

Member

wzpan commented Mar 13, 2014

没遇过这类问题。建议:

  1. 在引入 mathjax 前,先进行设置:
<script type="text/x-mathjax-config">
       MathJax.Hub.Config({
            tex2jax: {
                inlineMath: [["\\(", "\\)"]],
                displayMath: [["\\[", "\\]"]]
            }
        });
    </script>
    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
  1. 如果无法解决,可以更换 markdown 解析器。我个人推荐使用语法更strong的 pandoc-markdown ,hexo下可使用 hexo-renderer-pandoc

@tommy351 tommy351 added the question label Mar 15, 2014

@Xuanwo

This comment has been minimized.

Contributor

Xuanwo commented Aug 10, 2014

使用rawblock可以解决大多数因为特殊符号导致的渲染问题。
@wzpan pandoc虽然是神器,但是不太会用= =。在hexo下面使用是不是还要再进行额外的配置?
@maplewizard 要是问题解决了就关闭issues,要是没有解决,请继续反馈。

@wzpan

This comment has been minimized.

Member

wzpan commented Aug 11, 2014

不需要额外配置。看pandoc官方文档学习pandoc-markdown语法即可,与markdown大同小异。

@leesei

This comment has been minimized.

Member

leesei commented Dec 2, 2014

please close this issue

@fuzihaofzh fuzihaofzh closed this Dec 2, 2014

@ghost

This comment has been minimized.

ghost commented Sep 9, 2015

给了一个利用 JS 解决问题的办法:
http://liam0205.me/2015/09/09/fix-conflict-between-mathjax-and-markdown/

@crackhopper

This comment has been minimized.

crackhopper commented Jul 5, 2016

我从别处看来的一个办法:http://kubicode.me/2016/03/16/Hexo/Fix-Hexo-Bug-In-Mathjax/

不过这个办法还是有问题,就是
\begin{equation*}\end{equation*}。这两个*会被处理成<em>

@Tveek

This comment has been minimized.

Tveek commented Aug 27, 2016

可以更换markdow解释器,使用pandoc,可以几乎完美解决问题,https://tveek.github.io/2016/08/27/octopress-hexo-learning-experience/

@familyld

This comment has been minimized.

familyld commented Oct 6, 2016

这个问题是由Hexo自带的Markdown渲染引擎和MathJax冲突引起的,解决方法很简单。更换Markdown渲染引擎就可以了。详细可以查看我的博文

This issue is caused by the conflict of hexo-renderer-marked(Hexo's default Markdown renderer) and MathJax. To fix this issue, you can simply change your markdown renderer. See the detail in my blog.

@ShomyLiu

This comment has been minimized.

ShomyLiu commented Oct 23, 2016

比较直接的方法,就是修改Hexo的渲染机制, node_modules/marked/lib/marked.js里面的_的转义,也很简单,改两行就可以了。具体参考

@liuqinh2s

This comment has been minimized.

liuqinh2s commented Nov 15, 2017

➜ blog hexo g
INFO Start processing
events.js:160
throw er; // Unhandled 'error' event
^

Error: write EPIPE
at exports._errnoException (util.js:1022:11)
at WriteWrap.afterWrite [as oncomplete] (net.js:804:14)

@liuqinh2s

This comment has been minimized.

liuqinh2s commented Nov 15, 2017

hexo-renderer-pandoc 无法使用,pandoc 我已经安装好了

@liuqinh2s

This comment has been minimized.

liuqinh2s commented Nov 15, 2017

➜ blog pandoc --version
pandoc 2.0.2
Compiled with pandoc-types 1.17.3, texmath 0.10, skylighting 0.4.3.2
Default user data directory: /Users/liuqinh2s/.pandoc
Copyright (C) 2006-2017 John MacFarlane
Web: http://pandoc.org
This is free software; see the source for copying conditions.
There is no warranty, not even for merchantability or fitness
for a particular purpose.

@ShomyLiu

This comment has been minimized.

ShomyLiu commented Nov 15, 2017

@liuqinh2s 看错误信息我也不清楚,不过可以试试先hexo clean 再hexo g. 然后就是需要先卸载原生的mark然后在用pandoc, 我按照我笔记里面的来的,http://shomy.top/2016/10/22/hexo-markdown-mathjax/

@liuqinh2s

This comment has been minimized.

liuqinh2s commented Nov 16, 2017

原生的那个 hexo-renderer-marked 我卸载了,没有用的,我用的是 mac os x 系统

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment