From dad86a240661c1af29d11322d0ab98ffb356a5cc Mon Sep 17 00:00:00 2001
From: Kuba Sunderland-Ober
Date: Wed, 3 Jun 2026 12:59:21 +0200
Subject: [PATCH] Add PDF download link to footer alongside offline copy.
---
builder/template.mjs | 16 ++++++++++++----
docs/Documentation/Tools.md | 2 +-
docs/_config.yml | 2 +-
3 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/builder/template.mjs b/builder/template.mjs
index 009c1d14..a505b791 100644
--- a/builder/template.mjs
+++ b/builder/template.mjs
@@ -731,7 +731,7 @@ function renderFooterCustom(page, config) {
function renderEditAndOfflineBlock(page, config) {
const showEdit = config.gh_edit_link && config.gh_edit_link_text && config.gh_edit_repository
&& config.gh_edit_branch && config.gh_edit_view_mode;
- const showOffline = config.gh_offline_link && config.gh_offline_link_text && config.gh_offline_link_url;
+ const showOffline = config.gh_offline_link && config.gh_offline_link_url;
const showLastModified = config.last_edit_timestamp && config.last_edit_time_format
&& page.frontmatter.last_modified_date;
@@ -755,9 +755,17 @@ function renderEditAndOfflineBlock(page, config) {
`
\n`;
}
if (showOffline) {
- inner += ` \n` +
- ` ${escText(String(config.gh_offline_link_text))}\n` +
- `
\n`;
+ const pdfUrl = config.gh_pdf_link_url ? String(config.gh_pdf_link_url) : null;
+ const offlineHref = escAttr(String(config.gh_offline_link_url));
+ if (pdfUrl) {
+ inner += ` \n` +
+ ` Download Offline Copy or PDF.\n` +
+ `
\n`;
+ } else {
+ inner += ` \n` +
+ ` Offline Copy\n` +
+ `
\n`;
+ }
}
return ` \n` + inner + `
\n`;
diff --git a/docs/Documentation/Tools.md b/docs/Documentation/Tools.md
index 800e5a5d..587a6642 100644
--- a/docs/Documentation/Tools.md
+++ b/docs/Documentation/Tools.md
@@ -128,7 +128,7 @@ The build pipeline also reads a handful of declarative files. They are not execu
| File | Effect |
|---|---|
-| `docs/_config.yml` | Site config. `tbdocs` reads `url`, `baseurl`, `title`, `logo`, `also_build_offline`, `also_build_pdf`, `offline_exclude`, `exclude`, the footer / aux-link knobs, the GitHub edit-link knobs, and the offline-download-link knobs. Jekyll-only keys (`markdown`, `kramdown`, `theme`, `highlighter`, the `defaults` block, the `compress_html` block) are ignored. |
+| `docs/_config.yml` | Site config. `tbdocs` reads `url`, `baseurl`, `title`, `logo`, `also_build_offline`, `also_build_pdf`, `offline_exclude`, `exclude`, the footer / aux-link knobs, the GitHub edit-link knobs, and the download-link knobs (`gh_offline_link`, `gh_offline_link_url`, `gh_pdf_link_url`). Jekyll-only keys (`markdown`, `kramdown`, `theme`, `highlighter`, the `defaults` block, the `compress_html` block) are ignored. |
| `docs/_book.yml` | The PDF book's chapter manifest. Entries are resolved to pages via the selector schema (`page` / `pages` / `nav_page` / `nav_pages` / `no_descent`) and control PDF outline behaviour via `landing_page:`, `landing_is_target:`, `no_outline_entry:`, `no_heading_shift:`, and `outline_closed:`. Full schema is documented in the file header. Phase 2 resolves chapter arrays; Phase 8 assembles `book.html`. |
| `builder/themes/Light.theme`, `Dark.theme`, `Classic.theme` | twinBASIC IDE theme files, vendored from the BETA installer. `builder/highlight-theme.mjs` parses them into a Symbol-keyed palette that drives both the renderer's scope-to-class mapping and the generated `tb-highlight.css`. Refresh from the installer when the IDE adds new palette entries. |
| `builder/twinbasic.tmLanguage.json` | TextMate grammar for the twinBASIC language. Shiki uses it to tokenise every ` ```tb ` code block. |
diff --git a/docs/_config.yml b/docs/_config.yml
index efad062c..c9ecfcdf 100644
--- a/docs/_config.yml
+++ b/docs/_config.yml
@@ -41,8 +41,8 @@ gh_edit_view_mode: "tree"
# it to fetch the offline copy, offline readers use it to refresh
# theirs against the latest release.
gh_offline_link: true
-gh_offline_link_text: "Download offline copy"
gh_offline_link_url: "https://github.com/twinbasic/documentation/releases/latest/download/twinbasic-docs-offline.zip"
+gh_pdf_link_url: "https://github.com/twinbasic/documentation/releases/latest/download/twinBASIC.Book.pdf"
# When true, tbdocs's Phase 7 writes a `file://`-browsable mirror of
# `_site/` to `_site-offline/` with every URL rewritten to a page-