@knowcode/doc-builder 1.7.0 ā 1.7.2
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/cli.js +59 -0
- package/lib/emoji-mapper.js +4 -4
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -1443,6 +1443,65 @@ This comprehensive guide ensures consistent, high-quality documentation that is
|
|
|
1443
1443
|
}
|
|
1444
1444
|
});
|
|
1445
1445
|
|
|
1446
|
+
// Add custom help command that shows settings
|
|
1447
|
+
program
|
|
1448
|
+
.command('settings')
|
|
1449
|
+
.description('Show current tool settings and configuration')
|
|
1450
|
+
.option('-c, --config <path>', 'path to config file (default: doc-builder.config.js)')
|
|
1451
|
+
.action(async (options) => {
|
|
1452
|
+
console.log(chalk.cyan('\nš Current Tool Settings\n'));
|
|
1453
|
+
|
|
1454
|
+
try {
|
|
1455
|
+
// Load configuration
|
|
1456
|
+
const config = await loadConfig(options.config || 'doc-builder.config.js', {});
|
|
1457
|
+
|
|
1458
|
+
// Display settings in a readable format
|
|
1459
|
+
console.log(chalk.yellow('š Directories:'));
|
|
1460
|
+
console.log(` ⢠Documentation source: ${chalk.green(config.docsDir || 'docs')}`);
|
|
1461
|
+
console.log(` ⢠HTML output: ${chalk.green(config.outputDir || 'html')}`);
|
|
1462
|
+
|
|
1463
|
+
console.log(chalk.yellow('\nš Site Information:'));
|
|
1464
|
+
console.log(` ⢠Site name: ${chalk.green(config.siteName || 'Documentation')}`);
|
|
1465
|
+
console.log(` ⢠Description: ${chalk.green(config.siteDescription || 'Documentation site')}`);
|
|
1466
|
+
console.log(` ⢠Favicon: ${chalk.green(config.favicon || 'āØ')}`);
|
|
1467
|
+
|
|
1468
|
+
console.log(chalk.yellow('\n⨠Features:'));
|
|
1469
|
+
console.log(` ⢠Authentication: ${config.features?.authentication ? chalk.green('Enabled') : chalk.gray('Disabled')}`);
|
|
1470
|
+
console.log(` ⢠Dark mode: ${config.features?.darkMode !== false ? chalk.green('Enabled') : chalk.gray('Disabled')}`);
|
|
1471
|
+
console.log(` ⢠Mermaid diagrams: ${config.features?.mermaid !== false ? chalk.green('Enabled') : chalk.gray('Disabled')}`);
|
|
1472
|
+
console.log(` ⢠Changelog: ${config.features?.changelog !== false ? chalk.green('Enabled') : chalk.gray('Disabled')}`);
|
|
1473
|
+
console.log(` ⢠Phosphor icons: ${config.features?.phosphorIcons !== false ? chalk.green('Enabled') : chalk.gray('Disabled')}`);
|
|
1474
|
+
console.log(` ⢠Title normalization: ${config.features?.normalizeTitle !== false ? chalk.green('Enabled') : chalk.gray('Disabled')}`);
|
|
1475
|
+
console.log(` ⢠PDF download: ${config.features?.showPdfDownload !== false ? chalk.green('Shown') : chalk.gray('Hidden')}`);
|
|
1476
|
+
console.log(` ⢠Menu default: ${config.features?.menuDefaultOpen !== false ? chalk.green('Open') : chalk.gray('Closed')}`);
|
|
1477
|
+
|
|
1478
|
+
if (config.features?.authentication) {
|
|
1479
|
+
console.log(chalk.yellow('\nš Authentication:'));
|
|
1480
|
+
console.log(` ⢠Username: ${chalk.green(config.auth?.username || 'admin')}`);
|
|
1481
|
+
console.log(` ⢠Password: ${chalk.gray('***' + (config.auth?.password?.slice(-2) || '**'))}`);
|
|
1482
|
+
}
|
|
1483
|
+
|
|
1484
|
+
if (config.seo?.enabled) {
|
|
1485
|
+
console.log(chalk.yellow('\nš SEO:'));
|
|
1486
|
+
console.log(` ⢠Site URL: ${chalk.green(config.seo.siteUrl || 'Not configured')}`);
|
|
1487
|
+
console.log(` ⢠Author: ${chalk.green(config.seo.author || 'Not set')}`);
|
|
1488
|
+
console.log(` ⢠Keywords: ${chalk.green((config.seo.keywords || []).join(', ') || 'None')}`);
|
|
1489
|
+
}
|
|
1490
|
+
|
|
1491
|
+
console.log(chalk.gray('\nš” Tip: Use doc-builder build --help to see CLI options'));
|
|
1492
|
+
|
|
1493
|
+
} catch (error) {
|
|
1494
|
+
console.error(chalk.red('Error loading configuration:'), error.message);
|
|
1495
|
+
}
|
|
1496
|
+
});
|
|
1497
|
+
|
|
1498
|
+
// Update the help text to mention the settings command
|
|
1499
|
+
program.addHelpText('after', `
|
|
1500
|
+
${chalk.cyan('š View Settings:')}
|
|
1501
|
+
${chalk.gray('$')} doc-builder settings ${chalk.gray('# Show current configuration')}
|
|
1502
|
+
${chalk.gray('$')} doc-builder settings --config custom.js ${chalk.gray('# Show specific config file')}
|
|
1503
|
+
`);
|
|
1504
|
+
|
|
1446
1505
|
// Parse arguments
|
|
1447
1506
|
program.parse(process.argv);
|
|
1448
1507
|
|
package/lib/emoji-mapper.js
CHANGED
|
@@ -231,8 +231,8 @@ const emojiToPhosphor = {
|
|
|
231
231
|
* @returns {string} - HTML with emojis replaced by icons
|
|
232
232
|
*/
|
|
233
233
|
function replaceEmojisWithIcons(html, config = {}) {
|
|
234
|
-
// Check if feature is enabled
|
|
235
|
-
if (
|
|
234
|
+
// Check if feature is enabled - default to true if not explicitly set to false
|
|
235
|
+
if (config.features?.phosphorIcons === false) return html;
|
|
236
236
|
|
|
237
237
|
// First, protect code blocks and inline code from emoji replacement
|
|
238
238
|
const codeBlocks = [];
|
|
@@ -256,12 +256,12 @@ function replaceEmojisWithIcons(html, config = {}) {
|
|
|
256
256
|
);
|
|
257
257
|
|
|
258
258
|
// Get weight class if custom weight is specified
|
|
259
|
-
const weightClass = config.features
|
|
259
|
+
const weightClass = config.features?.phosphorWeight && config.features.phosphorWeight !== 'regular'
|
|
260
260
|
? `ph-${config.features.phosphorWeight}`
|
|
261
261
|
: 'ph';
|
|
262
262
|
|
|
263
263
|
// Apply size styling if configured
|
|
264
|
-
const sizeStyle = config.features
|
|
264
|
+
const sizeStyle = config.features?.phosphorSize
|
|
265
265
|
? ` style="font-size: ${config.features.phosphorSize}"`
|
|
266
266
|
: '';
|
|
267
267
|
|