zoukankan      html  css  js  c++  java
  • 在HEXO主题中添加数学公式支持

    在markdown中书写数学符号的方式参考Latex常用数学符号

    Mathjax

    安装

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

    修改

    打开node_modules/hexo-renderer-kramed/lib/renderer.js,将

    // Change inline math rule
    function formatText(text) {
        // Fit kramed's rule: $$ + 1 + $$
        return text.replace(/`$(.*?)$`/g, '$$$$$1$$$$');
    }
    

    改为:

    // Change inline math rule
    function formatText(text) {
        return text;
    }
    

    卸载

    npm uninstall hexo-math --save
    

    安装

    npm install hexo-renderer-mathjax --save
    

    修改

    打开node_modules/hexo-renderer-mathjax/mathjax.html,将 <script> 改为:

    <script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_CHTML"></script>
    

    打开node_modules/kramed/lib/rules/inline.js:

    首先将

    escape: /^\([\`*{}[]()#$+-.!_>])/,
    

    改为:

    escape: /^\([`*[]()# +-.!_>])/,
    

    然后将

    em: /^_((?:__|[sS])+?)_|^*((?:**|[sS])+?)*(?!*)/,
    

    改为:

    em: /^*((?:**|[sS])+?)*(?!*)/,
    

    开启公式支持功能

    home/_config.yml,中添加如下内容

    mathjax:
        enable: true
    
  • 相关阅读:
    python之jupyter
    python处理图片
    python之图片指纹(唯一性的)
    python之操作elasticsearch7.6.0
    elasticsearch之索引
    elasticsearch
    Nginx 出现 403 Forbidden解决方案
    centos 防火墙命令
    centos nginx常用的命令
    搭建centos nginx环境
  • 原文地址:https://www.cnblogs.com/zhyantao/p/10424874.html
Copyright © 2011-2022 走看看