@knowcode/doc-builder 1.10.7 → 1.10.9
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/assets/js/main.js +19 -12
- package/lib/core-builder.js +16 -1
- package/package.json +1 -1
package/assets/js/main.js
CHANGED
|
@@ -1090,22 +1090,29 @@ function initCollapsibleNavigation() {
|
|
|
1090
1090
|
|
|
1091
1091
|
if (content) {
|
|
1092
1092
|
const isExpanded = title.classList.contains('expanded');
|
|
1093
|
-
|
|
1093
|
+
|
|
1094
1094
|
if (isExpanded) {
|
|
1095
1095
|
// Collapse this section
|
|
1096
1096
|
title.classList.remove('expanded');
|
|
1097
1097
|
content.classList.add('collapsed');
|
|
1098
|
-
|
|
1099
|
-
//
|
|
1100
|
-
const
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1098
|
+
|
|
1099
|
+
// Recursively collapse ALL nested submenus
|
|
1100
|
+
const collapseAllNested = (parentContent) => {
|
|
1101
|
+
const childSections = parentContent.querySelectorAll('.nav-title.collapsible');
|
|
1102
|
+
childSections.forEach(childTitle => {
|
|
1103
|
+
const childTargetId = childTitle.getAttribute('data-target');
|
|
1104
|
+
const childContent = document.getElementById(childTargetId);
|
|
1105
|
+
if (childContent) {
|
|
1106
|
+
childTitle.classList.remove('expanded');
|
|
1107
|
+
childContent.classList.add('collapsed');
|
|
1108
|
+
// Recursively collapse any nested children
|
|
1109
|
+
collapseAllNested(childContent);
|
|
1110
|
+
}
|
|
1111
|
+
});
|
|
1112
|
+
};
|
|
1113
|
+
|
|
1114
|
+
// Collapse all nested content
|
|
1115
|
+
collapseAllNested(content);
|
|
1109
1116
|
} else {
|
|
1110
1117
|
// Expand this section
|
|
1111
1118
|
title.classList.add('expanded');
|
package/lib/core-builder.js
CHANGED
|
@@ -1196,6 +1196,7 @@ async function scanAllFiles(dir, baseDir = dir, options = {}) {
|
|
|
1196
1196
|
const markdownFiles = [];
|
|
1197
1197
|
const attachmentFiles = [];
|
|
1198
1198
|
const attachmentTypes = options.attachmentTypes || [];
|
|
1199
|
+
const excludeDirs = options.excludeDirs || [];
|
|
1199
1200
|
const items = await fs.readdir(dir);
|
|
1200
1201
|
|
|
1201
1202
|
for (const item of items) {
|
|
@@ -1208,6 +1209,11 @@ async function scanAllFiles(dir, baseDir = dir, options = {}) {
|
|
|
1208
1209
|
const fullPath = path.join(dir, item);
|
|
1209
1210
|
const stat = await fs.stat(fullPath);
|
|
1210
1211
|
|
|
1212
|
+
// Skip excluded directories (output dirs, node_modules, .git, etc.)
|
|
1213
|
+
if (stat.isDirectory() && excludeDirs.includes(item)) {
|
|
1214
|
+
continue;
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1211
1217
|
// Skip private directories if excludePrivate is true
|
|
1212
1218
|
if (stat.isDirectory() && options.excludePrivate && item === 'private') {
|
|
1213
1219
|
continue;
|
|
@@ -1345,8 +1351,17 @@ async function buildDocumentation(config) {
|
|
|
1345
1351
|
'.mp4', '.mp3', '.wav', '.avi', '.mov'
|
|
1346
1352
|
];
|
|
1347
1353
|
|
|
1354
|
+
// Auto-exclude output directories and common non-doc directories
|
|
1355
|
+
const excludeDirs = [
|
|
1356
|
+
path.basename(config.outputDir),
|
|
1357
|
+
path.basename(config.staticOutputDir || 'html-static'),
|
|
1358
|
+
'node_modules',
|
|
1359
|
+
'.git'
|
|
1360
|
+
];
|
|
1361
|
+
|
|
1348
1362
|
const { markdownFiles: files, attachmentFiles } = await scanAllFiles(docsDir, docsDir, {
|
|
1349
|
-
attachmentTypes: config.features?.attachments !== false ? attachmentTypes : []
|
|
1363
|
+
attachmentTypes: config.features?.attachments !== false ? attachmentTypes : [],
|
|
1364
|
+
excludeDirs
|
|
1350
1365
|
});
|
|
1351
1366
|
|
|
1352
1367
|
console.log(chalk.green(`✅ Found ${files.length} markdown files${readmeGenerated ? ' (including auto-generated README)' : ''}`));
|