@knowcode/doc-builder 1.1.12 → 1.2.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.
- package/CHANGELOG.md +63 -0
- package/assets/css/notion-style.css +264 -49
- package/lib/core-builder.js +317 -68
- package/lib/deploy.js +12 -55
- package/package.json +1 -1
- package/temp-test/docs/README.md +69 -0
- package/temp-test/docs/test-file.md +1 -0
- package/temp-test/html/README.html +164 -0
- package/temp-test/html/css/notion-style.css +1758 -0
- package/temp-test/html/css/style.css +1974 -0
- package/temp-test/html/js/auth.js +65 -0
- package/temp-test/html/js/main.js +1333 -0
- package/temp-test/html/test-file.html +101 -0
package/lib/core-builder.js
CHANGED
|
@@ -123,18 +123,43 @@ function generateHTML(title, content, navigation, currentPath = '', config = {})
|
|
|
123
123
|
</div>
|
|
124
124
|
</header>
|
|
125
125
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
<
|
|
129
|
-
<
|
|
130
|
-
|
|
126
|
+
<!-- Preview Banner -->
|
|
127
|
+
<div id="preview-banner" class="preview-banner">
|
|
128
|
+
<div class="banner-content">
|
|
129
|
+
<i class="fas fa-exclamation-triangle banner-icon"></i>
|
|
130
|
+
<span class="banner-text">This documentation is a preview version - some content may be incomplete</span>
|
|
131
|
+
<button id="dismiss-banner" class="banner-dismiss" aria-label="Dismiss banner">
|
|
132
|
+
<i class="fas fa-times"></i>
|
|
133
|
+
</button>
|
|
134
|
+
</div>
|
|
135
|
+
</div>
|
|
136
|
+
|
|
137
|
+
<!-- Breadcrumbs -->
|
|
138
|
+
<nav class="breadcrumbs" id="breadcrumbs">
|
|
139
|
+
<!-- Breadcrumbs will be generated by JavaScript -->
|
|
140
|
+
</nav>
|
|
141
|
+
|
|
142
|
+
<!-- Main Content -->
|
|
143
|
+
<div class="main-wrapper">
|
|
144
|
+
<!-- Sidebar -->
|
|
145
|
+
<aside class="sidebar">
|
|
146
|
+
<div class="sidebar-header">
|
|
147
|
+
<div class="filter-box">
|
|
148
|
+
<input type="text" placeholder="Filter items..." class="filter-input" id="nav-filter">
|
|
149
|
+
<i class="fas fa-search filter-icon"></i>
|
|
150
|
+
</div>
|
|
131
151
|
</div>
|
|
132
|
-
|
|
133
|
-
|
|
152
|
+
<nav class="navigation">
|
|
153
|
+
${navigation}
|
|
154
|
+
</nav>
|
|
155
|
+
<div class="resize-handle"></div>
|
|
156
|
+
</aside>
|
|
134
157
|
|
|
135
|
-
<!--
|
|
158
|
+
<!-- Content Area -->
|
|
136
159
|
<main class="content">
|
|
137
|
-
|
|
160
|
+
<div class="content-inner">
|
|
161
|
+
${content}
|
|
162
|
+
</div>
|
|
138
163
|
</main>
|
|
139
164
|
</div>
|
|
140
165
|
|
|
@@ -145,7 +170,28 @@ function generateHTML(title, content, navigation, currentPath = '', config = {})
|
|
|
145
170
|
</html>`;
|
|
146
171
|
}
|
|
147
172
|
|
|
148
|
-
//
|
|
173
|
+
// Define folder descriptions for tooltips
|
|
174
|
+
const folderDescriptions = {
|
|
175
|
+
'product-roadmap': 'Strategic vision, timeline, and feature planning',
|
|
176
|
+
'product-requirements': 'Detailed product specifications, requirements documents, and feature definitions',
|
|
177
|
+
'architecture': 'System design, data flows, and technical infrastructure documentation',
|
|
178
|
+
'system-analysis': 'Comprehensive system analysis, functional requirements, and cross-component documentation',
|
|
179
|
+
'bubble': 'Core application platform - business logic, UI/UX, and user workflows',
|
|
180
|
+
'quickbase': 'Database schema, data management, and backend operations',
|
|
181
|
+
'activecampaign': 'Marketing automation integration and lead management system',
|
|
182
|
+
'juno-signer': 'Document signing service for digital signatures and PDF generation',
|
|
183
|
+
'juno-api-deprecated': 'Legacy API documentation (deprecated, for reference only)',
|
|
184
|
+
'postman': 'API testing tools, collections, and test automation',
|
|
185
|
+
'mcp': 'Model Context Protocol integration and configuration',
|
|
186
|
+
'team': 'Team structure, roles, and responsibilities',
|
|
187
|
+
'thought-leadership': 'Strategic insights and industry perspectives',
|
|
188
|
+
'middleware': 'Integration layers and data transformation services',
|
|
189
|
+
'paths': 'User journey flows and process workflows',
|
|
190
|
+
'testing': 'Test strategies, scenarios, and quality assurance processes',
|
|
191
|
+
'juno-api': 'API documentation and integration guides'
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
// Build navigation structure with rich functionality
|
|
149
195
|
function buildNavigationStructure(files, currentFile) {
|
|
150
196
|
const tree = { files: [], folders: {} };
|
|
151
197
|
|
|
@@ -166,71 +212,176 @@ function buildNavigationStructure(files, currentFile) {
|
|
|
166
212
|
current.files.push(file);
|
|
167
213
|
});
|
|
168
214
|
|
|
169
|
-
//
|
|
170
|
-
const
|
|
215
|
+
// Helper function to check if a node has active child
|
|
216
|
+
const checkActiveChild = (node, currentFile) => {
|
|
217
|
+
// Check files
|
|
218
|
+
if (node.files.some(f => f.urlPath === currentFile)) return true;
|
|
219
|
+
|
|
220
|
+
// Check folders recursively
|
|
221
|
+
return Object.values(node.folders).some(folder => checkActiveChild(folder, currentFile));
|
|
222
|
+
};
|
|
171
223
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
let
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
224
|
+
// Helper function to generate file title
|
|
225
|
+
const generateFileTitle = (file, parentDisplayName, level) => {
|
|
226
|
+
let title = file.displayName;
|
|
227
|
+
|
|
228
|
+
if (file.displayName === 'README') {
|
|
229
|
+
return level === 0 ? 'Overview' : `${parentDisplayName} Overview`;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// Clean up title by removing common prefixes and improving formatting
|
|
233
|
+
title = title
|
|
234
|
+
.replace(/^(bubble|system|quickbase|middleware|product-roadmap)-?/, '')
|
|
235
|
+
.replace(/-/g, ' ')
|
|
236
|
+
.replace(/\b\w/g, l => l.toUpperCase());
|
|
237
|
+
|
|
238
|
+
return title;
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
// Helper function to render a section
|
|
242
|
+
const renderSection = (folderName, folderData, level = 0, parentPath = '') => {
|
|
243
|
+
const icons = {
|
|
244
|
+
'root': 'fas fa-home',
|
|
245
|
+
'product-roadmap': 'fas fa-road',
|
|
246
|
+
'product-requirements': 'fas fa-clipboard-list',
|
|
247
|
+
'architecture': 'fas fa-sitemap',
|
|
248
|
+
'system-analysis': 'fas fa-chart-line',
|
|
249
|
+
'system': 'fas fa-cogs',
|
|
250
|
+
'bubble': 'fas fa-circle',
|
|
251
|
+
'quickbase': 'fas fa-database',
|
|
252
|
+
'activecampaign': 'fas fa-envelope',
|
|
253
|
+
'juno-signer': 'fas fa-signature',
|
|
254
|
+
'juno-api-deprecated': 'fas fa-archive',
|
|
255
|
+
'postman': 'fas fa-flask',
|
|
256
|
+
'mcp': 'fas fa-puzzle-piece',
|
|
257
|
+
'team': 'fas fa-users',
|
|
258
|
+
'thought-leadership': 'fas fa-lightbulb',
|
|
259
|
+
'middleware': 'fas fa-layer-group',
|
|
260
|
+
'paths': 'fas fa-route',
|
|
261
|
+
'testing': 'fas fa-vial',
|
|
262
|
+
'juno-api': 'fas fa-plug',
|
|
263
|
+
'documentation-tool': 'fas fa-tools'
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
const displayName = folderName === 'root' ? 'Documentation' :
|
|
267
|
+
folderName.replace(/-/g, ' ').replace(/\b\w/g, l => l.toUpperCase());
|
|
268
|
+
const icon = icons[folderName] || 'fas fa-folder';
|
|
269
|
+
|
|
270
|
+
if (!folderData.files.length && !Object.keys(folderData.folders).length) {
|
|
271
|
+
return '';
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
// Include parent path in section ID to make it unique
|
|
275
|
+
const pathParts = parentPath ? [parentPath, folderName].join('-') : folderName;
|
|
276
|
+
const sectionId = `nav-${pathParts}-${level}`;
|
|
277
|
+
const isCollapsible = level > 0 || folderName !== 'root';
|
|
278
|
+
const collapseIcon = isCollapsible ? '<i class="fas fa-chevron-right collapse-icon"></i>' : '';
|
|
279
|
+
|
|
280
|
+
// Check if this folder has a README.md file to link to
|
|
281
|
+
const readmeFile = folderData.files.find(f => f.displayName === 'README');
|
|
282
|
+
const folderLink = readmeFile ? `href="/${readmeFile.urlPath}"` : 'href="#"';
|
|
283
|
+
|
|
284
|
+
// Get folder description for tooltip
|
|
285
|
+
const folderDescription = folderDescriptions[folderName] || '';
|
|
286
|
+
const tooltipAttr = folderDescription ? `data-tooltip="${escapeHtml(folderDescription)}"` : '';
|
|
287
|
+
|
|
288
|
+
// Start all sections collapsed by default (JavaScript will expand sections containing active items)
|
|
289
|
+
const hasActiveChild = checkActiveChild(folderData, currentFile);
|
|
290
|
+
|
|
291
|
+
let html = `
|
|
292
|
+
<div class="nav-section" data-level="${level}">
|
|
293
|
+
<a class="nav-title${isCollapsible ? ' collapsible' : ''}${hasActiveChild ? ' expanded' : ''}" ${folderLink} ${isCollapsible ? `data-target="${sectionId}"` : ''} ${tooltipAttr}>
|
|
294
|
+
${collapseIcon}<i class="${icon}"></i> ${displayName}
|
|
183
295
|
</a>
|
|
184
|
-
|
|
296
|
+
<div class="nav-content${isCollapsible ? (hasActiveChild ? '' : ' collapsed') : ''}" ${isCollapsible ? `id="${sectionId}"` : ''}>`;
|
|
297
|
+
|
|
298
|
+
// Sort and render files
|
|
299
|
+
const sortedFiles = [...folderData.files].sort((a, b) => {
|
|
300
|
+
if (a.displayName === 'README') return -1;
|
|
301
|
+
if (b.displayName === 'README') return 1;
|
|
302
|
+
return a.displayName.localeCompare(b.displayName);
|
|
185
303
|
});
|
|
186
304
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
} else {
|
|
190
|
-
// Generate collapsible navigation for folder structures
|
|
191
|
-
const generateNavHTML = (node, path = '', level = 0) => {
|
|
192
|
-
let html = '';
|
|
305
|
+
sortedFiles.forEach(file => {
|
|
306
|
+
const title = generateFileTitle(file, displayName, level);
|
|
193
307
|
|
|
194
|
-
//
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
<i class="fas fa-chevron-${hasActiveChild ? 'down' : 'right'}"></i>
|
|
203
|
-
<span class="nav-text">${folderName}</span>
|
|
204
|
-
</div>
|
|
205
|
-
<div class="nav-content ${hasActiveChild ? '' : 'collapsed'}" id="${sectionId}">
|
|
206
|
-
${generateNavHTML(folderNode, folderPath, level + 1)}
|
|
207
|
-
</div>
|
|
208
|
-
</div>`;
|
|
209
|
-
});
|
|
308
|
+
// Check if this file is active
|
|
309
|
+
let isActive = '';
|
|
310
|
+
if (currentFile === file.urlPath) {
|
|
311
|
+
isActive = ' active';
|
|
312
|
+
} else if (currentFile === 'index.html' && file.displayName === 'README' && folderName === 'root') {
|
|
313
|
+
// Mark root README as active when viewing index.html
|
|
314
|
+
isActive = ' active';
|
|
315
|
+
}
|
|
210
316
|
|
|
211
|
-
|
|
212
|
-
node.files.forEach(file => {
|
|
213
|
-
const isActive = file.urlPath === currentFile;
|
|
214
|
-
const href = file.urlPath.replace(/\\/g, '/');
|
|
215
|
-
html += `<div class="nav-item ${isActive ? 'active' : ''}">
|
|
216
|
-
<a href="${href}" class="nav-link ${isActive ? 'active' : ''}">
|
|
217
|
-
<span class="nav-text">${file.displayName}</span>
|
|
218
|
-
</a>
|
|
219
|
-
</div>`;
|
|
220
|
-
});
|
|
317
|
+
const linkPath = '/' + file.urlPath;
|
|
221
318
|
|
|
222
|
-
|
|
223
|
-
|
|
319
|
+
html += `
|
|
320
|
+
<a href="${linkPath}" class="nav-item${isActive}"><i class="fas fa-file-alt"></i> ${title}</a>`;
|
|
321
|
+
});
|
|
224
322
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
323
|
+
html += `</div></div>`;
|
|
324
|
+
|
|
325
|
+
// Render subfolders AFTER closing the parent section
|
|
326
|
+
Object.keys(folderData.folders)
|
|
327
|
+
.sort()
|
|
328
|
+
.forEach(subFolder => {
|
|
329
|
+
// Build the path for the subfolder including current folder
|
|
330
|
+
const currentPath = parentPath ? `${parentPath}-${folderName}` : folderName;
|
|
331
|
+
html += renderSection(subFolder, folderData.folders[subFolder], level + 1, currentPath);
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
return html;
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
// Check if this is a flat structure
|
|
338
|
+
const hasFolders = Object.keys(tree.folders).length > 0;
|
|
339
|
+
|
|
340
|
+
if (!hasFolders) {
|
|
341
|
+
// Generate simple flat navigation for all files in root
|
|
342
|
+
return renderSection('root', { files: tree.files, folders: {} }, 0);
|
|
343
|
+
} else {
|
|
344
|
+
// Generate hierarchical navigation
|
|
345
|
+
let nav = '';
|
|
346
|
+
|
|
347
|
+
// Render root files first
|
|
348
|
+
if (tree.files.length > 0) {
|
|
349
|
+
nav += renderSection('root', { files: tree.files, folders: {} }, 0);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// Add other top-level folders in logical order
|
|
353
|
+
const folderOrder = [
|
|
354
|
+
'product-roadmap',
|
|
355
|
+
'product-requirements',
|
|
356
|
+
'architecture',
|
|
357
|
+
'system-analysis',
|
|
358
|
+
'bubble',
|
|
359
|
+
'quickbase',
|
|
360
|
+
'activecampaign',
|
|
361
|
+
'juno-signer',
|
|
362
|
+
'juno-api-deprecated',
|
|
363
|
+
'postman',
|
|
364
|
+
'mcp',
|
|
365
|
+
'team',
|
|
366
|
+
'thought-leadership',
|
|
367
|
+
'documentation-tool'
|
|
368
|
+
];
|
|
369
|
+
|
|
370
|
+
folderOrder.forEach(folderName => {
|
|
371
|
+
if (tree.folders[folderName]) {
|
|
372
|
+
nav += renderSection(folderName, tree.folders[folderName], 1);
|
|
373
|
+
delete tree.folders[folderName]; // Remove so we don't render it again
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
// Render any remaining folders not in the predefined order
|
|
378
|
+
Object.keys(tree.folders)
|
|
379
|
+
.sort()
|
|
380
|
+
.forEach(folderName => {
|
|
381
|
+
nav += renderSection(folderName, tree.folders[folderName], 1);
|
|
382
|
+
});
|
|
232
383
|
|
|
233
|
-
return
|
|
384
|
+
return nav;
|
|
234
385
|
}
|
|
235
386
|
}
|
|
236
387
|
|
|
@@ -297,9 +448,13 @@ async function buildDocumentation(config) {
|
|
|
297
448
|
const docsDir = path.join(process.cwd(), config.docsDir);
|
|
298
449
|
const outputDir = path.join(process.cwd(), config.outputDir);
|
|
299
450
|
|
|
451
|
+
// Check and create placeholder README.md if missing
|
|
452
|
+
console.log(chalk.blue('📋 Checking documentation structure...'));
|
|
453
|
+
const readmeGenerated = await createPlaceholderReadme(docsDir, config);
|
|
454
|
+
|
|
300
455
|
console.log(chalk.blue('📄 Scanning for markdown files...'));
|
|
301
456
|
const files = await getAllMarkdownFiles(docsDir);
|
|
302
|
-
console.log(chalk.green(`✅ Found ${files.length} markdown files`));
|
|
457
|
+
console.log(chalk.green(`✅ Found ${files.length} markdown files${readmeGenerated ? ' (including auto-generated README)' : ''}`));
|
|
303
458
|
|
|
304
459
|
console.log(chalk.blue('📝 Processing files...'));
|
|
305
460
|
for (const file of files) {
|
|
@@ -338,6 +493,99 @@ async function buildDocumentation(config) {
|
|
|
338
493
|
console.log(chalk.green('✅ Documentation build complete!'));
|
|
339
494
|
}
|
|
340
495
|
|
|
496
|
+
// Create placeholder README.md if missing
|
|
497
|
+
async function createPlaceholderReadme(docsDir, config) {
|
|
498
|
+
const readmePath = path.join(docsDir, 'README.md');
|
|
499
|
+
|
|
500
|
+
// Check if README.md already exists
|
|
501
|
+
if (fs.existsSync(readmePath)) {
|
|
502
|
+
return false; // README already exists, no need to create
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
const siteName = config.siteName || 'Documentation';
|
|
506
|
+
const currentDate = new Date().toISOString().split('T')[0];
|
|
507
|
+
|
|
508
|
+
const placeholderContent = `# Welcome to ${siteName}
|
|
509
|
+
|
|
510
|
+
**Generated**: ${currentDate} UTC
|
|
511
|
+
**Status**: Placeholder - Ready for customization
|
|
512
|
+
**Verified**: ❓ (Auto-generated content)
|
|
513
|
+
|
|
514
|
+
## Overview
|
|
515
|
+
|
|
516
|
+
This documentation site was built with @knowcode/doc-builder. This is an auto-generated placeholder to help you get started.
|
|
517
|
+
|
|
518
|
+
## Getting Started
|
|
519
|
+
|
|
520
|
+
1. **Replace this file**: Edit \`docs/README.md\` with your project's actual documentation
|
|
521
|
+
2. **Add content**: Create additional markdown files in the \`docs/\` directory
|
|
522
|
+
3. **Organize with folders**: Use subfolders to structure your documentation
|
|
523
|
+
4. **Rebuild**: Run \`npx @knowcode/doc-builder build\` to regenerate the site
|
|
524
|
+
|
|
525
|
+
## Documentation Structure
|
|
526
|
+
|
|
527
|
+
Your documentation can include:
|
|
528
|
+
|
|
529
|
+
- **Overview**: Main project description (this file)
|
|
530
|
+
- **Guides**: Step-by-step tutorials
|
|
531
|
+
- **API Reference**: Technical documentation
|
|
532
|
+
- **Examples**: Code samples and usage
|
|
533
|
+
- **Architecture**: System design and technical details
|
|
534
|
+
|
|
535
|
+
## Next Steps
|
|
536
|
+
|
|
537
|
+
1. Edit this README.md file with your project information
|
|
538
|
+
2. Create additional markdown files for your content
|
|
539
|
+
3. Organize files into logical folders
|
|
540
|
+
4. Use Mermaid diagrams for visual explanations
|
|
541
|
+
5. Deploy with \`npx @knowcode/doc-builder deploy\`
|
|
542
|
+
|
|
543
|
+
## Documentation Standards
|
|
544
|
+
|
|
545
|
+
This project follows structured documentation conventions:
|
|
546
|
+
|
|
547
|
+
### File Organization
|
|
548
|
+
- Use descriptive filenames with hyphens (e.g., \`user-guide.md\`)
|
|
549
|
+
- Organize related content in folders
|
|
550
|
+
- Include a README.md in each major folder
|
|
551
|
+
|
|
552
|
+
### Content Format
|
|
553
|
+
- Start each document with metadata (Generated date, Status, Verified status)
|
|
554
|
+
- Use clear headings and consistent structure
|
|
555
|
+
- Include diagrams where helpful to explain concepts
|
|
556
|
+
- Mark information as verified (✅) or speculated (❓)
|
|
557
|
+
|
|
558
|
+
### Mermaid Diagrams
|
|
559
|
+
Include visual diagrams to explain complex concepts:
|
|
560
|
+
|
|
561
|
+
\`\`\`mermaid
|
|
562
|
+
graph TD
|
|
563
|
+
A[Start Documentation] --> B{Have Content?}
|
|
564
|
+
B -->|Yes| C[Edit README.md]
|
|
565
|
+
B -->|No| D[Create Content Files]
|
|
566
|
+
C --> E[Build & Deploy]
|
|
567
|
+
D --> E
|
|
568
|
+
E --> F[Share Documentation]
|
|
569
|
+
\`\`\`
|
|
570
|
+
|
|
571
|
+
## Support
|
|
572
|
+
|
|
573
|
+
For help with @knowcode/doc-builder:
|
|
574
|
+
- Check the documentation at your package source
|
|
575
|
+
- Use \`npx @knowcode/doc-builder --help\` for CLI options
|
|
576
|
+
- Review the generated configuration guide if available
|
|
577
|
+
`;
|
|
578
|
+
|
|
579
|
+
try {
|
|
580
|
+
await fs.writeFile(readmePath, placeholderContent);
|
|
581
|
+
console.log(chalk.yellow('📄 Auto-generated placeholder README.md - please customize it!'));
|
|
582
|
+
return true; // Successfully created placeholder
|
|
583
|
+
} catch (error) {
|
|
584
|
+
console.warn(chalk.yellow(`Warning: Could not create placeholder README.md: ${error.message}`));
|
|
585
|
+
return false;
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
|
|
341
589
|
// Create login/logout pages
|
|
342
590
|
async function createAuthPages(outputDir, config) {
|
|
343
591
|
// Login page
|
|
@@ -419,5 +667,6 @@ async function createAuthPages(outputDir, config) {
|
|
|
419
667
|
module.exports = {
|
|
420
668
|
buildDocumentation,
|
|
421
669
|
processMarkdownContent,
|
|
422
|
-
generateHTML
|
|
670
|
+
generateHTML,
|
|
671
|
+
createPlaceholderReadme
|
|
423
672
|
};
|
package/lib/deploy.js
CHANGED
|
@@ -365,72 +365,29 @@ async function prepareDeployment(config) {
|
|
|
365
365
|
fs.writeFileSync(indexPath, redirectHtml);
|
|
366
366
|
console.log(chalk.green('✅ Created index.html redirect to README.html'));
|
|
367
367
|
} else {
|
|
368
|
-
// If no README.html, create a
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
.sort();
|
|
372
|
-
|
|
373
|
-
if (htmlFiles.length > 0) {
|
|
374
|
-
const indexHtml = `<!DOCTYPE html>
|
|
368
|
+
// If no README.html, create a simple redirect to home
|
|
369
|
+
// This should rarely happen since build process now auto-generates README.md
|
|
370
|
+
const simpleIndex = `<!DOCTYPE html>
|
|
375
371
|
<html>
|
|
376
372
|
<head>
|
|
377
373
|
<meta charset="UTF-8">
|
|
378
374
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
379
|
-
<
|
|
380
|
-
<
|
|
375
|
+
<meta http-equiv="refresh" content="0; url=./">
|
|
376
|
+
<title>${config.siteName || 'Documentation'}</title>
|
|
381
377
|
<link rel="stylesheet" href="/css/style.css">
|
|
382
378
|
<link rel="stylesheet" href="/css/notion-style.css">
|
|
383
379
|
</head>
|
|
384
380
|
<body>
|
|
385
|
-
<div
|
|
386
|
-
<
|
|
387
|
-
|
|
388
|
-
</
|
|
389
|
-
<nav>
|
|
390
|
-
<ul>
|
|
391
|
-
${htmlFiles.map(file => {
|
|
392
|
-
const name = file.replace('.html', '').replace(/-/g, ' ');
|
|
393
|
-
const capitalizedName = name.split(' ').map(word =>
|
|
394
|
-
word.charAt(0).toUpperCase() + word.slice(1)
|
|
395
|
-
).join(' ');
|
|
396
|
-
return `<li><a href="${file}"><i class="fas fa-file"></i> ${capitalizedName}</a></li>`;
|
|
397
|
-
}).join('\n ')}
|
|
398
|
-
</ul>
|
|
399
|
-
</nav>
|
|
400
|
-
</div>
|
|
401
|
-
<div class="content">
|
|
402
|
-
<div class="header">
|
|
403
|
-
<h1 style="text-align: center; margin: 50px 0;">📚 Documentation</h1>
|
|
404
|
-
</div>
|
|
405
|
-
<div class="main-content">
|
|
406
|
-
<div class="doc-grid" style="display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; padding: 20px;">
|
|
407
|
-
${htmlFiles.map(file => {
|
|
408
|
-
const name = file.replace('.html', '').replace(/-/g, ' ');
|
|
409
|
-
const capitalizedName = name.split(' ').map(word =>
|
|
410
|
-
word.charAt(0).toUpperCase() + word.slice(1)
|
|
411
|
-
).join(' ');
|
|
412
|
-
return `
|
|
413
|
-
<a href="${file}" class="doc-card" style="display: block; padding: 20px; border: 1px solid #e1e4e8; border-radius: 8px; text-decoration: none; color: inherit; transition: all 0.2s;">
|
|
414
|
-
<h3 style="margin: 0 0 10px 0; color: #0366d6;"><i class="fas fa-file-alt"></i> ${capitalizedName}</h3>
|
|
415
|
-
<p style="margin: 0; color: #586069; font-size: 14px;">Click to view this documentation</p>
|
|
416
|
-
</a>`;
|
|
417
|
-
}).join('')}
|
|
418
|
-
</div>
|
|
419
|
-
</div>
|
|
381
|
+
<div style="text-align: center; margin-top: 50px; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;">
|
|
382
|
+
<h1>📚 ${config.siteName || 'Documentation'}</h1>
|
|
383
|
+
<p>Loading documentation...</p>
|
|
384
|
+
<p><a href="./" style="color: #0366d6;">Click here if not redirected automatically</a></p>
|
|
420
385
|
</div>
|
|
421
|
-
<script src="/js/main.js"></script>
|
|
422
|
-
<style>
|
|
423
|
-
.doc-card:hover {
|
|
424
|
-
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
|
|
425
|
-
transform: translateY(-2px);
|
|
426
|
-
}
|
|
427
|
-
</style>
|
|
428
386
|
</body>
|
|
429
387
|
</html>`;
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
}
|
|
388
|
+
fs.writeFileSync(indexPath, simpleIndex);
|
|
389
|
+
console.log(chalk.green('✅ Created index.html redirect'));
|
|
390
|
+
console.log(chalk.yellow('📌 Note: Consider running build to ensure README.md exists'));
|
|
434
391
|
}
|
|
435
392
|
}
|
|
436
393
|
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Welcome to Documentation
|
|
2
|
+
|
|
3
|
+
**Generated**: 2025-07-19 UTC
|
|
4
|
+
**Status**: Placeholder - Ready for customization
|
|
5
|
+
**Verified**: ❓ (Auto-generated content)
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
This documentation site was built with @knowcode/doc-builder. This is an auto-generated placeholder to help you get started.
|
|
10
|
+
|
|
11
|
+
## Getting Started
|
|
12
|
+
|
|
13
|
+
1. **Replace this file**: Edit `docs/README.md` with your project's actual documentation
|
|
14
|
+
2. **Add content**: Create additional markdown files in the `docs/` directory
|
|
15
|
+
3. **Organize with folders**: Use subfolders to structure your documentation
|
|
16
|
+
4. **Rebuild**: Run `npx @knowcode/doc-builder build` to regenerate the site
|
|
17
|
+
|
|
18
|
+
## Documentation Structure
|
|
19
|
+
|
|
20
|
+
Your documentation can include:
|
|
21
|
+
|
|
22
|
+
- **Overview**: Main project description (this file)
|
|
23
|
+
- **Guides**: Step-by-step tutorials
|
|
24
|
+
- **API Reference**: Technical documentation
|
|
25
|
+
- **Examples**: Code samples and usage
|
|
26
|
+
- **Architecture**: System design and technical details
|
|
27
|
+
|
|
28
|
+
## Next Steps
|
|
29
|
+
|
|
30
|
+
1. Edit this README.md file with your project information
|
|
31
|
+
2. Create additional markdown files for your content
|
|
32
|
+
3. Organize files into logical folders
|
|
33
|
+
4. Use Mermaid diagrams for visual explanations
|
|
34
|
+
5. Deploy with `npx @knowcode/doc-builder deploy`
|
|
35
|
+
|
|
36
|
+
## Documentation Standards
|
|
37
|
+
|
|
38
|
+
This project follows structured documentation conventions:
|
|
39
|
+
|
|
40
|
+
### File Organization
|
|
41
|
+
- Use descriptive filenames with hyphens (e.g., `user-guide.md`)
|
|
42
|
+
- Organize related content in folders
|
|
43
|
+
- Include a README.md in each major folder
|
|
44
|
+
|
|
45
|
+
### Content Format
|
|
46
|
+
- Start each document with metadata (Generated date, Status, Verified status)
|
|
47
|
+
- Use clear headings and consistent structure
|
|
48
|
+
- Include diagrams where helpful to explain concepts
|
|
49
|
+
- Mark information as verified (✅) or speculated (❓)
|
|
50
|
+
|
|
51
|
+
### Mermaid Diagrams
|
|
52
|
+
Include visual diagrams to explain complex concepts:
|
|
53
|
+
|
|
54
|
+
```mermaid
|
|
55
|
+
graph TD
|
|
56
|
+
A[Start Documentation] --> B{Have Content?}
|
|
57
|
+
B -->|Yes| C[Edit README.md]
|
|
58
|
+
B -->|No| D[Create Content Files]
|
|
59
|
+
C --> E[Build & Deploy]
|
|
60
|
+
D --> E
|
|
61
|
+
E --> F[Share Documentation]
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Support
|
|
65
|
+
|
|
66
|
+
For help with @knowcode/doc-builder:
|
|
67
|
+
- Check the documentation at your package source
|
|
68
|
+
- Use `npx @knowcode/doc-builder --help` for CLI options
|
|
69
|
+
- Review the generated configuration guide if available
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Test File
|