Wondering what’s next for npm?Check out our public roadmap! »

    markdown-it-simplemath

    1.0.0 • Public • Published

    Build Status NPM version Coverage Status

    markdown-it-simplemath

    This is a markdown-it plugin that adds simple math support. It is up to the caller to supply a rendering function.

    NOTE: For fully featured math rendering, you should use runarberg/markdown-it-math. This plugin was created for a particular need to render to images. It really just passes off whatever is inside $...$ to an external renderer.

    Originally developed for use with Markdown Here.

    Installation

    $ npm install markdown-it-simplemath
    

    Usage

    var md = require('markdown-it')();
    var mathRenderer = function(mathStr) {
      return '<img src="https://chart.googleapis.com/chart?cht=tx&chl={urlmathcode}" alt="{mathcode}">'
        .replace(/\{mathcode\}/ig, mathcode)
        .replace(/\{urlmathcode\}/ig, encodeURIComponent(mathcode));
    };
    md.use(require('markdown-it-simplemath'), {inlineRenderer: mathRenderer});
    console.log(md.render('$x \over y$'));

    Install

    npm i markdown-it-simplemath

    DownloadsWeekly Downloads

    1

    Version

    1.0.0

    License

    MIT

    Last publish

    Collaborators

    • avatar