Don't use protected in math mode

Issue #110 new
Pieter Belmans created an issue

At the moment, if rich text contains a {} in math mode it will also get the protected treatment (e.g. for HTML a <span> will be inserted, for plaintext it will be removed).

This is not quite the desired behaviour though: in HTML one will probably use MathJax for the rendering, and then missing brackets is a problem.

A possible solution would be to just ignore math mode when parsing a string. More ideally one could implement a new rich text class, and e.g. use asciiMath or some human-readable format when outputting to plaintext.

I'll have a go at the first solution one of these days.

Comments (4)

  1. Pieter Belmans reporter

    Attached is the quickest solution to this problem. Some obvious issues are: no dealing with \$, no dealing with \( and \) as means to a math mode, no explicit check on math mode being closed at the end of the string.

    For the somewhat non-trivial use case I have in mind this solution is good enough.

  2. Hong

    I agree this has caused some issues for me. We shouldn't protect texts in math.

    Since you are using MathJax, I think it is essential to handle \( and \) rather than $, since MathJax discourages the use of using $ as the delimiter.

  3. Hong

    Can you perhaps make this as a PR? Since you already have the patch written up, a PR, which often significantly increase the visibility of this issue for the author(s), would be very helpful.

  4. Log in to comment