mehdisadeghi / react-mathjax-preview

The MathJax React component you were looking for.
https://mehdisadeghi.github.io/react-mathjax-preview/
MIT License
49 stars 30 forks source link

allow to configure root tags rendered by MathJaxPreview #57

Closed bertrand-riviere closed 3 years ago

bertrand-riviere commented 3 years ago

hello, first, thanks for this nice component, it is very useful!

i ran into an issue because i need to render MathJax components inside <p> elements (and i cannot change that); this causes an annoying React warning: "Warning: validateDOMNesting(...): <div> cannot appear as a descendant of <p>." (+ this warning actually makes sense since it is not semantically correct to put <div> inside <p>)

i wondered if you would accept a PR that allows to configure the tag, ex: React.createElement(tag, ...) where "tag" is a new prop of MathJaxPreview instead of the "hardcoded" <div> s that are actually rendered? by having a defaultProps for "tag" of 'div', the behaviour would remain the same than today and i (+ others) could use this new props to avoid similar problems.

mehdisadeghi commented 3 years ago

Hi @bertrand-riviere , You are very welcome to send me a PR if you have a fix for that.