@knowcode/doc-builder 1.9.9 → 1.9.11

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.
@@ -64,6 +64,27 @@ function escapeHtml(text) {
64
64
  return text.replace(/[&<>"']/g, m => map[m]);
65
65
  }
66
66
 
67
+ // Helper function to smartly capitalize text while preserving existing capitalization
68
+ function smartCapitalize(text) {
69
+ if (!text) return text;
70
+
71
+ return text
72
+ .replace(/[-_]/g, ' ') // Replace hyphens and underscores with spaces
73
+ .split(' ')
74
+ .map(word => {
75
+ if (!word) return word;
76
+
77
+ // If word has any uppercase letters (like "AI", "API", "iPhone"), preserve it
78
+ if (/[A-Z]/.test(word)) {
79
+ return word;
80
+ }
81
+
82
+ // If word is all lowercase, capitalize first letter
83
+ return word.charAt(0).toUpperCase() + word.slice(1);
84
+ })
85
+ .join(' ');
86
+ }
87
+
67
88
  // Detect document status from content and front matter
68
89
  function detectDocumentStatus(content, frontMatter = {}) {
69
90
  // Check front matter first
@@ -650,9 +671,9 @@ function buildNavigationStructure(files, currentFile, config = {}) {
650
671
 
651
672
  // Clean up title by removing common prefixes and improving formatting
652
673
  title = title
653
- .replace(/^(bubble|system|quickbase|middleware|product-roadmap)-?/, '')
654
- .replace(/-/g, ' ')
655
- .replace(/\b\w/g, l => l.toUpperCase());
674
+ .replace(/^(bubble|system|quickbase|middleware|product-roadmap)-?/, '');
675
+
676
+ title = smartCapitalize(title);
656
677
 
657
678
  return title;
658
679
  };
@@ -687,7 +708,7 @@ function buildNavigationStructure(files, currentFile, config = {}) {
687
708
  };
688
709
 
689
710
  const displayName = folderName === 'root' ? 'Documentation' :
690
- folderName.replace(/-/g, ' ').replace(/\b\w/g, l => l.toUpperCase());
711
+ smartCapitalize(folderName);
691
712
  const icon = icons[folderName] || 'ph ph-folder';
692
713
 
693
714
  if (!folderData.files.length && !Object.keys(folderData.folders).length) {
@@ -803,7 +824,7 @@ function buildNavigationStructure(files, currentFile, config = {}) {
803
824
  if (contentDivEnd !== -1) {
804
825
  let additionalFiles = '';
805
826
  otherRootFiles.forEach(file => {
806
- const title = file.displayName.replace(/[-_]/g, ' ').replace(/\b\w/g, l => l.toUpperCase());
827
+ const title = smartCapitalize(file.displayName);
807
828
  let isActive = '';
808
829
  if (currentFile === file.urlPath) {
809
830
  isActive = ' active';
@@ -878,9 +899,7 @@ async function getAllMarkdownFiles(dir, baseDir = dir) {
878
899
  } else if (item.endsWith('.md') && !item.startsWith('_')) {
879
900
  const relativePath = path.relative(baseDir, fullPath);
880
901
  const urlPath = relativePath.replace(/\.md$/, '.html').replace(/\\/g, '/');
881
- const displayName = path.basename(item, '.md')
882
- .replace(/[-_]/g, ' ')
883
- .replace(/\b\w/g, l => l.toUpperCase());
902
+ const displayName = smartCapitalize(path.basename(item, '.md'));
884
903
 
885
904
  // Read file to extract summary and status
886
905
  const rawContent = await fs.readFile(fullPath, 'utf-8');
@@ -1166,6 +1185,7 @@ async function buildDocumentation(config) {
1166
1185
 
1167
1186
  const attachmentTypes = config.attachmentTypes || [
1168
1187
  '.pdf', '.doc', '.docx', '.xls', '.xlsx', '.csv', '.ppt', '.pptx', '.txt', '.rtf',
1188
+ '.html', '.htm',
1169
1189
  '.zip', '.tar', '.gz', '.7z', '.rar',
1170
1190
  '.png', '.jpg', '.jpeg', '.gif', '.svg', '.webp', '.ico', '.bmp',
1171
1191
  '.json', '.xml', '.yaml', '.yml', '.toml',
@@ -12,6 +12,7 @@ const emojiToPhosphor = {
12
12
  '❓': '<i class="ph ph-question" aria-label="question"></i>',
13
13
  '❗': '<i class="ph ph-warning" aria-label="warning"></i>',
14
14
  '⚠️': '<i class="ph ph-warning-circle" aria-label="warning"></i>',
15
+ '⚖️': '<i class="ph ph-scales" aria-label="balance"></i>',
15
16
  '⛔': '<i class="ph ph-prohibit" aria-label="prohibited"></i>',
16
17
  '🚫': '<i class="ph ph-prohibit-inset" aria-label="not allowed"></i>',
17
18
  '🚨': '<i class="ph ph-siren" aria-label="alert"></i>',
@@ -46,6 +47,7 @@ const emojiToPhosphor = {
46
47
  '📁': '<i class="ph ph-folder" aria-label="folder"></i>',
47
48
  '📂': '<i class="ph ph-folder-open" aria-label="open folder"></i>',
48
49
  '🗂️': '<i class="ph ph-folders" aria-label="folders"></i>',
50
+ '🗃️': '<i class="ph ph-archive" aria-label="archive"></i>',
49
51
  '📚': '<i class="ph ph-books" aria-label="documentation"></i>',
50
52
  '📖': '<i class="ph ph-book-open" aria-label="reading"></i>',
51
53
  '📕': '<i class="ph ph-book" aria-label="book"></i>',
@@ -208,6 +210,7 @@ const emojiToPhosphor = {
208
210
  '➕': '<i class="ph ph-plus" aria-label="add"></i>',
209
211
  '➖': '<i class="ph ph-minus" aria-label="remove"></i>',
210
212
  '✖️': '<i class="ph ph-x" aria-label="close"></i>',
213
+ '🗑️': '<i class="ph ph-trash" aria-label="delete"></i>',
211
214
  '♻️': '<i class="ph ph-recycle" aria-label="recycle"></i>',
212
215
  '❤️': '<i class="ph ph-heart" aria-label="love"></i>',
213
216
  '💔': '<i class="ph ph-heart-break" aria-label="broken heart"></i>',
package/lib/seo.js CHANGED
@@ -128,6 +128,8 @@ function generateMetaTags(options) {
128
128
  const tags = [];
129
129
 
130
130
  // Basic meta tags
131
+ tags.push(` <meta name="generator" content="@knowcode/doc-builder by Knowcode Ltd">`);
132
+
131
133
  if (author) {
132
134
  tags.push(` <meta name="author" content="${escapeHtml(author)}">`);
133
135
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knowcode/doc-builder",
3
- "version": "1.9.9",
3
+ "version": "1.9.11",
4
4
  "description": "Reusable documentation builder for markdown-based sites with Vercel deployment support",
5
5
  "main": "index.js",
6
6
  "bin": {