From 11375c0602e3b2f61f70d638ee1ea4afe5c52630 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Canouil?= <8896044+mcanouil@users.noreply.github.com> Date: Sun, 18 May 2025 13:28:40 +0200 Subject: [PATCH 1/6] fix: use consistent equation numbering for `html-math-method` and `html-math-method.method` (MathJax and KaTeX) --- news/changelog-1.8.md | 1 + src/resources/filters/crossref/equations.lua | 3 +++ 2 files changed, 4 insertions(+) diff --git a/news/changelog-1.8.md b/news/changelog-1.8.md index 8d8b3e2065..f839c9c83d 100644 --- a/news/changelog-1.8.md +++ b/news/changelog-1.8.md @@ -16,6 +16,7 @@ All changes included in 1.8: - ([#12259](https://github.com/quarto-dev/quarto-cli/issues/12259)): Fix conflict between `html-math-method: katex` and crossref popups (author: @benkeks). - ([#12734](https://github.com/quarto-dev/quarto-cli/issues/12734)): `highlight-style` now correctly supports setting a different `light` and `dark`. - ([#12747](https://github.com/quarto-dev/quarto-cli/issues/12747)): Ensure `th` elements are properly restored when Quarto's HTML table processing is happening. +- ([#12766](https://github.com/quarto-dev/quarto-cli/issues/12766)): Use consistent equation numbering for `html-math-method` and `html-math-method.method` (MathJax and KaTeX) ### `revealjs` diff --git a/src/resources/filters/crossref/equations.lua b/src/resources/filters/crossref/equations.lua index 0ecb0e430b..00431e11a1 100644 --- a/src/resources/filters/crossref/equations.lua +++ b/src/resources/filters/crossref/equations.lua @@ -63,6 +63,9 @@ function process_equations(blockEl) else local eqNumber = eqQquad local mathMethod = param("html-math-method", nil) + if type(mathMethod) == "table" and mathMethod["method"] then + mathMethod = mathMethod["method"] + end if _quarto.format.isHtmlOutput() and (mathMethod == "mathjax" or mathMethod == "katex") then eqNumber = eqTag end From 253b9cb47d474f46d76400e2ee1bd2b87a402eea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Canouil?= <8896044+mcanouil@users.noreply.github.com> Date: Sun, 18 May 2025 13:30:31 +0200 Subject: [PATCH 2/6] chore: small rewording --- news/changelog-1.8.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/news/changelog-1.8.md b/news/changelog-1.8.md index f839c9c83d..1813357f21 100644 --- a/news/changelog-1.8.md +++ b/news/changelog-1.8.md @@ -16,7 +16,7 @@ All changes included in 1.8: - ([#12259](https://github.com/quarto-dev/quarto-cli/issues/12259)): Fix conflict between `html-math-method: katex` and crossref popups (author: @benkeks). - ([#12734](https://github.com/quarto-dev/quarto-cli/issues/12734)): `highlight-style` now correctly supports setting a different `light` and `dark`. - ([#12747](https://github.com/quarto-dev/quarto-cli/issues/12747)): Ensure `th` elements are properly restored when Quarto's HTML table processing is happening. -- ([#12766](https://github.com/quarto-dev/quarto-cli/issues/12766)): Use consistent equation numbering for `html-math-method` and `html-math-method.method` (MathJax and KaTeX) +- ([#12766](https://github.com/quarto-dev/quarto-cli/issues/12766)): Use consistent equation numbering display for `html-math-method` and `html-math-method.method` (MathJax and KaTeX) ### `revealjs` From 64e4239398e32f1e7fbab314ddce55ec105e1aa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Canouil?= <8896044+mcanouil@users.noreply.github.com> Date: Sun, 18 May 2025 17:17:49 +0200 Subject: [PATCH 3/6] test: add smoke test --- .../docs/smoke-all/2025/05/18/issue12766.qmd | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tests/docs/smoke-all/2025/05/18/issue12766.qmd diff --git a/tests/docs/smoke-all/2025/05/18/issue12766.qmd b/tests/docs/smoke-all/2025/05/18/issue12766.qmd new file mode 100644 index 0000000000..59970ffac8 --- /dev/null +++ b/tests/docs/smoke-all/2025/05/18/issue12766.qmd @@ -0,0 +1,26 @@ +--- +format: + html-default: + output-file: default + html-math-method: mathjax + html-math: + output-file: math + html-math-method: + method: mathjax +_quarto: + tests: + html-default: + ensureFileRegexMatches: + - ['\\tag\{1\}\\]'] + - [] + html-math: + ensureFileRegexMatches: + - ['\\tag\{1\}\\]'] + - [] +--- + +$$ +\alpha = \beta +$$ {#eq-ab} + +This is @eq-ab. From ceb79e18a4c94dea68bd209d643e9f0341089919 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Canouil?= <8896044+mcanouil@users.noreply.github.com> Date: Sun, 18 May 2025 17:22:11 +0200 Subject: [PATCH 4/6] refactor: split in two as tests do not support variant formats --- .../smoke-all/2025/05/18/issue12766-1.qmd | 17 ++++++++++++ .../smoke-all/2025/05/18/issue12766-2.qmd | 18 +++++++++++++ .../docs/smoke-all/2025/05/18/issue12766.qmd | 26 ------------------- 3 files changed, 35 insertions(+), 26 deletions(-) create mode 100644 tests/docs/smoke-all/2025/05/18/issue12766-1.qmd create mode 100644 tests/docs/smoke-all/2025/05/18/issue12766-2.qmd delete mode 100644 tests/docs/smoke-all/2025/05/18/issue12766.qmd diff --git a/tests/docs/smoke-all/2025/05/18/issue12766-1.qmd b/tests/docs/smoke-all/2025/05/18/issue12766-1.qmd new file mode 100644 index 0000000000..be48d34a0e --- /dev/null +++ b/tests/docs/smoke-all/2025/05/18/issue12766-1.qmd @@ -0,0 +1,17 @@ +--- +format: + html: + html-math-method: mathjax +_quarto: + tests: + html: + ensureFileRegexMatches: + - ['\\tag\{1\}\\]'] + - [] +--- + +$$ +\alpha = \beta +$$ {#eq-ab} + +This is @eq-ab. diff --git a/tests/docs/smoke-all/2025/05/18/issue12766-2.qmd b/tests/docs/smoke-all/2025/05/18/issue12766-2.qmd new file mode 100644 index 0000000000..7aad774ab2 --- /dev/null +++ b/tests/docs/smoke-all/2025/05/18/issue12766-2.qmd @@ -0,0 +1,18 @@ +--- +format: + html: + html-math-method: + method: mathjax +_quarto: + tests: + html: + ensureFileRegexMatches: + - ['\\tag\{1\}\\]'] + - [] +--- + +$$ +\alpha = \beta +$$ {#eq-ab} + +This is @eq-ab. diff --git a/tests/docs/smoke-all/2025/05/18/issue12766.qmd b/tests/docs/smoke-all/2025/05/18/issue12766.qmd deleted file mode 100644 index 59970ffac8..0000000000 --- a/tests/docs/smoke-all/2025/05/18/issue12766.qmd +++ /dev/null @@ -1,26 +0,0 @@ ---- -format: - html-default: - output-file: default - html-math-method: mathjax - html-math: - output-file: math - html-math-method: - method: mathjax -_quarto: - tests: - html-default: - ensureFileRegexMatches: - - ['\\tag\{1\}\\]'] - - [] - html-math: - ensureFileRegexMatches: - - ['\\tag\{1\}\\]'] - - [] ---- - -$$ -\alpha = \beta -$$ {#eq-ab} - -This is @eq-ab. From be9abc3de86c9cef674807ef587db4ab2e97ffec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Canouil?= <8896044+mcanouil@users.noreply.github.com> Date: Sun, 18 May 2025 17:30:36 +0200 Subject: [PATCH 5/6] test: add katex variants for full coverage --- .../docs/smoke-all/2025/05/18/issue12766-3.qmd | 17 +++++++++++++++++ .../docs/smoke-all/2025/05/18/issue12766-4.qmd | 18 ++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 tests/docs/smoke-all/2025/05/18/issue12766-3.qmd create mode 100644 tests/docs/smoke-all/2025/05/18/issue12766-4.qmd diff --git a/tests/docs/smoke-all/2025/05/18/issue12766-3.qmd b/tests/docs/smoke-all/2025/05/18/issue12766-3.qmd new file mode 100644 index 0000000000..cf1369be5b --- /dev/null +++ b/tests/docs/smoke-all/2025/05/18/issue12766-3.qmd @@ -0,0 +1,17 @@ +--- +format: + html: + html-math-method: katex +_quarto: + tests: + html: + ensureFileRegexMatches: + - ['\\tag\{1\}\\]'] + - [] +--- + +$$ +\alpha = \beta +$$ {#eq-ab} + +This is @eq-ab. diff --git a/tests/docs/smoke-all/2025/05/18/issue12766-4.qmd b/tests/docs/smoke-all/2025/05/18/issue12766-4.qmd new file mode 100644 index 0000000000..9a35ac23bb --- /dev/null +++ b/tests/docs/smoke-all/2025/05/18/issue12766-4.qmd @@ -0,0 +1,18 @@ +--- +format: + html: + html-math-method: + method: katex +_quarto: + tests: + html: + ensureFileRegexMatches: + - ['\\tag\{1\}\\]'] + - [] +--- + +$$ +\alpha = \beta +$$ {#eq-ab} + +This is @eq-ab. From d4d50cbeabd4a0f8394af1a90e4718938e468186 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Canouil?= <8896044+mcanouil@users.noreply.github.com> Date: Sun, 18 May 2025 18:19:40 +0200 Subject: [PATCH 6/6] fix: use only tag in regex --- tests/docs/smoke-all/2025/05/18/issue12766-1.qmd | 2 +- tests/docs/smoke-all/2025/05/18/issue12766-2.qmd | 2 +- tests/docs/smoke-all/2025/05/18/issue12766-3.qmd | 2 +- tests/docs/smoke-all/2025/05/18/issue12766-4.qmd | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/docs/smoke-all/2025/05/18/issue12766-1.qmd b/tests/docs/smoke-all/2025/05/18/issue12766-1.qmd index be48d34a0e..383df0c701 100644 --- a/tests/docs/smoke-all/2025/05/18/issue12766-1.qmd +++ b/tests/docs/smoke-all/2025/05/18/issue12766-1.qmd @@ -6,7 +6,7 @@ _quarto: tests: html: ensureFileRegexMatches: - - ['\\tag\{1\}\\]'] + - ['\\tag\{1\}'] - [] --- diff --git a/tests/docs/smoke-all/2025/05/18/issue12766-2.qmd b/tests/docs/smoke-all/2025/05/18/issue12766-2.qmd index 7aad774ab2..e7db4afe2a 100644 --- a/tests/docs/smoke-all/2025/05/18/issue12766-2.qmd +++ b/tests/docs/smoke-all/2025/05/18/issue12766-2.qmd @@ -7,7 +7,7 @@ _quarto: tests: html: ensureFileRegexMatches: - - ['\\tag\{1\}\\]'] + - ['\\tag\{1\}'] - [] --- diff --git a/tests/docs/smoke-all/2025/05/18/issue12766-3.qmd b/tests/docs/smoke-all/2025/05/18/issue12766-3.qmd index cf1369be5b..56055291a6 100644 --- a/tests/docs/smoke-all/2025/05/18/issue12766-3.qmd +++ b/tests/docs/smoke-all/2025/05/18/issue12766-3.qmd @@ -6,7 +6,7 @@ _quarto: tests: html: ensureFileRegexMatches: - - ['\\tag\{1\}\\]'] + - ['\\tag\{1\}'] - [] --- diff --git a/tests/docs/smoke-all/2025/05/18/issue12766-4.qmd b/tests/docs/smoke-all/2025/05/18/issue12766-4.qmd index 9a35ac23bb..a151531365 100644 --- a/tests/docs/smoke-all/2025/05/18/issue12766-4.qmd +++ b/tests/docs/smoke-all/2025/05/18/issue12766-4.qmd @@ -7,7 +7,7 @@ _quarto: tests: html: ensureFileRegexMatches: - - ['\\tag\{1\}\\]'] + - ['\\tag\{1\}'] - [] ---