Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mathjax-full

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mathjax-full

Beautiful and accessible math in all browsers. MathJax is an open-source JavaScript display engine for LaTeX, MathML, and AsciiMath notation that works in all browsers and in server-side node applications. This package includes the source code as well as

  • 3.2.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is mathjax-full?

The mathjax-full npm package is a comprehensive library for displaying mathematical notation in web pages. It supports a wide range of mathematical notations, including TeX, LaTeX, and MathML, and can render them in various formats such as HTML, SVG, and MathML. The package is highly customizable and can be integrated into different environments, including client-side and server-side applications.

What are mathjax-full's main functionalities?

Rendering TeX/LaTeX to HTML

This feature allows you to convert TeX/LaTeX mathematical notation into HTML. The code sample demonstrates how to set up MathJax to render a simple equation 'E = mc^2' into HTML.

const { mathjax } = require('mathjax-full/js/mathjax.js');
const { TeX } = require('mathjax-full/js/input/tex.js');
const { CHTML } = require('mathjax-full/js/output/chtml.js');
const { liteAdaptor } = require('mathjax-full/js/adaptors/liteAdaptor.js');
const { RegisterHTMLHandler } = require('mathjax-full/js/handlers/html.js');

const adaptor = liteAdaptor();
RegisterHTMLHandler(adaptor);

const tex = new TeX();
const chtml = new CHTML();
const html = mathjax.document('', { InputJax: tex, OutputJax: chtml });

const node = html.convert('E = mc^2', { display: true });
console.log(adaptor.outerHTML(node));

Rendering MathML to SVG

This feature allows you to convert MathML notation into SVG. The code sample demonstrates how to set up MathJax to render a simple MathML representation of 'E = mc^2' into SVG.

const { mathjax } = require('mathjax-full/js/mathjax.js');
const { MathML } = require('mathjax-full/js/input/mathml.js');
const { SVG } = require('mathjax-full/js/output/svg.js');
const { liteAdaptor } = require('mathjax-full/js/adaptors/liteAdaptor.js');
const { RegisterHTMLHandler } = require('mathjax-full/js/handlers/html.js');

const adaptor = liteAdaptor();
RegisterHTMLHandler(adaptor);

const mathml = new MathML();
const svg = new SVG();
const html = mathjax.document('', { InputJax: mathml, OutputJax: svg });

const node = html.convert('<math><mrow><mi>E</mi><mo>=</mo><mi>mc</mi><msup><mn>2</mn></msup></mrow></math>', { display: true });
console.log(adaptor.outerHTML(node));

Customizing MathJax Configuration

This feature allows you to customize the configuration of MathJax, such as specifying which TeX packages to use and setting the font URL for CHTML output. The code sample demonstrates how to configure MathJax to use the 'base' and 'ams' TeX packages and a custom font URL.

const { mathjax } = require('mathjax-full/js/mathjax.js');
const { TeX } = require('mathjax-full/js/input/tex.js');
const { CHTML } = require('mathjax-full/js/output/chtml.js');
const { liteAdaptor } = require('mathjax-full/js/adaptors/liteAdaptor.js');
const { RegisterHTMLHandler } = require('mathjax-full/js/handlers/html.js');

const adaptor = liteAdaptor();
RegisterHTMLHandler(adaptor);

const tex = new TeX({ packages: ['base', 'ams'] });
const chtml = new CHTML({ fontURL: 'https://cdn.jsdelivr.net/npm/mathjax@3/es5/output/chtml/fonts/woff-v2' });
const html = mathjax.document('', { InputJax: tex, OutputJax: chtml });

const node = html.convert('E = mc^2', { display: true });
console.log(adaptor.outerHTML(node));

Other packages similar to mathjax-full

Keywords

FAQs

Package last updated on 08 Jun 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc