ankitects / ankitects/anki

Bug with Mathjax/blockquote interaction

Open
#3,601 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

editor
Dominant language
Rust
Stars
31.2k
Forks
3.2k
Avg merge
2d 8h
Merged PRs (30d)
72

Description

With the following raw html.
<div><div><anki-mathjax></anki-mathjax><blockquote>a</blockquote></div></div>

Place your cursor to the right of the letter “a” (in the WYSIWYG). Then hit backspace.
The html will become
<anki-mathjax><img src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20id%3D%22mdi-math-integral-box%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cstyle%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml%22%3Esvg%20%7B%20color%3A%20black%3B%20fill%3A%20black%3B%20font-size%3A%2020px%3B%20%7D%3B%3C%2Fstyle%3E%3Cpath%20d%3D%22M19%203H5C3.9%203%203%203.9%203%205V19C3%2020.1%203.9%2021%205%2021H19C20.1%2021%2021%2020.1%2021%2019V5C21%203.9%2020.1%203%2019%203M15.9%206.9C15.9%206.9%2015.2%206.6%2014.9%206.6C14.3%206.5%2013.9%206.7%2013.7%207.7L12%2016.8C11.8%2017.6%2011.5%2018.2%2011%2018.6C10.6%2018.9%2010.2%2019%209.7%2019C8.9%2019%207.7%2018.5%207.7%2018.5L8.2%2017.1C8.2%2017.1%209%2017.4%209.2%2017.4C9.5%2017.5%209.7%2017.4%209.9%2017.3C10.1%2017.2%2010.2%2016.9%2010.3%2016.6L11.9%207.4C12%206.6%2012.4%206%2012.9%205.5C13.5%205.1%2014.2%205%2015%205.1C15.7%205.2%2016.5%205.6%2016.5%205.6L15.9%206.9Z%22%2F%3E%3C%2Fsvg%3E" class="mathjax svelte-npojru empty" alt="Mathjax" title="MathJax" data-anki="mathjax" data-uuid="bd012e03-a578-40e8-bad5-a7ff077fb20f" style="--vertical-center:5px; --font-size:20px;"></anki-mathjax><blockquote><br></blockquote>
It will look like this:

This is a minimal example. In practice the occurrence of the bug messes up all the mathjax in the note.
The bug does not happen with only 1 non-nested

.
Version ⁨24.06.3 (d678e393)⁩
Python 3.9.18 Qt 6.6.2 PyQt 6.6.1

Originally reported on https://forums.ankiweb.net/t/bug-mathjax-blockquote-interaction/52395

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the minimal nested-div HTML reproduction in the WYSIWYG editor and inspect the DOM before and after placing the cursor after “a” and pressing backspace. The fix is done when this deletion leaves the MathJax element and blockquote structure intact without affecting other MathJax in the note.

Written by the indexing model from the issue text.

Assessment

Tech stack
html
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.