@mgks/docmd 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -32,8 +32,8 @@ jobs:
|
|
|
32
32
|
|
|
33
33
|
- name: Publish to NPM Registry
|
|
34
34
|
run: npm publish --access=public
|
|
35
|
-
env:
|
|
36
|
-
|
|
35
|
+
# env:
|
|
36
|
+
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
37
37
|
|
|
38
38
|
# ----------------------------------------
|
|
39
39
|
# --- Publish to GitHub Packages (GPR) ---
|
package/package.json
CHANGED
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
const searchInput = document.getElementById('docmd-search-input');
|
|
14
14
|
const searchResults = document.getElementById('docmd-search-results');
|
|
15
15
|
|
|
16
|
+
const ROOT_PATH = window.DOCMD_ROOT || './';
|
|
17
|
+
|
|
16
18
|
if (!searchModal) return;
|
|
17
19
|
|
|
18
20
|
const emptyStateHtml = '<div class="search-initial">Type to start searching...</div>';
|
|
@@ -102,8 +104,9 @@
|
|
|
102
104
|
// 3. Index Loading Logic
|
|
103
105
|
async function loadIndex() {
|
|
104
106
|
try {
|
|
105
|
-
|
|
106
|
-
const
|
|
107
|
+
|
|
108
|
+
const indexUrl = `${ROOT_PATH}search-index.json`;
|
|
109
|
+
const response = await fetch(indexUrl);
|
|
107
110
|
if (!response.ok) throw new Error(response.status);
|
|
108
111
|
|
|
109
112
|
const jsonString = await response.text();
|
|
@@ -188,9 +191,12 @@
|
|
|
188
191
|
|
|
189
192
|
const html = results.slice(0, 10).map((result, index) => {
|
|
190
193
|
const snippet = getSnippet(result.text, query);
|
|
194
|
+
|
|
195
|
+
const linkHref = `${ROOT_PATH}${result.id}`;
|
|
196
|
+
|
|
191
197
|
// Add data-index for mouse interaction tracking if needed
|
|
192
198
|
return `
|
|
193
|
-
<a href="
|
|
199
|
+
<a href="${linkHref}" class="search-result-item" data-index="${index}" onclick="window.closeDocmdSearch()">
|
|
194
200
|
<div class="search-result-title">${result.title}</div>
|
|
195
201
|
<div class="search-result-preview">${snippet}</div>
|
|
196
202
|
</a>
|
|
@@ -6,7 +6,8 @@ const chalk = require('chalk');
|
|
|
6
6
|
const KNOWN_KEYS = [
|
|
7
7
|
'siteTitle', 'siteUrl', 'srcDir', 'outputDir', 'logo',
|
|
8
8
|
'sidebar', 'theme', 'customJs', 'autoTitleFromH1',
|
|
9
|
-
'copyCode', 'plugins', 'navigation', 'footer', 'sponsor', 'favicon'
|
|
9
|
+
'copyCode', 'plugins', 'navigation', 'footer', 'sponsor', 'favicon',
|
|
10
|
+
'search', 'minify', 'editLink', 'pageNavigation'
|
|
10
11
|
];
|
|
11
12
|
|
|
12
13
|
// Common typos mapping
|
package/src/templates/layout.ejs
CHANGED