Skip to content
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

No math support at all? #42

Closed
bk322 opened this issue Dec 21, 2013 · 8 comments
Closed

No math support at all? #42

bk322 opened this issue Dec 21, 2013 · 8 comments

Comments

@bk322
Copy link

bk322 commented Dec 21, 2013

rst2html supports math:

.. math::

   x^2

divs get some math processing depending on the command line options of the rst2html. However rst2html5 just leaves plain divs.

@marianoguerra
Copy link
Owner

I just added support for mathjax:

https://github.com/marianoguerra/rst2html5/blob/master/examples/mathjax.rst

check if it's ok for you

I don't know a lot about mathjax (or maths :P) so let me know how it works for you

@bk322
Copy link
Author

bk322 commented Feb 8, 2014

Thank You.

I got

rst2html5: error: no such option: --mathjax

I use the latest version:

~/cmp/blds/misc3/rst2html5: git log
commit d7d211ba671b2f0ae98071bccc18593a593d523c
Author: Mariano Guerra <luismarianoguerra@gmail.com>
Date:   Fri Feb 7 01:49:26 2014 +0100

    mention mathjax on the readme

commit 1bdba5aa2223ee09ca0e1e87a154d8d9792a2048
Author: Mariano Guerra <luismarianoguerra@gmail.com>
Date:   Fri Feb 7 01:45:48 2014 +0100

    initial attempt at math support

Does it work for You?
Actually MathML is more important for me. Math works fine in the vanillay rst2html. I just thought maybe You can leave the math as it is there.

@torfsen
Copy link
Contributor

torfsen commented Nov 6, 2015

It seems that non-MathJax math support was removed in 2b667c4 when a new Writer was introduced. It looks like MathML and other options were supported before that. I'd also prefer to have more choices than just MathJax, and, more important, I'd like to use RST markup for declaring math (i.e. the :math: role and the .. math:: directive). With the current MathJax support, on the other hand, it seems that I need to use MathJax markup in my RST files. That's rather contrary to the idea of keeping semantics (RST) and display (HTML, CSS, MathJax) separate.

In my opinion, the ideal solution would be to have an option for selecting the math output variant (MathML, MathJax, etc.) and the :math: role and .. math:: directive would then be translated into appropriate code. That would allow users to switch from MathML to MathJax (and vice versa) by simply changing the options they use to call rst2html5. If I understand things correctly that is also the approach that was used in the old writer.

@marianoguerra: Is that something that would be OK for you? If so I would try to implement that and create a PR.

@marianoguerra
Copy link
Owner

hi, thanks for the comment, I don't use math myself so you seem to know more than I do, please create a PR and I will merge it, I guess it's better than the current state of things :)

@torfsen
Copy link
Contributor

torfsen commented Nov 10, 2015

I'll prepare PR, although it may take me time since things are pretty busy here at the moment.

torfsen added a commit to torfsen/rst2html5 that referenced this issue Nov 20, 2015
torfsen added a commit to torfsen/rst2html5 that referenced this issue Nov 20, 2015
@torfsen
Copy link
Contributor

torfsen commented Nov 22, 2015

I'm working on this. Most of it is done, but some small issues still need to be fixed. Basically I took the code from the original docutils, refactored it and adapted it to our architecture.

@marianoguerra: Once everything works I would remove the current MathJax-postprocessor, is that OK with you?

@marianoguerra
Copy link
Owner

@torfsen if the replacement works, I'm ok with it.

torfsen added a commit to torfsen/rst2html5 that referenced this issue Nov 23, 2015
torfsen added a commit to torfsen/rst2html5 that referenced this issue Nov 26, 2015
torfsen added a commit to torfsen/rst2html5 that referenced this issue Nov 26, 2015
torfsen added a commit to torfsen/rst2html5 that referenced this issue Dec 2, 2015
torfsen added a commit to torfsen/rst2html5 that referenced this issue Dec 2, 2015
torfsen added a commit to torfsen/rst2html5 that referenced this issue Dec 2, 2015
torfsen added a commit to torfsen/rst2html5 that referenced this issue Dec 2, 2015
@torfsen
Copy link
Contributor

torfsen commented Dec 2, 2015

This should be ready to go. Documentation (well ,the README) and tests have been updated.

I've added new configuration options (--mathjax-url, --mathjax-config, --math-css) to get away from previous means (--math-output "mathjax foo" and --mathjax-opts url=foo,config=bar) which I find not very user friendly (and harder to handle in the code, too). The old approaches are still supported (but not documented), though.

I've also decided to keep the MathJax postprocessor to make sure that we stay backwards-compatible. However I removed its detailed documentation and marked it as deprecated instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants