@docmd/plugin-search
Advanced tools
+20
-4
@@ -23,5 +23,5 @@ /** | ||
| if (!isEnabled) return; | ||
| if(log) log('š Generating search index...'); | ||
| if (log) log('š Generating search index...'); | ||
| const searchData = []; | ||
@@ -33,3 +33,4 @@ pages.forEach(page => { | ||
| if (pageId.endsWith('.html')) pageId = pageId.slice(0, -5); | ||
| // 1. Add the main page record | ||
| searchData.push({ | ||
@@ -39,4 +40,19 @@ id: pageId, | ||
| text: page.searchData.content, | ||
| headings: (page.searchData.headings || []).join(' ') | ||
| // We can keep page-level headings as a string block for general page matching | ||
| headings: (page.searchData.headings || []).map(h => h.text).join(' ') | ||
| }); | ||
| // 2. Add individual heading records for deep linking | ||
| if (page.searchData.headings && Array.isArray(page.searchData.headings)) { | ||
| page.searchData.headings.forEach(heading => { | ||
| if (heading.id && heading.text) { | ||
| searchData.push({ | ||
| id: `${pageId}#${heading.id}`, | ||
| title: `${page.searchData.title} > ${heading.text}`, | ||
| text: '', // The content under the heading could go here if we extracted it, but for now empty or short | ||
| headings: heading.text | ||
| }); | ||
| } | ||
| }); | ||
| } | ||
| } | ||
@@ -43,0 +59,0 @@ }); |
+2
-2
| { | ||
| "name": "@docmd/plugin-search", | ||
| "version": "0.5.0", | ||
| "description": "Offline full-text search for docmd", | ||
| "version": "0.5.1", | ||
| "description": "Offline full-text search for docmd.", | ||
| "main": "index.js", | ||
@@ -6,0 +6,0 @@ "dependencies": { |
+2
-1
@@ -9,3 +9,3 @@ # @docmd/plugin-search | ||
| ## The docmd Ecosystem | ||
| ## The `docmd` Ecosystem | ||
@@ -25,2 +25,3 @@ `docmd` is a modular system. Here are the official packages: | ||
| * [**@docmd/plugin-search**](https://www.npmjs.com/package/@docmd/plugin-search) - Offline full-text search. | ||
| * [**@docmd/plugin-pwa**](https://www.npmjs.com/package/@docmd/plugin-pwa) - Progressive Web App support. | ||
| * [**@docmd/plugin-mermaid**](https://www.npmjs.com/package/@docmd/plugin-mermaid) - Diagrams and flowcharts. | ||
@@ -27,0 +28,0 @@ * [**@docmd/plugin-seo**](https://www.npmjs.com/package/@docmd/plugin-seo) - Meta tags and Open Graph data. |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
15671
5.59%242
6.61%33
3.13%