[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#63518: 28.2; shr.el seems to break inline latex (mathjax) in html
From: |
Eli Zaretskii |
Subject: |
bug#63518: 28.2; shr.el seems to break inline latex (mathjax) in html |
Date: |
Mon, 15 May 2023 17:01:47 +0300 |
> Date: Mon, 15 May 2023 13:21:51 +0200
> From: mousebot <mousebot@riseup.net>
>
> The fediverse client I maintain, mastodon.el, uses shr-render-region to
> render individual posts. Some instances, e.g. https://mathstodon.xyz, allow
> users to post inline latex using mathjax notation.
>
> When shr.el renders inline latex, it often breaks it as it fills the text. It
> inserts a newline in between the two characters that open an inline latex
> block: `\(` or `\[`. Using normal fill commands to fill text (fill-region,
> fill paragraph) do not split latex in this way, from what I could gather.
>
> When digging around and debugging a little, I found that in
> shr-find-fill-point, the check (shr-char-kinsoku-eol-p (following-char)) in
> the when condition returns t when point is in between \ and ( or [, meaning
> that shr-find-fill-point considers that position to be a breakable point.
> Commenting that single check seems to largely prevent the undesired
> splitting. (Behaviour confirmed by my checks and also by another mastodon.el
> user.)
>
> I don't really understand the significance of the checks that
> shr-find-fill-point runs, nor whether they can be temporarily deactivated or
> worked around in some other way.
That function looks for a suitable place to break the line in two.
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?
Thanks.