liffiton / dokuwiki-plugin-mathjax

MathJax plugin for DokuWiki
https://www.dokuwiki.org/plugin:mathjax
12 stars 11 forks source link

Re-locate config file for AsciiMath? #35

Closed GJRobert closed 3 years ago

GJRobert commented 4 years ago

The config file mentioned on DokuWiki doc for AsciiMath, is not valid. Does anyone know of another config file/CDN path to make both TeX and AsciiMath work for this plugin?

liffiton commented 4 years ago

The links to the documentation need to be updated, it looks like. I'm working on that. Thanks for pointing that out!

The URL for the TeX/AsciiMath configuration provided on the wiki page should work, though. It's still valid. Are you having trouble with it?

GJRobert commented 4 years ago

The URL for the TeX/AsciiMath configuration provided on the wiki page should work, though. It's still valid. Are you having trouble with it?

For me, plugin default URL: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=TeX-AMS_CHTML.js renders math, not AsciiMath markup.

AsciiMath config URL on the wiki page: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/config/TeX-MML-AM_CHTML.js does not render MathJax nor AsciiMath at all.

Combine the both above: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=TeX-MML-AM_CHTML.js renders math, still no AsciiMath markup.

liffiton commented 3 years ago

[Sorry it took me so long to get to this.]

I'm not sure why, but the example URLs in the wiki were just wrong, so thanks for pointing that out.

Using https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML.js does work for me, rendering AsciiMath, but there are issues. If I just write a_i in backticks, it renders correctly, but more complex formulas run into issues with DokuWiki parsing things (like ^ for footnotes) and breaking things. The plugin is not currently setup to "protect" the AsciiMath within AsciiMath delimiters (the backticks).

You can work around that by putting the AsciiMath in %% to make Dokuwiki skip trying to parse is. So this works for me with the now-corrected URL linked above and now in the wiki:

%%`sum_(i=1)^n i^3=((n(n+1))/2)^2`%%

I'll close this issue (the URL in the wiki has been corrected) and open another about the broken AsciiMath support for the plugin overall.

GJRobert commented 3 years ago

Thanks to @liffiton The workaround works.

I also found that, AsciiMath can be put in backticks only, no need to use MathJax $...$ \(...\) $$...$$ \[...\]

liffiton commented 3 years ago

No problem. And I should have come back here to mention that I fixed the issue, too. So if you update to the latest version of the plugin, you shouldn't have to use the workaround anymore.