According to HTML 5, the closing tag of p element can be omitted if it is followed by a div. However, <math display="block"> generates a div regardless of whether it is used inside a paragraph. This means the surrounding p element is implicitly closed, which is not desired.
Goal: The math rendering should only generate elements that can be used within a p element.
- native MathML rendering with PHP: The new native rendering does not use any surrounding elements and just outputs the plain MathML element with the display attribute . (patch)
- SVG or MathML via mathoid: proposed solution (demo)
- LaTeXML rendering with LaTeXML (not wmf-deployed): Uses the same elements as SVG even though we stopped generating fallback images for LaTeXML recently. Thus, this does not need to be treated separately.