@knowcode/doc-builder 1.2.3 → 1.2.5

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 CHANGED
@@ -5,6 +5,23 @@ 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
+
19
+ ## [1.2.4] - 2025-07-19
20
+
21
+ ### Fixed
22
+ - Removed test-auth directory from npm package
23
+ - Updated .npmignore to exclude test-auth directory
24
+
8
25
  ## [1.2.3] - 2025-07-19
9
26
 
10
27
  ### 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
- const currentPath = window.location.pathname;
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/deploy.js CHANGED
@@ -352,13 +352,17 @@ async function prepareDeployment(config) {
352
352
  <head>
353
353
  <meta charset="UTF-8">
354
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>
355
+ <title>${config.siteName || 'Documentation'}</title>
357
356
  <link rel="stylesheet" href="/css/style.css">
357
+ <script>
358
+ // Immediate redirect with fallback
359
+ window.location.replace('/README.html');
360
+ </script>
358
361
  </head>
359
362
  <body>
360
- <div style="text-align: center; margin-top: 50px;">
361
- <p>Redirecting to <a href="README.html">documentation</a>...</p>
363
+ <div style="text-align: center; margin-top: 50px; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;">
364
+ <p>Loading documentation...</p>
365
+ <p>If you are not redirected automatically, <a href="/README.html">click here</a>.</p>
362
366
  </div>
363
367
  </body>
364
368
  </html>`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knowcode/doc-builder",
3
- "version": "1.2.3",
3
+ "version": "1.2.5",
4
4
  "description": "Reusable documentation builder for markdown-based sites with Vercel deployment support",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -1,16 +0,0 @@
1
- module.exports = {
2
- siteName: 'Protected Documentation',
3
- siteDescription: 'Test site with authentication',
4
-
5
- features: {
6
- authentication: true, // Enable authentication
7
- changelog: false,
8
- mermaid: true,
9
- darkMode: true
10
- },
11
-
12
- auth: {
13
- username: 'testuser',
14
- password: 'testpass123'
15
- }
16
- };
@@ -1,104 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <meta name="description" content="Test site with authentication">
7
- <title>Test Auth Documentation - Protected Documentation</title>
8
-
9
- <!-- Fonts -->
10
- <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
11
-
12
- <!-- Icons -->
13
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
14
-
15
- <!-- Mermaid -->
16
- <script src="https://cdn.jsdelivr.net/npm/mermaid@10.6.1/dist/mermaid.min.js"></script>
17
-
18
- <!-- Styles -->
19
- <link rel="stylesheet" href="/css/notion-style.css">
20
- <link rel="stylesheet" href="/css/style.css">
21
-
22
- <!-- Favicon -->
23
- <link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>📚</text></svg>">
24
- </head>
25
- <body>
26
- <!-- Header -->
27
- <header class="header">
28
- <div class="header-content">
29
- <a href="/index.html" class="logo">Protected Documentation</a>
30
-
31
- <div class="header-actions">
32
- <div class="deployment-info">
33
- <span class="deployment-date">Last updated: Jul 19, 2025, 12:21 PM UTC</span>
34
- </div>
35
-
36
-
37
- <a href="../logout.html" class="logout-btn" title="Logout">
38
- <i class="fas fa-sign-out-alt"></i>
39
- </a>
40
-
41
-
42
- <button id="theme-toggle" class="theme-toggle" aria-label="Toggle theme">
43
- <i class="fas fa-moon"></i>
44
- </button>
45
-
46
- <button id="menu-toggle" class="menu-toggle" aria-label="Toggle menu">
47
- <i class="fas fa-bars"></i>
48
- </button>
49
- </div>
50
- </div>
51
- </header>
52
-
53
- <!-- Preview Banner -->
54
- <div id="preview-banner" class="preview-banner">
55
- <div class="banner-content">
56
- <i class="fas fa-exclamation-triangle banner-icon"></i>
57
- <span class="banner-text">This documentation is a preview version - some content may be incomplete</span>
58
- <button id="dismiss-banner" class="banner-dismiss" aria-label="Dismiss banner">
59
- <i class="fas fa-times"></i>
60
- </button>
61
- </div>
62
- </div>
63
-
64
- <!-- Breadcrumbs -->
65
- <nav class="breadcrumbs" id="breadcrumbs">
66
- <!-- Breadcrumbs will be generated by JavaScript -->
67
- </nav>
68
-
69
- <!-- Main Content -->
70
- <div class="main-wrapper">
71
- <!-- Sidebar -->
72
- <aside class="sidebar">
73
- <div class="sidebar-header">
74
- <div class="filter-box">
75
- <input type="text" placeholder="Filter items..." class="filter-input" id="nav-filter">
76
- <i class="fas fa-search filter-icon"></i>
77
- </div>
78
- </div>
79
- <nav class="navigation">
80
-
81
- <div class="nav-section" data-level="0">
82
- <a class="nav-title expanded" href="/README.html" >
83
- <i class="fas fa-home"></i> Documentation
84
- </a>
85
- <div class="nav-content" >
86
- <a href="/README.html" class="nav-item active"><i class="fas fa-file-alt"></i> Overview</a></div></div>
87
- </nav>
88
- <div class="resize-handle"></div>
89
- </aside>
90
-
91
- <!-- Content Area -->
92
- <main class="content">
93
- <div class="content-inner">
94
- <h1>Test Auth Documentation</h1>
95
-
96
- </div>
97
- </main>
98
- </div>
99
-
100
- <!-- Scripts -->
101
- <script src="/js/main.js"></script>
102
- <script src="/js/auth.js"></script>
103
- </body>
104
- </html>
@@ -1,67 +0,0 @@
1
- /**
2
- * Simple Client-Side Authentication for Documentation
3
- * This runs on every page load to check authentication
4
- *
5
- * IMPORTANT: This is a basic authentication system suitable for
6
- * protecting documentation from casual access. For production
7
- * use with sensitive data, implement server-side authentication.
8
- */
9
-
10
- (function() {
11
- 'use strict';
12
-
13
- // Skip auth check on login and logout pages
14
- const currentPage = window.location.pathname;
15
- if (currentPage === '/login.html' || currentPage === '/logout.html' || currentPage.includes('login') || currentPage.includes('logout')) {
16
- return;
17
- }
18
-
19
- // Check if user is authenticated
20
- function isAuthenticated() {
21
- const authToken = getCookie('doc-auth');
22
- if (!authToken) return false;
23
-
24
- try {
25
- // Simple token validation - just check if it exists and has expected format
26
- // The actual validation happens server-side (or in login page for static sites)
27
- const decoded = atob(authToken);
28
- return decoded && decoded.includes(':');
29
- } catch (error) {
30
- return false;
31
- }
32
- }
33
-
34
- // Get cookie value
35
- function getCookie(name) {
36
- const value = `; ${document.cookie}`;
37
- const parts = value.split(`; ${name}=`);
38
- if (parts.length === 2) return parts.pop().split(';').shift();
39
- return null;
40
- }
41
-
42
- // Redirect to login if not authenticated
43
- function redirectToLogin() {
44
- const currentUrl = window.location.pathname + window.location.search;
45
- const loginUrl = '/login.html' + (currentUrl !== '/' ? '?redirect=' + encodeURIComponent(currentUrl) : '');
46
- window.location.href = loginUrl;
47
- }
48
-
49
- // Check authentication on page load
50
- if (!isAuthenticated()) {
51
- redirectToLogin();
52
- }
53
-
54
- // Add logout functionality to logout buttons
55
- document.addEventListener('DOMContentLoaded', function() {
56
- const logoutLinks = document.querySelectorAll('a[href*="logout"]');
57
- logoutLinks.forEach(link => {
58
- link.addEventListener('click', function(e) {
59
- e.preventDefault();
60
- // Clear auth cookie
61
- document.cookie = 'doc-auth=; path=/; expires=Thu, 01 Jan 1970 00:00:01 GMT;';
62
- window.location.href = '/logout.html';
63
- });
64
- });
65
- });
66
-
67
- })();