From 82013bd50af28a83c20adf5d975ac1899479d891 Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Tue, 18 Nov 2025 19:06:59 +0100 Subject: [PATCH] Fix notebook-view.url being ignored When notebook-view.url is specified, notebook links should point to the external URL instead of rendering a local preview. This was broken in v1.4.156 (commit faba7357a) when the notebook system was refactored and external URL handling was accidentally removed. The fix restores the check for descriptor?.url before falling back to the local preview path in format-html-notebook-preview.ts. Updated existing test to verify links contain the external URL. (cherry picked from commit a39cc6188aacba794b4de98eb521f5aead3ce1bd) Move changelog entry as backport in v1.8 # Conflicts: # news/changelog-1.9.md --- news/changelog-1.8.md | 2 ++ src/format/html/format-html-notebook-preview.ts | 2 +- tests/docs/smoke-all/2023/01/05/notebook-preview-complex.qmd | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/news/changelog-1.8.md b/news/changelog-1.8.md index 569cf4f96d3..8520e1526f1 100644 --- a/news/changelog-1.8.md +++ b/news/changelog-1.8.md @@ -2,6 +2,8 @@ ## In this release +- ([#13694](https://github.com/quarto-dev/quarto-cli/issues/13694)): Fix `notebook-view.url` being ignored - external notebook links now properly use specified URLs instead of local preview files. + ## In previous releases - ([#13369](https://github.com/quarto-dev/quarto-cli/issues/13369)): Fix failure in theme compilation when `brand.color.primary` is specified for light or dark but not both. diff --git a/src/format/html/format-html-notebook-preview.ts b/src/format/html/format-html-notebook-preview.ts index 9c0b6872623..02518739c88 100644 --- a/src/format/html/format-html-notebook-preview.ts +++ b/src/format/html/format-html-notebook-preview.ts @@ -252,7 +252,7 @@ export const notebookPreviewer = ( // to form links to this notebook const nbPreview = { title: resolvedTitle, - href: relative(inputDir, renderedNotebook[kHtmlPreview].hrefPath), + href: descriptor?.url || relative(inputDir, renderedNotebook[kHtmlPreview].hrefPath), supporting, resources, order: work.order, diff --git a/tests/docs/smoke-all/2023/01/05/notebook-preview-complex.qmd b/tests/docs/smoke-all/2023/01/05/notebook-preview-complex.qmd index b7eaae6856d..81ffa054624 100644 --- a/tests/docs/smoke-all/2023/01/05/notebook-preview-complex.qmd +++ b/tests/docs/smoke-all/2023/01/05/notebook-preview-complex.qmd @@ -29,7 +29,7 @@ _quarto: tests: html: ensureHtmlElements: - - ['a.quarto-notebook-link'] + - ['a.quarto-notebook-link[href*="kaggle.com"]'] - ['div.quarto-alternate-notebooks a'] ensureFileRegexMatches: - ['Source: TEST NB']