laurent22 / joplin

Joplin - the privacy-focused note taking app with sync capabilities for Windows, macOS, Linux, Android and iOS.
https://joplinapp.org
Other
45.33k stars 4.93k forks source link

Math expressions cause unnecessary horizontal scroll in rendered MD #11152

Open annoyedhumanoid opened 3 days ago

annoyedhumanoid commented 3 days ago

Operating system

macOS

Joplin version

3.0.15

Desktop version info

Joplin 3.0.15 (prod, darwin)

Client ID: 11cb0a2d420047cd9119a44d443e827c Sync Version: 3 Profile Version: 47 Keychain Supported: Yes

Revision: 598677b

Backup: 1.4.1

Current behaviour

  1. Enable math expressions in Settings > Markdown
  2. Create an overflowing block element with horizontal scroll
  3. In that element, include a math expression, e.g., $a$. (The bug occurs for many, but not all, possible placements of this math expression.)
  4. With a narrow enough rendered markdown window, the viewer unnecessarily has horizontal scroll in addition to the overflowing element.

The bug appears to come from the absolute positioning of the span with class katex-mathml (see attached screen recording). To use the provided test file, open it in Joplin via File > Import > MD - Markdown (File).

https://github.com/user-attachments/assets/90561433-3dff-4ed5-bbe3-8efc7849a10e test.md

Expected behaviour

The rendered markdown viewer should not horizontally scroll to a blank canvas. See the included screen recording, when the position: absolute; rule is turned off on the offending span.

Logs

No response

personalizedrefrigerator commented 5 hours ago

This might be an upstream issue — the position: absolute; is present in the generated math on the KaTeX website: screenshot of katex.org: Shows position: absolute style present on the katex-mathml span

Possible downstream fixes: