Subject: bug#63518: 28.2; shr.el seems to break inline latex (mathjax) in html

From: Eli Zaretskii <[email-masked]>
Date: Mon, 15 May 2023 17:29:36 +0300

[Please use Reply All to keep the bug tracker CC'ed.]

> Date: Mon, 15 May 2023 16:14:47 +0200
> From: mousebot <[email-masked]>
> 
> Thanks for your response Eli.
> 
> Yes, I'm aware of that the function does that. What I meant is I don't understand how the kinsoku functions in the when clause work, so I don't feel qualified to hack around with them.
> 
> > 
> > The question is whether we can reliably determine that we are inside
> > inline latex, so that we augment the conditions for a break point.
> > Turning that off unconditionally is not an option.  Do you happen to
> > know about some criteria to be applied to distinguish this special
> > case?
> 
> I wondered if we couldn't modify the functionality to flag that the html being rendered (may) contain inline latex? (An optional argument say, so that it only tries to render inline latex if specified.)

The problem is that HTML that includes inline latex can also include
other text that needs the kinsoku treatment.  So this cannot be a
global flag, it must be raised only while processing the inline latex
part.

> Re inline latex, I don't know much about it myself. From what I have seen on the mathjax website and the examples in the thread I shared, it is enclosed in \[...\] or \(...\). I also read that it can be enclosed in $...$, but I haven't seen that on mathstodon.xyz.
> 
> I wrote a (probably *un*reliable!) fill-predicate function with regexes, one set to check if we were in between the \ and ( or [, and one to check if we were somewhere in between a \( or \[ and a \) or \]. But then I realized that shr seemingly doesn't working with fill-predicates, but makes its own filling decisions.
>