Skip to content

Fix mathjax wrap newline handling and add regression test#5107

Open
Arthur-Milchior wants to merge 1 commit into
ankitects:mainfrom
Arthur-Milchior:br_mj
Open

Fix mathjax wrap newline handling and add regression test#5107
Arthur-Milchior wants to merge 1 commit into
ankitects:mainfrom
Arthur-Milchior:br_mj

Conversation

@Arthur-Milchior

@Arthur-Milchior Arthur-Milchior commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

If you start by writing the mathjax and then wrapping it with the mathjax tools, the new lines are incorrectly rendered as <br>. This problem exists generally with any formatting, but in my experience, the new line case is the most common one. In particular because there is currently zero way to add the new line properly before wrapping the math in mathjax.

Further correction will wait until someone with decision power give feedback on the issue request.

This change is done with a simple search and replace and not parsing HTML, for the sake of the simplicity, and to ensure this still works if HTML is somehow badly formatted.

Refs #5106

If you start by writing the mathjax and then wrapping it with the
mathjax tools, the new lines are incorrectly rendered as `<br>`. This
problem exists generally with any formatting, but in my experience,
the new line case is the most common one. In particular because there
is currently zero way to add the new line properly before wrapping the
math in mathjax.

Further correction will wait until someone with decision power give
feedback on the issue request.

This change is done with a simple search and replace and not parsing
HTML, for the sake of the simplicity, and to ensure this still works
if HTML is somehow badly formatted.

Bug ankitects#5106
@Arthur-Milchior

Copy link
Copy Markdown
Contributor Author
  1) ts/tests/e2e/context-switching.spec.ts:171:5 › chooser UI and session behaviour › notetype chooser updates field list via the Svelte path 

    TimeoutError: page.waitForSelector: Timeout 15000ms exceeded.
    Call log:
      - waiting for locator('.note-editor') to be visible


       at fixtures.ts:37

      35 |         await installBridgeStub(page);
      36 |         await page.goto("/editor/?mode=add", { waitUntil: "domcontentloaded" });
    > 37 |         await page.waitForSelector(".note-editor", { timeout: 15_000 });
         |                    ^
      38 |         await use(page);
      39 |     },
      40 |
        at Object.editorPage (/home/runner/work/anki/anki/ts/tests/e2e/fixtures.ts:37:20)

As far as I can see, the current CI error in unrelated to this PR

@ankitects ankitects deleted a comment from cursor Bot Jul 10, 2026
@abdnh abdnh self-assigned this Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants