Giter Club home page Giter Club logo

markdown-it-tex-equations's Introduction

markdown-it-tex-equations

在 markdown-it 中支持 TEX 数学公式,避免数学公式的某部分被解析为 markdown。

参考 markdown-it-katex 以及 markdown-it-mathjax3 的代码实现。

快速开始

  1. 安装 markdown-it 和这个插件

    npm install markdown-it markdown-it-tex-equations
  2. 在你的代码中使用

    var md = require('markdown-it')(),
        math = require('markdown-it-tex-equations');
    
    md.use(math);
    
    // double backslash is required for javascript strings, but not html input
    var result = md.render('# Math Rulez! \n  $\\sqrt{3x-1}+(1+x)^2$');

自定义

支持在代码块中插入 \displaylines{} 以让 Mathjax 3 支持公式换行。

md.use(math,{inline:false,block:true});

以上为默认值,inline 表示内联公式是否开启,block 表示多行公式是否开启,如果使用 Mathjax 2 或者 Katex,请传入 {inline:false,block:false}

markdown-it-tex-equations's People

Contributors

llingy avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.