From a08885e8ba5365009869217025e1e1574d313ffc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 20 Feb 2026 19:04:15 +0000 Subject: [PATCH 1/3] chore(deps): bump latex2mathml from 3.78.0 to 3.78.1 Bumps [latex2mathml](https://github.com/roniemartinez/latex2mathml) from 3.78.0 to 3.78.1. - [Release notes](https://github.com/roniemartinez/latex2mathml/releases) - [Commits](https://github.com/roniemartinez/latex2mathml/compare/3.78.0...3.78.1) --- updated-dependencies: - dependency-name: latex2mathml dependency-version: 3.78.1 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.in | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.in b/requirements.in index a245b120b0..ff3997361e 100644 --- a/requirements.in +++ b/requirements.in @@ -36,5 +36,5 @@ packaging>=21.0 pycountry langcodes==3.5.1 pydantic==2.12.5 -latex2mathml==3.78.0 +latex2mathml==3.78.1 markdown-it-py==4.0.0 diff --git a/requirements.txt b/requirements.txt index b39caf151f..fc0ebd636c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -175,7 +175,7 @@ kombu==5.6.1 # via celery langcodes==3.5.1 # via -r requirements.in -latex2mathml==3.78.0 +latex2mathml==3.78.1 # via -r requirements.in le-utils==0.2.12 # via -r requirements.in From 4a9a5d67c2568a2cbc37e8bac51e24adc3135ed4 Mon Sep 17 00:00:00 2001 From: Jacob Pierce Date: Wed, 11 Mar 2026 10:18:43 -0700 Subject: [PATCH 2/3] fix: update test expectations for latex2mathml 3.78.1 block-mode munderover latex2mathml 3.78.1 correctly produces instead of for \sum and \prod in display="block" mode. Update hardcoded expected MathML in test assertions to match the corrected output. Co-Authored-By: Claude Opus 4.6 --- .../contentcuration/tests/utils/test_exercise_creation.py | 2 +- contentcuration/contentcuration/tests/utils/test_markdown.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/contentcuration/contentcuration/tests/utils/test_exercise_creation.py b/contentcuration/contentcuration/tests/utils/test_exercise_creation.py index d9cd3add1b..ae6a295e41 100644 --- a/contentcuration/contentcuration/tests/utils/test_exercise_creation.py +++ b/contentcuration/contentcuration/tests/utils/test_exercise_creation.py @@ -1603,7 +1603,7 @@ def test_free_response_question_with_maths(self): - ns + ns x an diff --git a/contentcuration/contentcuration/tests/utils/test_markdown.py b/contentcuration/contentcuration/tests/utils/test_markdown.py index c111146a85..dd564d8177 100644 --- a/contentcuration/contentcuration/tests/utils/test_markdown.py +++ b/contentcuration/contentcuration/tests/utils/test_markdown.py @@ -120,8 +120,8 @@ def test_mixed_inline_and_block(self): "

\n" "

And this is block math:

\n" '' - "i=1" - "nxi=y" + "i=1" + "nxi=y" '\sum_{i=1}^{n} x_i = y' # noqa W605 "" "

Back to text with more inline: " From 740dca25cc358415c31fe24e89f913d96fe09883 Mon Sep 17 00:00:00 2001 From: Jacob Pierce Date: Wed, 11 Mar 2026 11:18:21 -0700 Subject: [PATCH 3/3] test: add regression tests for block vs inline MathML element selection Verify that latex2mathml produces the correct MathML elements: - \sum and \prod in block mode use (limits above/below) - \sum in inline mode uses (limits beside) - \int in block mode still uses (unaffected by fix) Co-Authored-By: Claude Opus 4.6 --- .../tests/utils/test_markdown.py | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/contentcuration/contentcuration/tests/utils/test_markdown.py b/contentcuration/contentcuration/tests/utils/test_markdown.py index dd564d8177..0088d4a09e 100644 --- a/contentcuration/contentcuration/tests/utils/test_markdown.py +++ b/contentcuration/contentcuration/tests/utils/test_markdown.py @@ -132,6 +132,62 @@ def test_mixed_inline_and_block(self): self._assert_conversion(markdown_text, expected) + def test_block_sum_uses_munderover(self): + """Block-mode \\sum with sub+superscript must use , not """ + + markdown_text = "$$\\sum_{i=1}^{n} x_i$$" + expected = ( + '' + "i=1" + "nxi" + '\\sum_{i=1}^{n} x_i' + "" + ) + + self._assert_conversion(markdown_text, expected) + + def test_inline_sum_uses_msubsup(self): + """Inline-mode \\sum with sub+superscript must use , not """ + + markdown_text = "The sum $$\\sum_{i=1}^{n} x_i$$ is finite." + expected = ( + "

The sum " + 'i=1' + "nxi" + '\\sum_{i=1}^{n} x_i' + " is finite.

\n" + ) + + self._assert_conversion(markdown_text, expected) + + def test_block_prod_uses_munderover(self): + """Block-mode \\prod with sub+superscript must use """ + + markdown_text = "$$\\prod_{k=0}^{n} a_k$$" + expected = ( + '' + "k=0" + "nak" + '\\prod_{k=0}^{n} a_k' + "" + ) + + self._assert_conversion(markdown_text, expected) + + def test_block_int_unaffected(self): + """Block-mode \\int should still use (not affected by munderover fix)""" + + markdown_text = "$$\\int_{a}^{b} f(x) dx$$" + expected = ( + '' + "a" + 'bf(x)dx' + '\\int_{a}^{b} f(x) dx' + "" + ) + + self._assert_conversion(markdown_text, expected) + def test_no_math_content(self): """Test that regular markdown without math still works"""