From e6d3180d61de7a80413c241ce44f0943e5d2a156 Mon Sep 17 00:00:00 2001 From: JooYoung Seo <19754711+jooyoungseo@users.noreply.github.com> Date: Sun, 11 Oct 2026 13:53:51 +0000 Subject: [PATCH] Keep dashboard HTML output mistaken for bslib output in its card The dashboard filter lifts a cell's raw HTML output out of its card when it takes the output for bslib components, and it tested for them with the Lua pattern `bslib-`. In a Lua pattern `-` is a quantifier, so the pattern matched any text containing `bsli`, such as the word "subslide" or the name `bslib` without a hyphen. That output left its card, and a card with nothing else in it was dropped, title included. The hyphen is now escaped, so the pattern matches only the literal `bslib-`, the prefix bslib uses in its classes, ids, attributes and custom elements. Closes #15023 --- news/changelog-1.11.md | 1 + .../filters/quarto-post/dashboard.lua | 2 +- .../docs/smoke-all/2026/10/11/issue-15023.qmd | 44 +++++++++++++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 tests/docs/smoke-all/2026/10/11/issue-15023.qmd diff --git a/news/changelog-1.11.md b/news/changelog-1.11.md index 4944dc36ba8..754f3da5a13 100644 --- a/news/changelog-1.11.md +++ b/news/changelog-1.11.md @@ -35,6 +35,7 @@ All changes included in 1.11: - ([#14818](https://github.com/quarto-dev/quarto-cli/issues/14818)): Fix a dashboard with more than one page going blank when the URL hash does not name a page, such as a footnote link or a cross-reference link. - ([#14819](https://github.com/quarto-dev/quarto-cli/issues/14819)): Fix keyboard focus starting inside the page content when a dashboard opens at a page hash, such as `dashboard.html#sales`. Tabbing backward now correctly returns to the page navigation tabs. +- ([#15023](https://github.com/quarto-dev/quarto-cli/issues/15023)): Fix a dashboard cell's HTML output being moved out of its card when the output contains text such as `bslib` or the word "subslide", and the card being dropped, title included, when the cell shows nothing else. (author: @jooyoungseo) ### `html` diff --git a/src/resources/filters/quarto-post/dashboard.lua b/src/resources/filters/quarto-post/dashboard.lua index e5356220eb4..213baedda9d 100644 --- a/src/resources/filters/quarto-post/dashboard.lua +++ b/src/resources/filters/quarto-post/dashboard.lua @@ -270,7 +270,7 @@ function render_dashboard() end if #childDiv.content == 1 and childDiv.content[1].t == "RawBlock" and childDiv.content[1].format == "html" then - if childDiv.content[1].text:match('bslib-') ~= nil then + if childDiv.content[1].text:match('bslib%-') ~= nil then -- capture any raw blocks that we see bslibRawOutputs:insert(childDiv.content[1]) diff --git a/tests/docs/smoke-all/2026/10/11/issue-15023.qmd b/tests/docs/smoke-all/2026/10/11/issue-15023.qmd new file mode 100644 index 00000000000..37cf1bcab30 --- /dev/null +++ b/tests/docs/smoke-all/2026/10/11/issue-15023.qmd @@ -0,0 +1,44 @@ +--- +title: "HTML output mistaken for bslib output (issue #15023)" +format: dashboard +_quarto: + tests: + dashboard: + ensureHtmlElements: + - + - ".card.cell .test-subslide" + - ".card.cell .test-name" + - ".test-lifted" + - + - ".card.cell .test-lifted" +--- + +Regression test for #15023. The dashboard filter lifts a cell's raw HTML +output out of its card when it takes the output for bslib components, +which it detected with the Lua pattern `'bslib-'`. In a Lua pattern `-` is +a quantifier, so that pattern matched any text containing `bsli`: the word +"subslide", or the name `bslib` without a hyphen. Such output left its +card, and a card with nothing else in it was dropped, title and all. + +The first two cells hold text like that and must keep their output in +their card. The third holds a `bslib-` class, as real bslib components do, +and must still be lifted out of the card. The selectors name `.card.cell`, +the card built from a cell: when every output is lifted, the dashboard +wraps what is left of the page, these outputs included, in a card of its +own, which carries no `.cell` class. + +```{python} +#| title: A word +from IPython.display import HTML +HTML('
') +``` + +```{python} +#| title: A name without a hyphen +HTML('Cards are built by bslib
') +``` + +```{python} +#| title: A bslib component +HTML('