From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#63518: 28.2; shr.el seems to break inline latex (mathjax) in html Date: Mon, 15 May 2023 17:01:47 +0300 Message-ID: <83ednh1yno.fsf@gnu.org> References: <13cc2bdf-67fc-9e2f-ba01-cbf2bb3e1624@riseup.net> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32928"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 63518@debbugs.gnu.org To: mousebot Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon May 15 16:02:38 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pyYmc-0008P4-P7 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 15 May 2023 16:02:38 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pyYmJ-0000O8-3q; Mon, 15 May 2023 10:02:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pyYm2-0000Na-Og for bug-gnu-emacs@gnu.org; Mon, 15 May 2023 10:02:07 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pyYm2-0007BU-GN for bug-gnu-emacs@gnu.org; Mon, 15 May 2023 10:02:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pyYm1-0000TM-Vh for bug-gnu-emacs@gnu.org; Mon, 15 May 2023 10:02:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 15 May 2023 14:02:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63518 X-GNU-PR-Package: emacs Original-Received: via spool by 63518-submit@debbugs.gnu.org id=B63518.16841593121801 (code B ref 63518); Mon, 15 May 2023 14:02:01 +0000 Original-Received: (at 63518) by debbugs.gnu.org; 15 May 2023 14:01:52 +0000 Original-Received: from localhost ([127.0.0.1]:44088 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pyYls-0000Sy-8C for submit@debbugs.gnu.org; Mon, 15 May 2023 10:01:52 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:38330) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pyYlq-0000Si-9S for 63518@debbugs.gnu.org; Mon, 15 May 2023 10:01:51 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pyYlk-000748-OS; Mon, 15 May 2023 10:01:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=u3tMpTa3XZHjCLXtvU9lhQqdSwGvDfjQgDEh8wqhsPg=; b=cApErg4APg8K 7LpAYjtEfQfB87KNWFpbslG0/uH4yxTCqb03pDFebl5Oi4dptXti+6GM5zDA0OSdDyFGsSgv/G5Qe 1baV7mjLCZ4CiM2aYDxvrp5bF3r8jnu/DxkY8xsxZoPb/yCv0LpOHOb/ULRYClYiwnSrJu43+x0SI w/VJDk50hfdMrOduqfkECxCV6z5AYZaNQzQPiSiIvXghoYUEcvkVcMpv576kn2pMZnM/bZJNRAYMa wBQvgi5Fa1jpwGv/RD51XPCOfbDaKgdUKMfiwmoc73WT8OdOed9iQpvCzwZjgmGA3kw4mGiYCvPB2 7HuR/o81FA6jUTxYmBgfRA==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pyYlk-0008Tw-4g; Mon, 15 May 2023 10:01:44 -0400 In-Reply-To: <13cc2bdf-67fc-9e2f-ba01-cbf2bb3e1624@riseup.net> (message from mousebot on Mon, 15 May 2023 13:21:51 +0200) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:261742 Archived-At: > Date: Mon, 15 May 2023 13:21:51 +0200 > From: mousebot > > 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.