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
14 changes: 9 additions & 5 deletions news/changelog-1.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ All changes included in 1.7:

## Formats

## `html`
### `dashboard`

- ([#11338](https://github.com/quarto-dev/quarto-cli/issues/11338)): Remove unused datatables imports when appropriate.

### `html`

- ([#1325](https://github.com/quarto-dev/quarto-cli/issues/1325)): Dark Mode pages should not flash light on reload. (Nor should Light Mode pages flash dark.)
- ([#1470](https://github.com/quarto-dev/quarto-cli/issues/1470)): `respect-user-color-scheme` enables checking the media query `prefers-color-scheme` for user dark mode preference. Author preference still influences stylesheet order and NoJS experience. Defaults to `false`, leaving to author preference.
Expand All @@ -76,7 +80,7 @@ All changes included in 1.7:
- ([#12319](https://github.com/quarto-dev/quarto-cli/pull/12319)): Provide switchable light and dark brands for a page with `brand.light` and `brand.dark`.
- ([#12356](https://github.com/quarto-dev/quarto-cli/issues/12356)): Remove duplicate id in HTML document when using `#lst-` prefix label for using Quarto crossref.

## `pdf`
### `pdf`

- ([#11835](https://github.com/quarto-dev/quarto-cli/issues/11835)): Take markdown structure into account when detecting minimum heading level.
- ([#11878](https://github.com/quarto-dev/quarto-cli/issues/11878), [#12085](https://github.com/quarto-dev/quarto-cli/issues/12085)): Correctly fixup raw LaTeX table having an unexpected table env with options (e.g `\begin{table}[!ht]`) to be handled as crossref table.
Expand All @@ -92,16 +96,16 @@ All changes included in 1.7:
- New Quarto partials: `babel-lang.tex`, `biblio-config.tex`. Quarto's partials uses `.tex` extension.
- BREAKING CHANGE for templates authors: `common.latex` does now uses `pandoc.tex` partial from Quarto, which include now part of the content that was in main `template.tex`. If you modify `pandoc.tex` as part of a custom format, it should be updated to new content.

## `jats`
### `jats`

- Update to Pandoc's template following Pandoc 3.6.3 support:
- `article.jats_publishing` partials now support `author.roles`

## `revealjs`
### `revealjs`

- ([#12307](https://github.com/quarto-dev/quarto-cli/issues/12307)): Tabsets using `tabby.js` in Revealjs now correctly render reactive content when `server: shiny` is used.

## `typst` format
### `typst` format

- ([#11578](https://github.com/quarto-dev/quarto-cli/issues/11578)): Typst column layout widths use fractional `fr` units instead of percent `%` units for unitless and default widths in order to fill the enclosing block and not spill outside it.
- ([#11676](https://github.com/quarto-dev/quarto-cli/pull/11676)): Convert unitless image widths from pixels to inches for column layouts.
Expand Down
30 changes: 18 additions & 12 deletions src/format/dashboard/format-dashboard-tables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ export function processDatatables(
const scriptNodes = doc.querySelectorAll(
".cell-output script[type='module']",
);

let keepDeps = false;

for (const scriptNode of scriptNodes) {
const scriptEl = scriptNode as Element;
const code = scriptEl.innerText;
Expand All @@ -57,6 +60,7 @@ export function processDatatables(
}

if (hasConnectedDt) {
keepDeps = true;
// Replace the table initialization
const codeText = codeFiltered.join("\n");
// for iTables < 1.7, do fixups
Expand All @@ -82,21 +86,23 @@ export function processDatatables(
linkCssEl.remove();
}
}

// We found tables, clear the DT sentinel attr
const dtNodes = doc.querySelectorAll(`[${kDTTableSentinel}="true"]`);
dtNodes.forEach((node) => {
(node as Element).removeAttribute(kDTTableSentinel);
});
} else {
// We didn't find any DT, remove the dependencies that we injected at the root level
const dtNodes = doc.querySelectorAll(`[${kDTTableSentinel}="true"]`);
dtNodes.forEach((node) => {
(node as Element).remove();
});
}
}

if (keepDeps) {
// We found tables, clear the DT sentinel attr
const dtNodes = doc.querySelectorAll(`[${kDTTableSentinel}="true"]`);
dtNodes.forEach((node) => {
(node as Element).removeAttribute(kDTTableSentinel);
});
} else {
// We didn't find any DT, remove the dependencies that we injected at the root level
const dtNodes = doc.querySelectorAll(`[${kDTTableSentinel}="true"]`);
dtNodes.forEach((node) => {
(node as Element).remove();
});
}

return {
resources,
supporting,
Expand Down
9 changes: 5 additions & 4 deletions src/format/dashboard/format-dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import { ProjectContext } from "../../project/types.ts";
import { registerWriterFormatHandler } from "../format-handlers.ts";
import { kPageLayout, kPageLayoutCustom } from "../html/format-html-shared.ts";
import { htmlFormat } from "../html/format-html.ts";
import { kDTTableSentinel } from "./format-dashboard-shared.ts";

import { join } from "../../deno_ral/path.ts";
import {
Expand Down Expand Up @@ -199,7 +200,7 @@ export function dashboardFormat() {
join("js", "dt", "datatables.min.js"),
),
attribs: {
kDTTableSentinel: "true",
[kDTTableSentinel]: "true",
},
});
stylesheets.push({
Expand All @@ -209,7 +210,7 @@ export function dashboardFormat() {
join("js", "dt", "datatables.min.css"),
),
attribs: {
kDTTableSentinel: "true",
[kDTTableSentinel]: "true",
},
});
scripts.push({
Expand All @@ -219,7 +220,7 @@ export function dashboardFormat() {
join("js", "dt", "pdfmake.min.js"),
),
attribs: {
kDTTableSentinel: "true",
[kDTTableSentinel]: "true",
},
});
scripts.push({
Expand All @@ -229,7 +230,7 @@ export function dashboardFormat() {
join("js", "dt", "vfs_fonts.js"),
),
attribs: {
kDTTableSentinel: "true",
[kDTTableSentinel]: "true",
},
});

Expand Down
9 changes: 9 additions & 0 deletions tests/docs/smoke-all/2025/04/11/issue-11338.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
format: dashboard
_quarto:
tests:
dashboard:
ensureFileRegexMatches:
- []
- ["kdttablesentinel"]
---
Loading