@knowcode/doc-builder 1.2.4 → 1.2.6
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.
- package/CHANGELOG.md +11 -0
- package/assets/js/main.js +2 -1
- package/lib/core-builder.js +8 -0
- package/lib/deploy.js +4 -19
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,17 @@ All notable changes to @knowcode/doc-builder will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.2.5] - 2025-07-19
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- **Breadcrumbs** - Fixed URL-encoded characters showing in breadcrumb navigation (spaces showing as %20)
|
|
12
|
+
- **Root redirect** - Fixed index.html redirect to use JavaScript window.location.replace for better Vercel compatibility
|
|
13
|
+
- Breadcrumbs now properly decode URL segments before displaying
|
|
14
|
+
|
|
15
|
+
### Improved
|
|
16
|
+
- Root page redirect is now more reliable with JavaScript-based redirection
|
|
17
|
+
- Better fallback link in case JavaScript is disabled
|
|
18
|
+
|
|
8
19
|
## [1.2.4] - 2025-07-19
|
|
9
20
|
|
|
10
21
|
### Fixed
|
package/assets/js/main.js
CHANGED
|
@@ -1208,7 +1208,8 @@ function generateBreadcrumbs() {
|
|
|
1208
1208
|
const breadcrumbContainer = document.getElementById('breadcrumbs');
|
|
1209
1209
|
if (!breadcrumbContainer) return;
|
|
1210
1210
|
|
|
1211
|
-
|
|
1211
|
+
// Decode the URL to handle special characters and spaces
|
|
1212
|
+
const currentPath = decodeURIComponent(window.location.pathname);
|
|
1212
1213
|
let pathSegments = currentPath.split('/').filter(segment => segment !== '');
|
|
1213
1214
|
|
|
1214
1215
|
// Find the index of 'html' directory and slice from there
|
package/lib/core-builder.js
CHANGED
|
@@ -490,6 +490,14 @@ async function buildDocumentation(config) {
|
|
|
490
490
|
await createAuthPages(outputDir, config);
|
|
491
491
|
}
|
|
492
492
|
|
|
493
|
+
// Create index.html from README.html if it doesn't exist
|
|
494
|
+
const indexPath = path.join(outputDir, 'index.html');
|
|
495
|
+
const readmePath = path.join(outputDir, 'README.html');
|
|
496
|
+
if (!fs.existsSync(indexPath) && fs.existsSync(readmePath)) {
|
|
497
|
+
await fs.copy(readmePath, indexPath);
|
|
498
|
+
console.log(chalk.green('✅ Created index.html from README.html'));
|
|
499
|
+
}
|
|
500
|
+
|
|
493
501
|
console.log(chalk.green('✅ Documentation build complete!'));
|
|
494
502
|
}
|
|
495
503
|
|
package/lib/deploy.js
CHANGED
|
@@ -341,29 +341,14 @@ async function deployToVercel(config, isProd = false) {
|
|
|
341
341
|
async function prepareDeployment(config) {
|
|
342
342
|
const outputDir = path.join(process.cwd(), config.outputDir || 'html');
|
|
343
343
|
|
|
344
|
-
// Create
|
|
344
|
+
// Create index.html from README.html if needed
|
|
345
345
|
const indexPath = path.join(outputDir, 'index.html');
|
|
346
346
|
if (!fs.existsSync(indexPath)) {
|
|
347
347
|
const readmePath = path.join(outputDir, 'README.html');
|
|
348
348
|
if (fs.existsSync(readmePath)) {
|
|
349
|
-
//
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
<head>
|
|
353
|
-
<meta charset="UTF-8">
|
|
354
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
355
|
-
<meta http-equiv="refresh" content="0; url=README.html">
|
|
356
|
-
<title>Redirecting...</title>
|
|
357
|
-
<link rel="stylesheet" href="/css/style.css">
|
|
358
|
-
</head>
|
|
359
|
-
<body>
|
|
360
|
-
<div style="text-align: center; margin-top: 50px;">
|
|
361
|
-
<p>Redirecting to <a href="README.html">documentation</a>...</p>
|
|
362
|
-
</div>
|
|
363
|
-
</body>
|
|
364
|
-
</html>`;
|
|
365
|
-
fs.writeFileSync(indexPath, redirectHtml);
|
|
366
|
-
console.log(chalk.green('✅ Created index.html redirect to README.html'));
|
|
349
|
+
// Copy README.html to index.html for proper root page
|
|
350
|
+
fs.copyFileSync(readmePath, indexPath);
|
|
351
|
+
console.log(chalk.green('✅ Created index.html from README.html'));
|
|
367
352
|
} else {
|
|
368
353
|
// If no README.html, create a simple redirect to home
|
|
369
354
|
// This should rarely happen since build process now auto-generates README.md
|