@litodocs/cli 1.3.0 → 1.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@litodocs/cli",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "description": "Beautiful documentation sites from Markdown. Fast, simple, and open-source.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -477,6 +477,36 @@ ${footerImport}
477
477
  import { getConfigFile } from '../utils/config';
478
478
 
479
479
  const config = await getConfigFile();
480
+
481
+ // Font configuration
482
+ const fonts = config.branding?.fonts;
483
+ const headingFont = fonts?.heading || 'Inter';
484
+ const bodyFont = fonts?.body || 'Inter';
485
+ const codeFont = fonts?.code || 'Fira Code';
486
+
487
+ const fontFamilies = [];
488
+ if (bodyFont === 'Inter') {
489
+ fontFamilies.push('Inter:opsz,wght@14..32,400..700');
490
+ } else {
491
+ fontFamilies.push(bodyFont.replace(/ /g, '+') + ':wght@400;500;600;700');
492
+ }
493
+ if (headingFont !== bodyFont) {
494
+ fontFamilies.push(headingFont.replace(/ /g, '+') + ':wght@600;700;800');
495
+ }
496
+ fontFamilies.push(codeFont.replace(/ /g, '+') + ':wght@400;500;600');
497
+ const googleFontsUrl = 'https://fonts.googleapis.com/css2?' + fontFamilies.map(f => 'family=' + f).join('&') + '&display=swap';
498
+
499
+ const fontOverrides = [];
500
+ if (bodyFont !== 'Inter') {
501
+ fontOverrides.push("--font-sans: '" + bodyFont + "', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif !important;");
502
+ }
503
+ if (headingFont !== 'Inter') {
504
+ fontOverrides.push("--font-heading: '" + headingFont + "', '" + bodyFont + "', system-ui, sans-serif !important;");
505
+ }
506
+ if (codeFont !== 'Fira Code') {
507
+ fontOverrides.push("--font-mono: '" + codeFont + "', 'JetBrains Mono', 'SF Mono', Monaco, Consolas, monospace !important;");
508
+ }
509
+ const fontOverrideStyle = fontOverrides.length > 0 ? ':root { ' + fontOverrides.join(' ') + ' }' : '';
480
510
  ---
481
511
 
482
512
  <!doctype html>
@@ -489,7 +519,8 @@ const config = await getConfigFile();
489
519
  <link rel="icon" href={config.branding?.favicon || '/favicon.svg'} />
490
520
  <link rel="preconnect" href="https://fonts.googleapis.com" />
491
521
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
492
- <link href="https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,400..700&family=Fira+Code:wght@400;500;600&display=swap" rel="stylesheet" />
522
+ <link href={googleFontsUrl} rel="stylesheet" />
523
+ {fontOverrideStyle && <style set:html={fontOverrideStyle} />}
493
524
  <script is:inline>
494
525
  const savedTheme = localStorage.getItem('theme');
495
526
  const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
@@ -837,6 +868,36 @@ ${footerImport}
837
868
  import { getConfigFile } from '../utils/config';
838
869
 
839
870
  const config = await getConfigFile();
871
+
872
+ // Font configuration
873
+ const fonts = config.branding?.fonts;
874
+ const headingFont = fonts?.heading || 'Inter';
875
+ const bodyFont = fonts?.body || 'Inter';
876
+ const codeFont = fonts?.code || 'Fira Code';
877
+
878
+ const fontFamilies = [];
879
+ if (bodyFont === 'Inter') {
880
+ fontFamilies.push('Inter:opsz,wght@14..32,400..700');
881
+ } else {
882
+ fontFamilies.push(bodyFont.replace(/ /g, '+') + ':wght@400;500;600;700');
883
+ }
884
+ if (headingFont !== bodyFont) {
885
+ fontFamilies.push(headingFont.replace(/ /g, '+') + ':wght@600;700;800');
886
+ }
887
+ fontFamilies.push(codeFont.replace(/ /g, '+') + ':wght@400;500;600');
888
+ const googleFontsUrl = 'https://fonts.googleapis.com/css2?' + fontFamilies.map(f => 'family=' + f).join('&') + '&display=swap';
889
+
890
+ const fontOverrides = [];
891
+ if (bodyFont !== 'Inter') {
892
+ fontOverrides.push("--font-sans: '" + bodyFont + "', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif !important;");
893
+ }
894
+ if (headingFont !== 'Inter') {
895
+ fontOverrides.push("--font-heading: '" + headingFont + "', '" + bodyFont + "', system-ui, sans-serif !important;");
896
+ }
897
+ if (codeFont !== 'Fira Code') {
898
+ fontOverrides.push("--font-mono: '" + codeFont + "', 'JetBrains Mono', 'SF Mono', Monaco, Consolas, monospace !important;");
899
+ }
900
+ const fontOverrideStyle = fontOverrides.length > 0 ? ':root { ' + fontOverrides.join(' ') + ' }' : '';
840
901
  ---
841
902
 
842
903
  <!doctype html>
@@ -848,7 +909,8 @@ const config = await getConfigFile();
848
909
  <link rel="icon" href={config.branding?.favicon || '/favicon.svg'} />
849
910
  <link rel="preconnect" href="https://fonts.googleapis.com" />
850
911
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
851
- <link href="https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,400..700&display=swap" rel="stylesheet" />
912
+ <link href={googleFontsUrl} rel="stylesheet" />
913
+ {fontOverrideStyle && <style set:html={fontOverrideStyle} />}
852
914
  <script is:inline>
853
915
  const savedTheme = localStorage.getItem('theme');
854
916
  const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
@@ -49,6 +49,19 @@
49
49
  "href": {
50
50
  "type": "string",
51
51
  "description": "Link when clicking the logo"
52
+ },
53
+ "height": {
54
+ "type": "number",
55
+ "description": "Logo height in pixels"
56
+ },
57
+ "alt": {
58
+ "type": "string",
59
+ "description": "Alt text for the logo image (defaults to metadata.name)"
60
+ },
61
+ "replacesTitle": {
62
+ "type": "boolean",
63
+ "default": true,
64
+ "description": "When true, logo replaces site title text. When false, both are shown."
52
65
  }
53
66
  }
54
67
  },