MathJax filter and Markdown - display issues

MathJax filter and Markdown - display issues

by Przemek Kaszubski -
Number of replies: 8
Picture of Particularly helpful Moodlers Picture of Testers

Hi,

We have been playing with the MathJax filter and the Markdown editor on Moodle 3.6.5.

Essentially, our observations are that the MathJax filter does not work like it should "out-of-the-box".

Namely:

1) If we ONLY wish to use the inline typesetting style, we have to a add a p html element at the beginning like this:



to force MathJax to load.


2) To use both "display" (paragraph) style and inline style in the same doc, strangely all that suffices is the additional escaping of the inline code, eg.




We find these odd and unpredictable, so here are two questions:

A) Are these known / excusable behaviours, or possibly bugs of the Markdown or MathJax filter editor?
[a question to be possibly asked on the Editors forum as well, but I thought I would start here.]


B) If the former is the case, i.e. these two look like legit behaviours, should the editing conventions I gave above be added to the MathJax filter documentation at https://docs.moodle.org/en/MathJax_filter ?


Any other thoughts or suggestions, I'd be grateful.

Regards,

Przemek


Average of ratings: Useful (1)
In reply to Przemek Kaszubski

Re: MathJax filter and Markdown - display issues

by Daniel Thies -
Picture of Core developers Picture of Plugin developers Picture of Testers

Hi Przemek,

I am not sure what you mean by only inline delimiter. Do you mean $ if so that has to be listed in the filter configuration under additional delimiters and should already be documented.

The need to escape brackets is an artifact of the markdown specification. The brackets are interpreted by markdown in order to specify links. They are escaped with a backslash in markdown if you really want a bracket. It may look odd as \(\TeX\), but makes sense as markdown.

In reply to Daniel Thies

Re: MathJax filter and Markdown - display issues

by Przemek Kaszubski -
Picture of Particularly helpful Moodlers Picture of Testers
Hi Daniel,

Thanks for responding. Escaping is in fact a non-issue here. Our main concern is with having to add that extra html element at the start to force the MathJax filter to kick in - if only the inline convention is used on a Markdown page. Simple escaping does not suffice then, apparently. It could be a limitation of the Markdown implementation in Moodle..
In reply to Przemek Kaszubski

Re: MathJax filter and Markdown - display issues

by Daniel Thies -
Picture of Core developers Picture of Plugin developers Picture of Testers

What do you mean by "only the inline convention"?

In reply to Daniel Thies

Re: MathJax filter and Markdown - display issues

by Przemek Kaszubski -
Picture of Particularly helpful Moodlers Picture of Testers
Only using the backslash+brackets.
Never using even once the dollar-sign display.
In reply to Przemek Kaszubski

Re: MathJax filter and Markdown - display issues

by Daniel Thies -
Picture of Core developers Picture of Plugin developers Picture of Testers

I am not seeing the same problem here. Do you have some other filters active? in particular in the list above MathJax filter in priority? Can you reproduce the problem here or on the sandbox?

In reply to Daniel Thies

Re: MathJax filter and Markdown - display issues

by Przemek Kaszubski -
Picture of Particularly helpful Moodlers Picture of Testers

Here's a sequence of screenshots showing how we replicated the issue in the Moodle Sandbox. The user's editor of choice is Markdown.

1) After entering this:



We saved and saw NO trace of MathJax filter working:



2. When we combined the original text with some part delimited by dollar signs:



Then after saving we saw the expected MathJax output for both formulae entered:



3. We found that in order for our first case to work at all, we need to prefix the input with an HTML "hack" like this:



After saving the above, the MathJax filter is prompted correctly, producing:




We tried various combinations and arrangements of filters, but this had no effect on the above described imperfect performance of the Mathjax filter over Markdown pages. 

Thanks for any further assistance.

Przemek

In reply to Przemek Kaszubski

Re: MathJax filter and Markdown - display issues

by Daniel Thies -
Picture of Core developers Picture of Plugin developers Picture of Testers

I am not sure why, but this seems inconsistent. I found that Page and Label, and Quiz operate as you have shown. However, in a forum post it Mathjax works without the extra code. It also seems to work on the users profile page.

In reply to Daniel Thies

Re: MathJax filter and Markdown - display issues

by Przemek Kaszubski -
Picture of Particularly helpful Moodlers Picture of Testers
Thanks, this is a useful tip, could be an issue with some of the Moodle modules then. We''ll try to verify and then maybe open a tracker issue for that.