remarkjs/remark-math

rehype-mathjax: use `abstractAdopter` instead of `jsdomAdaptor` / `browserAdaptor`

wooorm opened this issue · 5 comments

Problem

JsDom is heavy, and an alternative to rehype, which we’re already using. It’s probably better to use AbstractAdopter and map it to hast, instead of using jsdomAdaptor / browserAdaptor to create a DOM and then transform that to hast.

Expected behaviour

Directly do mathjax -> hast, instead of mathjax -> dom -> hast

tani commented

lightAaptor is also adaptor for lightDOM. Thus, mathjax -> dom -> hast is not changed.
If you want to do that, we should implement AbstractDOMAdopter abstract class to hast instead.
https://github.com/mathjax/MathJax-src/blob/5e9a5c66de610dd754a0377b278892ae4f007058/ts/core/DOMAdaptor.ts#L343

Oh great, that looks better! I couldn’t find any docs on these things 🤔 is there some place where you find these things, or is it reading the code too?

tani commented

I've just read the code. Currently, the developers guide of MathJax is under construction. https://docs.mathjax.org/en/latest/api/direct.html

Was looking at this some more today, I won’t have a lot of time to work on it, but I think it would be a very valuable feature. @tani, is this something you could take on? Or someone else?

@tani was that 🚀 a yes? ;)