-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MathML default output for Math #6092
Comments
+0; I'm not good at MathML. So I can't say anything about default. But it will become standard of web (in future). |
Considering the lack of MathML support in many browsers, I don't think it makes any sense to set a MathML builder as the default option now. It would be poor design from the side of Sphinx to have a default output option that doesn't work for most users (i.e. people using Google Chrome/Chromium). I suggest updating the docs no and keeping this issue for the time MathML support has made it to Chrome. |
What kills me is that support was in Chrom(ium) but they removed it, citing "security issues" iirc. Apparently as of 2019 there is a team working on slowly re-introducing the support, starting with a core set of features. |
Thanks for the info. I'll link to the official Chrome/Chromium trackers here:
|
FWIW, the links you posted make mention of support in Firefox, Opera, Safari, and (skeptically) Edge. I know Google has a pretty huge market share, but according to Google itself most other big browsers have MathML support. |
Either way, we have to implement MathML renderer. An extension like |
I like to consider myself pretty familiar with MathML itself. If I wasn't such trash at writing parsers, I'd offer to write it. Unless that's not necessary? Is there any chance Sphinx already creates ASTs for |
Of course yes!
No, it is not parsed. docutils' spec says:
So we have user input text in LaTeX math format simply. So we need to write a code for converting LaTeX to MathML. |
That could be very hard/expensive. LaTeX lets you nest basically arbitrary content in a math block with things like It'd be easier to support a limited subset like KaTeX, or to allow multiple representations of a single equation based on output type. Of course, that limits the kinds of complex things people sometimes do with math blocks. IMO they shouldn't be done in an equation, but it would be a breaking change. For my money, I think maybe it'd be better/easier to make a MathML parser - since it's a far simpler language - and translate that into LaTeX equations at build time for LaTeX output. That's a major, breaking change to the directive/role so idk if that's preferable to implementing a LaTeX parser. |
Docutils already contains some kind of a converter, however I am not sure how complete it is. |
Good to know! |
related python project: https://github.com/roniemartinez/latex2mathml |
Docutils' latex2mathml.py got a major upgrade in version 0.18. It is still provisional/in active development and there are plans to move the math format conversion to a transform in Docutils 1.0. |
Chrome is planned to support mathML soon: https://chromestatus.com/feature/5240822173794304 |
@bertini97 Chromium actually already supports MathML, so all modern browsers support it now! With the help of tools such as latex2mathml or LaTeXML I guess it should be possible to implement a |
Docutils supports MathML with its own latexmath2mathml module since 'ages'.
Just set 'math-output=mathml' in the config file:
https://docutils.sourceforge.io/docs/user/config.html#math-output
Unless the "math" implementation is overwritten by Sphinx, this should work out of the box.
sphinx-doc/sphinx
|
From the docs:
That's not totally true. MathML is a part of the HTML5 spec, though browser support is spotty to say the least. Since the alternative without installing plugins is just math not working, maybe a good default would be to follow the spec for the output format?
The text was updated successfully, but these errors were encountered: