折腾公式+参考文献

折腾公式+参考文献

公式

不兼容问题
采用kramed

npm uninstall hexo-renderer-marked --save
npm install hexo-renderer-kramed --save

同时修改\node_modules\kramed\lib\rules\inline.js
//11行
// escape: /^\\([\\`*{}\[\]()#$+\-.!_>])/,
escape: /^\\([`*\[\]()#$+\-.!_>])/,

//21行
//em: /^\b_((?:__|[\s\S])+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,
em: /^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,

配置MathJax

<!-- MathJax配置,可通过单美元符号书写行内公式等 -->
script(type='text/javascript', src='cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML')

script(type='text/x-mathjax-config').
  MathJax.Hub.Config({
    tex2jax: {
    inlineMath: [['$','$'], ['\\(','\\)']],
    processEscapes: true,
    ignoreClass: "tex2jax_ignore|dno",
    skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
    },
    TeX: {
    equationNumbers: { autoNumber: "AMS" },
    noUndefined: {attributes: { mathcolor: "red", mathbackground: "#FFEEEE", mathsize: "90%" }},
    Macros: {href: "{}"}
    },
    messageStyle: "none",
    "HTML-CSS": {
    preferredFont: "TeX",
    availableFonts: ["STIX","TeX"],
    linebreaks: { automatic:true },
    EqnChunk: (MathJax.Hub.Browser.isMobile ? 10 : 50) 
    }
    });

<!-- 给MathJax元素添加has-jax class -->
script(type='text/x-mathjax-config').
 MathJax.Hub.Queue(function() {
  var all = MathJax.Hub.getAllJax(), i;
  for(i=0; i < all.length; i += 1) {
    all[i].SourceElement().parentNode.className += ' has-jax';
    }
  });

<!-- script(type='text/javascript', src='cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML') -->
<!-- script(type='text/javascript', src='https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML') -->

这里有个坑需注意

千万别好奇选择了MathML

参考文献

采用hexo-renderer-markdown-it插件

参见hexo-renderer-markdown-it 插件 详解

对应的maupassant主题css配置

.footnote-item{
    font-size: 15px;
    line-height: 1.77; 
    color: #2097d2;
}

.footnotes .footnotes-list .footnote-item p{
    margin:0;
}

.footnote-backref{
    display: none;   
}