From a03931e8e19c1fff7c0077eaedcd97634cb3f59a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Canouil?= <8896044+mcanouil@users.noreply.github.com> Date: Tue, 9 Dec 2025 10:29:48 +0100 Subject: [PATCH 1/4] fix: add missing support for configurable link target and rel attributes in the book project configuration Fixes #13769 --- src/project/types/book/book-config.ts | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/project/types/book/book-config.ts b/src/project/types/book/book-config.ts index 7dfed26800f..23541182060 100644 --- a/src/project/types/book/book-config.ts +++ b/src/project/types/book/book-config.ts @@ -82,6 +82,7 @@ import { import { repoUrlIcon, websiteConfigActions, + websiteConfigString, websiteProjectConfig, } from "../website/website-config.ts"; @@ -229,11 +230,25 @@ export async function bookProjectConfig( if (site[kSiteRepoUrl]) { const repoUrl = siteRepoUrl(site); const icon = repoUrlIcon(repoUrl); - tools.push({ + const tool = { text: language[kCodeToolsSourceCode] || "Source Code", icon, href: repoUrl, - }); + } as Record; + + // Apply repo-link-target if configured + const linkTarget = websiteConfigString(kSiteRepoLinkTarget, config); + if (linkTarget) { + tool.target = linkTarget; + } + + // Apply repo-link-rel if configured + const linkRel = websiteConfigString(kSiteRepoLinkRel, config); + if (linkRel) { + tool.rel = linkRel; + } + + tools.push(tool); } tools.push(...(downloadTools(projectDir, config, language) || [])); tools.push(...(sharingTools(config, language) || [])); From 9311ca873881e38c4cecddaf4fefb014fdc235f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Canouil?= <8896044+mcanouil@users.noreply.github.com> Date: Tue, 9 Dec 2025 10:32:56 +0100 Subject: [PATCH 2/4] chore: add changelog entry --- news/changelog-1.9.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/news/changelog-1.9.md b/news/changelog-1.9.md index 0ed821dd48a..76f4c95632c 100644 --- a/news/changelog-1.9.md +++ b/news/changelog-1.9.md @@ -58,6 +58,10 @@ All changes included in 1.9: - ([#13570](https://github.com/quarto-dev/quarto-cli/pull/13570)): Replace Twitter with Bluesky in default blog template and documentation examples. New blog projects now include Bluesky social links instead of Twitter. - ([#13716](https://github.com/quarto-dev/quarto-cli/issues/13716)): Fix draft pages showing blank during preview when pre-render scripts are configured. +### `book` + +- ([#13769](https://github.com/quarto-dev/quarto-cli/issues/13769)): Apply `repo-link-target` and `repo-link-rel` options to tools in book sidebar for consistent link attribute handling with website projects. (author: @mcanouil) + ### `manuscript` - ([#10031](https://github.com/quarto-dev/quarto-cli/issues/10031)): Fix manuscript rendering prompting for GitHub credentials when origin points to private repository. Auto-detection of manuscript URL now fails gracefully with a warning instead of blocking renders. From 98033436031dee1e3ac639bc212d5c04353c3300 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Canouil?= <8896044+mcanouil@users.noreply.github.com> Date: Wed, 10 Dec 2025 22:22:40 +0100 Subject: [PATCH 3/4] test: add book test for repo-link-rel and repo-link-target --- .../smoke-all/2025/12/10/13769/_quarto.yml | 20 +++++++++++++++++++ .../docs/smoke-all/2025/12/10/13769/index.qmd | 15 ++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 tests/docs/smoke-all/2025/12/10/13769/_quarto.yml create mode 100644 tests/docs/smoke-all/2025/12/10/13769/index.qmd diff --git a/tests/docs/smoke-all/2025/12/10/13769/_quarto.yml b/tests/docs/smoke-all/2025/12/10/13769/_quarto.yml new file mode 100644 index 00000000000..c652ad21512 --- /dev/null +++ b/tests/docs/smoke-all/2025/12/10/13769/_quarto.yml @@ -0,0 +1,20 @@ +project: + type: book + +book: + title: "issue13769" + author: "Norah Jones" + date: "12/10/2025" + repo-url: "https://github.com/quarto-dev/quarto-cli" + repo-link-target: "_blank" + repo-link-rel: "noreferrer" + repo-actions: none + chapters: + - index.qmd + + +format: + html: + theme: + - cosmo + - brand diff --git a/tests/docs/smoke-all/2025/12/10/13769/index.qmd b/tests/docs/smoke-all/2025/12/10/13769/index.qmd new file mode 100644 index 00000000000..bc700f11988 --- /dev/null +++ b/tests/docs/smoke-all/2025/12/10/13769/index.qmd @@ -0,0 +1,15 @@ +--- +format: html +_quarto: + tests: + html: + ensureHtmlElements: + - ['rel="noreferrer"'] + - ['target="_blank"'] +--- + +# Preface + +This is a Quarto book. + +To learn more about Quarto books visit . From 4c209456728dbcbd24275447e38909985ab3e753 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Canouil?= <8896044+mcanouil@users.noreply.github.com> Date: Wed, 10 Dec 2025 22:41:51 +0100 Subject: [PATCH 4/4] test: use more specific selector for repo link --- tests/docs/smoke-all/2025/12/10/13769/index.qmd | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/docs/smoke-all/2025/12/10/13769/index.qmd b/tests/docs/smoke-all/2025/12/10/13769/index.qmd index bc700f11988..2d769b4b9df 100644 --- a/tests/docs/smoke-all/2025/12/10/13769/index.qmd +++ b/tests/docs/smoke-all/2025/12/10/13769/index.qmd @@ -1,11 +1,9 @@ --- -format: html _quarto: tests: html: ensureHtmlElements: - - ['rel="noreferrer"'] - - ['target="_blank"'] + - ['a[rel="noreferrer"][target="_blank"][href="https://github.com/quarto-dev/quarto-cli"][class~="quarto-navigation-tool"]'] --- # Preface