mathjax syntax support (#175)

* fix: mathjax syntax support extended

* fix: adding mathjax support
This commit is contained in:
Mehak Nasir
2022-05-30 17:02:11 +05:00
committed by GitHub
parent 8dd19de8a2
commit 8fd3ac7bd9
14 changed files with 18792 additions and 9357 deletions

View File

@@ -1,15 +1,14 @@
// eslint-disable react/no-danger
import React from 'react';
import PropTypes from 'prop-types';
import MathJax from 'react-mathjax-preview';
import { MathJax } from 'better-react-mathjax';
function HTMLLoader({ htmlNode, componentId, cssClassName }) {
const isLatex = htmlNode.match(/(\${1,2})((?:\\.|.)*)\1/);
return (
isLatex ? <MathJax math={htmlNode} id={componentId} className={cssClassName} />
// eslint-disable-next-line react/no-danger
: <div className={cssClassName} id={componentId} dangerouslySetInnerHTML={{ __html: htmlNode }} />
<MathJax>
<div className={cssClassName} id={componentId} dangerouslySetInnerHTML={{ __html: htmlNode }} />
</MathJax>
);
}