Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion news/changelog-1.8.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@ All changes included in 1.8:

## Formats

### `html`

- ([#12259](https://github.com/quarto-dev/quarto-cli/issues/12259)): Fix conflict between `html-math-method: katex` and crossref popups (author: @benkeks).

### `revealjs`

- ([#12598](https://github.com/quarto-dev/quarto-cli/pull/12598)): Ensure `.fragment` on an image with caption applies to whole figure.

### `docx`

- ([#8392](https://github.com/quarto-dev/quarto-cli/issues/8392)): Fix `docx` generation issues in tables
- ([#8392](https://github.com/quarto-dev/quarto-cli/issues/8392)): Fix `docx` generation issues in tables

## Projects

Expand Down
2 changes: 1 addition & 1 deletion src/resources/formats/html/pandoc/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
var macros = [];
for (var i = 0; i < mathElements.length; i++) {
var texText = mathElements[i].firstChild;
if (mathElements[i].tagName == "SPAN") {
if (mathElements[i].tagName == "SPAN" && texText && texText.data) {
window.katex.render(texText.data, mathElements[i], {
displayMode: mathElements[i].classList.contains('display'),
throwOnError: false,
Expand Down
21 changes: 21 additions & 0 deletions tests/docs/playwright/html/math/katex/crossref-popup.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
title: "Reproducible Quarto Document"
format: html
html-math-method: katex
---

:::{#thm-with-math}
### Theorem with math

Text with math $\mathcal P (\mathbb N) ≠ \varnothing$.
:::

:::{#thm-without-math}
### Theorem without math

Just text!
:::

Reference to @thm-with-math. (Popup does not render correctly)

Reference to @thm-without-math. (Popup does render.)
12 changes: 12 additions & 0 deletions tests/integration/playwright/tests/html-math-katex.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,15 @@ test.describe('KaTeX math rendering in Jupyter engine document', () => {
});
}
});


test('KaTeX does not prevent crossref pop to be rendered', async ({ page }) => {
await page.goto('html/math/katex/crossref-popup.html');
const Thm1Ref = page.getByRole('link', { name: 'Theorem 1' });
await expect(Thm1Ref).toBeVisible();
await Thm1Ref.hover();
// hover box should be visible
await expect(page.getByRole('tooltip', { name: 'Theorem 1 (Theorem with math' })).toBeVisible();
// Katex Math should be rendered in the hover box
await expect(page.getByRole('tooltip', { name: 'Theorem 1 (Theorem with math' })).toContainText('∅');
})
Loading