
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
react-mathjax2
Advanced tools
React component to display math formulas written in AsciiMath or TeX.

npm install react-mathjax2 --save
import MathJax from 'react-mathjax2'
const ascii = 'U = 1/(R_(si) + sum_(i=1)^n(s_n/lambda_n) + R_(se))'
const content = `This can be dynamic text (e.g. user-entered) text with ascii math embedded in $$ symbols like $$${ascii}$$`
module.exports = () => {
return (
<MathJax.Context
input='ascii'
onLoad={ () => console.log("Loaded MathJax script!") }
onError={ (MathJax, error) => {
console.warn(error);
console.log("Encountered a MathJax error, re-attempting a typeset!");
MathJax.Hub.Queue(
MathJax.Hub.Typeset()
);
} }
script="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=AM_HTMLorMML"
options={ {
asciimath2jax: {
useMathMLspacing: true,
delimiters: [["$$","$$"]],
preview: "none",
}
} }
>
<MathJax.Text text={ content }/>
</MathJax.Context>
);
}
import MathJax from 'react-mathjax2'
const ascii = 'U = 1/(R_(si) + sum_(i=1)^n(s_n/lambda_n) + R_(se))'
module.exports = () => {
return (
<div>
<MathJax.Context input='ascii'>
<div>
This is an inline formula written in AsciiMath: <MathJax.Node inline>{ ascii }</MathJax.Node>
</div>
</MathJax.Context>
</div>
);
}
import MathJax from 'react-mathjax2'
const ascii = 'U = 1/(R_(si) + sum_(i=1)^n(s_n/lambda_n) + R_(se))'
module.exports = () => {
return (
<div>
<MathJax.Context input='ascii'>
<div>
<MathJax.Node>{ascii}</MathJax.Node>
</div>
</MathJax.Context>
</div>
);
}
import MathJax from 'react-mathjax2'
const tex = `f(x) = \\int_{-\\infty}^\\infty\\hat f(\\xi)\\,e^{2 \\pi i \\xi x}\\,d\\xi`
module.exports = () => {
return (
<div>
<MathJax.Context input='tex'>
<div>
This is an inline math formula: <MathJax.Node inline>{'a = b'}</MathJax.Node>
</div>
</MathJax.Context>
</div>
);
}
import MathJax from 'react-mathjax2'
const tex = `f(x) = \\int_{-\\infty}^\\infty\\hat f(\\xi)\\,e^{2 \\pi i \\xi x}\\,d\\xi`
module.exports = () => {
return (
<div>
<MathJax.Context input='tex'>
<div>
<MathJax.Node>{tex}</MathJax.Node>
</div>
</MathJax.Context>
</div>
);
}
MathJax.Context propsscript (String)https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_CHTMLinput (String)tex | asciiasciidelay (Number)options (Object)onLoad (Function)false)onError (Function)noGate (Boolean)false, controls whether to disallow rendering of children components until the MathJax script has finished loadingThis project is licensed under the MIT License - see the LICENSE.md file for details.
FAQs
React component for MathJax
The npm package react-mathjax2 receives a total of 4,677 weekly downloads. As such, react-mathjax2 popularity was classified as popular.
We found that react-mathjax2 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.