mathjax-dom

0.5.0 • Public • Published

MathJax DOM npm CircleCI

Prerenders all math equations over an entire HTML string using MathJax.

API

/**
 * Parses an HTML string and prerenders all math equations using MathJax.
 *
 * @param {String} htmlString - HTML string to process.
 * @param {Object} [pageOptions] - Options for [`mathjax-node-page`](https://github.com/pkra/mathjax-node-page)'s
 *                                 `mjpageConfig` object.
 * @param {Object} [nodeOptions] - Options for [`mathjax-node-page`](https://github.com/pkra/mathjax-node-page)'s
 *                                 `mjnodeConfig` object.
 *
 * @return {Promise<String>} - Promise with the output HTML string as the
 *                             fulfillment value.
 */
function mathjaxDOM(htmlString, pageOptions, nodeOptions)

Usage

This module crawls the HTML string for delimiters \( ... \) and $$ ... $$. You can override this in options.

Example:

const mathjaxDOM = require('mathjax-dom');
 
mathjaxDOM(`<some_html>`)
  .then(htmlString => {
    // The output HTML string with all math equations prerendered.
    console.log(htmlString);
  })
  .catch(err => {
    throw err;
  });
});

Disclaimer

This is an experimental project driven by internal requirements.

Readme

Keywords

none

Package Sidebar

Install

npm i mathjax-dom

Weekly Downloads

1

Version

0.5.0

License

MIT

Unpacked Size

4.05 kB

Total Files

4

Last publish

Collaborators

  • andrewscwei