diff --git a/astro.config.mjs b/astro.config.mjs
index a5f2c67a89..3baf67563c 100644
--- a/astro.config.mjs
+++ b/astro.config.mjs
@@ -3,11 +3,13 @@ import { satteri } from '@astrojs/markdown-satteri';
import mdx from '@astrojs/mdx';
import { attributeMarkdown, wrapTables } from '/src/themes/octopus/utilities/custom-markdown.mjs';
import llmMdEmitter from './src/integrations/llm-md-emitter.ts';
+import pagefindIndex from './src/integrations/pagefind-index.ts';
import pruneDist from './src/integrations/prune-dist.ts';
import satteriHeadingId from './src/plugins/satteri-heading-id.js';
import satteriApiExamples, { apiExampleDirective } from './src/plugins/satteri-api-examples.js';
import { endpointDirective } from './src/plugins/satteri-endpoint.js';
import satteriWbr from './src/plugins/satteri-wbr.js';
+import pagefindImageAttrs from './src/plugins/pagefind-image-attrs.js';
import shikiCodeBlock from './src/plugins/shiki-code-block.js';
// https://astro.build/config
@@ -22,6 +24,9 @@ export default defineConfig({
integrations: [
mdx(),
llmMdEmitter(),
+ // After the page emitters, and before the prune that would delete its
+ // output
+ pagefindIndex(),
// Must run last: strips build output that can't be served under /docs/
pruneDist()
],
@@ -63,6 +68,7 @@ export default defineConfig({
],
hastPlugins: [
satteriWbr,
+ pagefindImageAttrs,
satteriApiExamples
],
}),
diff --git a/dictionary-octopus.txt b/dictionary-octopus.txt
index a94359012f..8d53e3bf57 100644
--- a/dictionary-octopus.txt
+++ b/dictionary-octopus.txt
@@ -405,6 +405,7 @@ Ozar
PAAS
packageid
packageversion
+pagefind
passout
PathtoPublish
pemstore
diff --git a/package.json b/package.json
index 8ea81c1723..974ab3217b 100644
--- a/package.json
+++ b/package.json
@@ -33,9 +33,8 @@
"astro-accelerator-utils": "^0.3.84",
"glob": "^13.0.6",
"gray-matter": "^4.0.3",
- "html-to-text": "^10.0.0",
- "keyword-extractor": "^0.0.28",
"optional": "^0.1.4",
+ "pagefind": "^1.5.2",
"satteri": "^0.9.5",
"sharp": "^0.34.5"
},
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 715655b317..6ecb480a8a 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -39,15 +39,12 @@ importers:
gray-matter:
specifier: ^4.0.3
version: 4.0.3
- html-to-text:
- specifier: ^10.0.0
- version: 10.0.0
- keyword-extractor:
- specifier: ^0.0.28
- version: 0.0.28
optional:
specifier: ^0.1.4
version: 0.1.4
+ pagefind:
+ specifier: ^1.5.2
+ version: 1.5.2
satteri:
specifier: ^0.9.5
version: 0.9.5
@@ -821,6 +818,41 @@ packages:
'@oxc-project/types@0.144.0':
resolution: {integrity: sha512-nuhZIOLuI6TFQ32I/WnUx+SCPY7SdSKwgnFHydAuoS1+Z4BRcaP+RRJmGzl9lw+0OFF7UmaESf7KQRXaNLHypg==}
+ '@pagefind/darwin-arm64@1.5.2':
+ resolution: {integrity: sha512-MXpI+7HsAdPkvJ0gk9xj9g541BCqBZOBbdwj9g6lB5LCj6kSV6nqDSjzcAJwvOsfu0fjwvC8hQU+ecfhp+MpiQ==}
+ cpu: [arm64]
+ os: [darwin]
+
+ '@pagefind/darwin-x64@1.5.2':
+ resolution: {integrity: sha512-IojxFWMEJe0RQ7PQ3KXQsPIImNsbpPYpoZ+QUDrL8fAl/O27IX+LVLs74/UzEZy5uA2LD8Nz1AiwKr72vrkZQw==}
+ cpu: [x64]
+ os: [darwin]
+
+ '@pagefind/freebsd-x64@1.5.2':
+ resolution: {integrity: sha512-7EVzo9+0w+2cbe671BtMj10UlNo83I+HrLVLfRxO731svHRJKUfJ/mo05gU14pe9PCfpKNQT8FS3Xc/oDN6pOA==}
+ cpu: [x64]
+ os: [freebsd]
+
+ '@pagefind/linux-arm64@1.5.2':
+ resolution: {integrity: sha512-Ovt9+K35sqzn8H3ZMXGwls4TD/wMJuvRtShHIsmUQREmaxjrDEX7gHckRCrwYJ4XE1H1p6HkLz3wukrAnsfXQw==}
+ cpu: [arm64]
+ os: [linux]
+
+ '@pagefind/linux-x64@1.5.2':
+ resolution: {integrity: sha512-V+tFqHKXhQKq/WqPBD67AFy7scn1/aZID00ws4fSDd+1daSi5UHR9VVlRrOUYKxn3VuFQYRD7lYXdZK1WED1YA==}
+ cpu: [x64]
+ os: [linux]
+
+ '@pagefind/windows-arm64@1.5.2':
+ resolution: {integrity: sha512-hN9Nh90fNW61nNRCW9ZyQrAj/mD0eRvmJ8NlTUzkbuW8kIzGJUi3cxjFkEcMZ5h/8FsKWD/VcouZl4yo1F7B6g==}
+ cpu: [arm64]
+ os: [win32]
+
+ '@pagefind/windows-x64@1.5.2':
+ resolution: {integrity: sha512-Fa2Iyw7kaDRzGMfNYNUXNW2zbL5FQVDgSOcbDHdzBrDEdpqOqg8TcZ68F22ol6NJ9IGzvUdmeyZypLW5dyhqsg==}
+ cpu: [x64]
+ os: [win32]
+
'@pkgjs/parseargs@0.11.0':
resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==}
engines: {node: '>=14'}
@@ -1008,11 +1040,6 @@ packages:
'@rolldown/pluginutils@1.0.1':
resolution: {integrity: sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==}
- '@selderee/plugin-htmlparser2@0.12.0':
- resolution: {integrity: sha512-oELmoyA6ML9jDRMV3kgcMQFKxUfBU0yFVn6yTctVaLT5ygXnxH52I3TZEgV9EhXJC68/uFvE5Daj1/25c0Xa/A==}
- peerDependencies:
- selderee: ~0.12.0
-
'@shikijs/core@4.4.3':
resolution: {integrity: sha512-QCR4q2ZO/ILJEuwiBMel4wdcTDb1JGwfjKTxPDF6x8ixOaluPrVqIn06C99AcRPhmYlBR56d/Fb+GN58GzExpg==}
engines: {node: '>=20'}
@@ -1398,10 +1425,6 @@ packages:
decode-named-character-reference@1.3.0:
resolution: {integrity: sha512-GtpQYB283KrPp6nRw50q3U9/VfOutZOe103qlN7BPP6Ad27xYnOIWv4lPzo8HCAL+mMZofJ9KEy30fq6MfaK6Q==}
- deepmerge-ts@7.1.5:
- resolution: {integrity: sha512-HOJkrhaYsweh+W+e74Yn7YStZOilkoPb6fycpwNLKzSPtruFs48nYis0zy5yJz1+ktUhHxoRDJ27RQAWLIJVJw==}
- engines: {node: '>=16.0.0'}
-
define-data-property@1.1.4:
resolution: {integrity: sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==}
engines: {node: '>= 0.4'}
@@ -1778,10 +1801,6 @@ packages:
html-escaper@3.0.3:
resolution: {integrity: sha512-RuMffC89BOWQoY0WKGpIhn5gX3iI54O6nRA0yC124NYVtzjmFWBIiFd8M0x+ZdX0P9R4lADg1mgP8C7PxGOWuQ==}
- html-to-text@10.0.0:
- resolution: {integrity: sha512-2OH59Gtprdczel+7Rxgpz9hGVJREaf8Lt1H4kZwWHpEn70VQKRuMNGsb2eDbwaTzrYzb0hheiOG1P7Dim0B4dQ==}
- engines: {node: '>=20.19.0'}
-
html-void-elements@3.0.0:
resolution: {integrity: sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg==}
@@ -1979,17 +1998,10 @@ packages:
jsonc-parser@3.3.1:
resolution: {integrity: sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ==}
- keyword-extractor@0.0.28:
- resolution: {integrity: sha512-oi7dSPpYtW/3fE0vZiqQgZ8mW3F1V9K4+rBJ0FcVrdXBEQuhZ0zKj7sX74eqGASuepLHf9aYdeonyKHWhYpHQA==}
- engines: {node: '>= 0.10.0'}
-
kind-of@6.0.3:
resolution: {integrity: sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==}
engines: {node: '>=0.10.0'}
- leac@0.7.0:
- resolution: {integrity: sha512-qMrZeyEekgdRQ9o6a4NAB2EQZrv827GJdn1vnapwSJ90hWRB4TzUSunvacPkxQ2TnNqHNI1/zSt0hlo0crG8Jw==}
-
lightningcss-android-arm64@1.33.0:
resolution: {integrity: sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==}
engines: {node: '>= 12.0.0'}
@@ -2392,6 +2404,10 @@ packages:
package-manager-detector@1.8.0:
resolution: {integrity: sha512-yQA4H19AmPEoMUeavPMDIe1higySl/gH/yaQrkT/s07Qp+7pp2hYz30N3z2l5BkjVkF9Ow6o0wjJamm2y7Sn0A==}
+ pagefind@1.5.2:
+ resolution: {integrity: sha512-XTUaK0hXMCu2jszWE584JGQT7y284TmMV9l/HX3rnG5uo3rHI/uHU56XTyyyPFjeWEBxECbAi0CaFDJOONtG0Q==}
+ hasBin: true
+
parse-entities@4.0.2:
resolution: {integrity: sha512-GG2AQYWoLgL877gQIKeRPGO1xF9+eG1ujIb5soS5gPvLQ1y2o8FL90w2QWNdf9I361Mpp7726c+lj3U0qK1uGw==}
@@ -2405,9 +2421,6 @@ packages:
parse5@7.3.0:
resolution: {integrity: sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==}
- parseley@0.13.1:
- resolution: {integrity: sha512-uNBJZzmb60l6p6VWLTmevizNAGnE0xoSf1n0B4q3ntegDNzcS68NRCcBDZTcyXHxt2XhBChsCuqj4M+nChvE/A==}
-
path-key@2.0.1:
resolution: {integrity: sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==}
engines: {node: '>=4'}
@@ -2431,9 +2444,6 @@ packages:
resolution: {integrity: sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==}
engines: {node: '>=4'}
- peberminta@0.10.0:
- resolution: {integrity: sha512-80B2AsU+I4Qdb0ZAPSfe9UwvGzwkM37IKIFEvdS3D/3Ndgv2bsuJ0bfG1+iEYO+l7Gfd4EUJmuRyq7efLgRMzQ==}
-
piccolore@0.1.3:
resolution: {integrity: sha512-o8bTeDWjE086iwKrROaDf31K0qC/BENdm15/uH9usSC/uZjJOKb2YGiVHfLY4GhwsERiPI1jmwI2XrA7ACOxVw==}
@@ -2634,9 +2644,6 @@ packages:
resolution: {integrity: sha512-vfD3pmTzGpufjScBh50YHKzEu2lxBWhVEHsNGoEXmCmn2hKGfeNLYMzCJpe8cD7gqX7TJluOVpBkAequ6dgMmA==}
engines: {node: '>=4'}
- selderee@0.12.0:
- resolution: {integrity: sha512-b1YMh3+DHZp59DLna3qVwQ5iOla/nrI6mLBNW02XxU77M3046Df6VLkoaJyFz20VsGIG5kkp+FK0kg4K4HnUFw==}
-
semver@5.7.2:
resolution: {integrity: sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==}
hasBin: true
@@ -3796,6 +3803,27 @@ snapshots:
'@oxc-project/types@0.144.0': {}
+ '@pagefind/darwin-arm64@1.5.2':
+ optional: true
+
+ '@pagefind/darwin-x64@1.5.2':
+ optional: true
+
+ '@pagefind/freebsd-x64@1.5.2':
+ optional: true
+
+ '@pagefind/linux-arm64@1.5.2':
+ optional: true
+
+ '@pagefind/linux-x64@1.5.2':
+ optional: true
+
+ '@pagefind/windows-arm64@1.5.2':
+ optional: true
+
+ '@pagefind/windows-x64@1.5.2':
+ optional: true
+
'@pkgjs/parseargs@0.11.0':
optional: true
@@ -3916,12 +3944,6 @@ snapshots:
'@rolldown/pluginutils@1.0.1': {}
- '@selderee/plugin-htmlparser2@0.12.0(selderee@0.12.0)':
- dependencies:
- domelementtype: 2.3.0
- domhandler: 5.0.3
- selderee: 0.12.0
-
'@shikijs/core@4.4.3':
dependencies:
'@shikijs/primitive': 4.4.3
@@ -4437,8 +4459,6 @@ snapshots:
dependencies:
character-entities: 2.0.2
- deepmerge-ts@7.1.5: {}
-
define-data-property@1.1.4:
dependencies:
es-define-property: 1.0.1
@@ -4998,14 +5018,6 @@ snapshots:
html-escaper@3.0.3: {}
- html-to-text@10.0.0:
- dependencies:
- '@selderee/plugin-htmlparser2': 0.12.0(selderee@0.12.0)
- deepmerge-ts: 7.1.5
- dom-serializer: 2.0.0
- htmlparser2: 10.1.0
- selderee: 0.12.0
-
html-void-elements@3.0.0: {}
htmlparser2@10.1.0:
@@ -5193,12 +5205,8 @@ snapshots:
jsonc-parser@3.3.1: {}
- keyword-extractor@0.0.28: {}
-
kind-of@6.0.3: {}
- leac@0.7.0: {}
-
lightningcss-android-arm64@1.33.0:
optional: true
@@ -5851,6 +5859,16 @@ snapshots:
package-manager-detector@1.8.0: {}
+ pagefind@1.5.2:
+ optionalDependencies:
+ '@pagefind/darwin-arm64': 1.5.2
+ '@pagefind/darwin-x64': 1.5.2
+ '@pagefind/freebsd-x64': 1.5.2
+ '@pagefind/linux-arm64': 1.5.2
+ '@pagefind/linux-x64': 1.5.2
+ '@pagefind/windows-arm64': 1.5.2
+ '@pagefind/windows-x64': 1.5.2
+
parse-entities@4.0.2:
dependencies:
'@types/unist': 2.0.11
@@ -5879,11 +5897,6 @@ snapshots:
dependencies:
entities: 6.0.1
- parseley@0.13.1:
- dependencies:
- leac: 0.7.0
- peberminta: 0.10.0
-
path-key@2.0.1: {}
path-key@3.1.1: {}
@@ -5904,8 +5917,6 @@ snapshots:
dependencies:
pify: 3.0.0
- peberminta@0.10.0: {}
-
piccolore@0.1.3: {}
picocolors@1.1.1: {}
@@ -6198,10 +6209,6 @@ snapshots:
extend-shallow: 2.0.1
kind-of: 6.0.3
- selderee@0.12.0:
- dependencies:
- parseley: 0.13.1
-
semver@5.7.2: {}
semver@7.8.0: {}
diff --git a/src/components/ArticleHeader.astro b/src/components/ArticleHeader.astro
index 85f387e823..e5e7740821 100644
--- a/src/components/ArticleHeader.astro
+++ b/src/components/ArticleHeader.astro
@@ -12,8 +12,11 @@ type Props = {
lang: string;
subtitle?: string | null;
title: string;
+ /** Passed to `data-pagefind-weight`. Omitted leaves Pagefind's own heading
+ * weighting alone. */
+ searchWeight?: number;
};
-const { lang, subtitle, title } = Astro.props satisfies Props;
+const { lang, subtitle, title, searchWeight } = Astro.props satisfies Props;
// Language
const _ = Lang(lang);
@@ -22,7 +25,7 @@ const _ = Lang(lang);
stats.stop();
---
- {subtitle}{title}
{subtitle &&
+
+ @@ -145,6 +156,20 @@ const listboxId = `${name}-search-listbox`; + { + /* A heading inside the result above that matched on its own. Its own + `role="option"`, because it links somewhere different: the reader can + arrow onto it and land on that section. */ + } + +