From 7a5652804bf57853655d8e5079201cb3743e1b66 Mon Sep 17 00:00:00 2001 From: Evan Gress <106449014+evangress@users.noreply.github.com> Date: Mon, 9 Nov 2026 21:51:13 -0500 Subject: [PATCH] MkDocs theme: search by title, or full text with Pagefind - search: titles (the default) puts a search box above the sidebar. Each page carries a hidden list of every page and ## section, and TagAction's search-results list (kovirlabs/tagaction#1) filters it as you type: no index to build and no theme script. Hidden without JavaScript. - search: pagefind loads Pagefind's search box from pagefind/ and marks each article for indexing; run `npx pagefind --site site` after `mkdocs build`. - search: false leaves it out. The README no longer lists callouts as missing: TagBrush.css 1.2 styles `!!! note` once the admonition extension is on, and the example shows one. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 1 + tests/themes.spec.mjs | 11 +++++++- themes/mkdocs/README.md | 13 +++++++-- themes/mkdocs/mkdocs_tagkit/main.html | 29 +++++++++++++++++++- themes/mkdocs/mkdocs_tagkit/mkdocs_theme.yml | 1 + 5 files changed, 50 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7cd826e..7a05326 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased +- MkDocs theme: search. `search: titles` (the default) finds pages and sections by title from a box above the sidebar, filtered by TagAction 0.3's search-results list; `search: pagefind` uses Pagefind for full text; `search: false` leaves it out. The README no longer lists callouts as missing: TagBrush.css 1.2 styles `!!! note` once the `admonition` extension is on. - Tested with TagBrush.css 1.2.0. - The blog post template's lead photo opens in TagAction's viewer: its link now ends in `.jpg`, since TagAction only treats links to image files as photos. A test checks every linked photo. Found by the family agent evaluation. - The gallery (the GitHub Pages site) wears the Tag family brand: the family bar, the shared theme from kovirlabs.github.io/tagstack/brand.css, and a footer linking the family and the Jekyll and WordPress themes. The linked-photo test skips links that have text beside an image, like the family bar's. diff --git a/tests/themes.spec.mjs b/tests/themes.spec.mjs index f33fa4f..2abd0d1 100644 --- a/tests/themes.spec.mjs +++ b/tests/themes.spec.mjs @@ -62,13 +62,22 @@ test.describe('MkDocs theme', () => { await page.route(/tagbrush@1/, (r) => r.fulfill({ path: 'node_modules/tagbrush/tagbrush.css', contentType: 'text/css' })); await page.route(/tagaction@0/, (r) => r.fulfill({ path: 'node_modules/tagaction/tagaction.js', contentType: 'text/javascript' })); await page.goto(pathToFileURL(resolve(`${SITE}/guide/install/index.html`)).href); - await expect(page.locator('body > aside nav a[aria-current="page"]')).toHaveText('Install'); + await expect(page.locator('body > aside nav[aria-label="Documentation"] a[aria-current="page"]')).toHaveText('Install'); await expect(page.locator('main > aside nav[aria-label="On this page"] a')).toHaveText(['Requirements', 'With pip', 'Check the install']); await expect(page.locator('a[rel="prev"]')).toHaveText('← Home'); await expect(page.locator('a[rel="next"]')).toHaveText('Configure →'); await expect(page.getByRole('button', { name: 'Copy' })).toHaveCount(2); await expect(page.locator('head meta[name="description"]')).toHaveAttribute('content', 'Deploy a folder of static files with one command.'); }); + + test('search: a box over a list of every page and section, both hidden until TagAction shows them', async () => { + const { readFileSync } = await import('node:fs'); + const html = readFileSync(`${SITE}/guide/install/index.html`, 'utf8'); + expect(html).toMatch(//); + expect(html).toMatch(/