@mgks/docmd 0.1.0

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.
Files changed (54) hide show
  1. package/.gitattributes +2 -0
  2. package/.github/FUNDING.yml +15 -0
  3. package/.github/workflows/deploy-docmd.yml +45 -0
  4. package/.github/workflows/publish.yml +84 -0
  5. package/LICENSE +21 -0
  6. package/README.md +83 -0
  7. package/bin/docmd.js +63 -0
  8. package/config.js +137 -0
  9. package/docs/cli-commands.md +87 -0
  10. package/docs/configuration.md +166 -0
  11. package/docs/contributing.md +86 -0
  12. package/docs/deployment.md +129 -0
  13. package/docs/getting-started/basic-usage.md +88 -0
  14. package/docs/getting-started/index.md +21 -0
  15. package/docs/getting-started/installation.md +75 -0
  16. package/docs/index.md +56 -0
  17. package/docs/plugins/analytics.md +76 -0
  18. package/docs/plugins/index.md +71 -0
  19. package/docs/plugins/seo.md +79 -0
  20. package/docs/plugins/sitemap.md +88 -0
  21. package/docs/theming/available-themes.md +85 -0
  22. package/docs/theming/custom-css-js.md +84 -0
  23. package/docs/theming/icons.md +93 -0
  24. package/docs/theming/index.md +19 -0
  25. package/docs/theming/light-dark-mode.md +107 -0
  26. package/docs/writing-content/custom-containers.md +129 -0
  27. package/docs/writing-content/frontmatter.md +76 -0
  28. package/docs/writing-content/index.md +17 -0
  29. package/docs/writing-content/markdown-syntax.md +277 -0
  30. package/package.json +56 -0
  31. package/src/assets/css/highlight-dark.css +1 -0
  32. package/src/assets/css/highlight-light.css +1 -0
  33. package/src/assets/css/main.css +562 -0
  34. package/src/assets/css/theme-sky.css +499 -0
  35. package/src/assets/css/toc.css +76 -0
  36. package/src/assets/favicon.ico +0 -0
  37. package/src/assets/images/docmd-logo.png +0 -0
  38. package/src/assets/images/docmd-preview.png +0 -0
  39. package/src/assets/images/logo-dark.png +0 -0
  40. package/src/assets/images/logo-light.png +0 -0
  41. package/src/assets/js/theme-toggle.js +59 -0
  42. package/src/commands/build.js +300 -0
  43. package/src/commands/dev.js +182 -0
  44. package/src/commands/init.js +51 -0
  45. package/src/core/config-loader.js +28 -0
  46. package/src/core/file-processor.js +376 -0
  47. package/src/core/html-generator.js +139 -0
  48. package/src/core/icon-renderer.js +105 -0
  49. package/src/plugins/analytics.js +44 -0
  50. package/src/plugins/seo.js +65 -0
  51. package/src/plugins/sitemap.js +100 -0
  52. package/src/templates/layout.ejs +174 -0
  53. package/src/templates/navigation.ejs +107 -0
  54. package/src/templates/toc.ejs +34 -0
@@ -0,0 +1,499 @@
1
+ /* theme-sky.css - Sky theme for docmd inspired by Mintlify */
2
+
3
+ :root [data-theme="light"] {
4
+ /* Font family */
5
+ --font-family-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
6
+ --font-family-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
7
+
8
+ /* Color palette */
9
+ --sky-primary: #0097ff;
10
+ --sky-primary-light: #e5f4ff;
11
+ --sky-primary-dark: #0078cc;
12
+ --sky-text: #1a1f36;
13
+ --sky-text-light: #4a5568;
14
+ --sky-text-lightest: #718096;
15
+ --sky-background: #ffffff;
16
+ --sky-background-alt: #f9fafb;
17
+ --sky-border: #e2e8f0;
18
+ --sky-border-light: #edf2f7;
19
+
20
+ /* Apply colors to CSS variables */
21
+ --bg-color: var(--sky-background);
22
+ --text-color: var(--sky-text);
23
+ --sidebar-bg: #f7fafc;
24
+ --sidebar-text: var(--sky-text-light);
25
+ --sidebar-link-active-bg: #e5f4ff;
26
+ --sidebar-link-active-text: var(--sky-primary);
27
+ --link-color: var(--sky-primary);
28
+ --border-color: var(--sky-border);
29
+ --code-bg: var(--sky-primary-light);
30
+ --code-text: var(--sky-primary-dark);
31
+ --header-bg: var(--sky-background);
32
+ --header-border: var(--sky-border);
33
+
34
+ /* Box shadows */
35
+ --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
36
+ --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
37
+ --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
38
+ }
39
+
40
+ /* Dark mode */
41
+ :root [data-theme="dark"] {
42
+ /* Color palette dark */
43
+ --sky-primary: #3b82f6;
44
+ --sky-primary-light: #1e293b;
45
+ --sky-primary-dark: #60a5fa;
46
+ --sky-text: #f1f5f9;
47
+ --sky-text-light: #cbd5e1;
48
+ --sky-text-lightest: #94a3b8;
49
+ --sky-background: #0f172a;
50
+ --sky-background-alt: #1e293b;
51
+ --sky-border: #334155;
52
+ --sky-border-light: #1e293b;
53
+
54
+ /* Apply colors to CSS variables */
55
+ --bg-color: var(--sky-background);
56
+ --text-color: var(--sky-text);
57
+ --sidebar-bg: #0f172a;
58
+ --sidebar-text: var(--sky-text-light);
59
+ --sidebar-link-active-bg: #1e293b;
60
+ --sidebar-link-active-text: var(--sky-primary);
61
+ --link-color: var(--sky-primary);
62
+ --border-color: var(--sky-border);
63
+ --code-bg: var(--sky-primary-light);
64
+ --code-text: var(--sky-text);
65
+ --header-bg: var(--sky-background);
66
+ --header-border: var(--sky-border);
67
+
68
+ /* Box shadows for dark mode */
69
+ --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
70
+ --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
71
+ --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
72
+ }
73
+
74
+ /* Apply theme styles */
75
+
76
+ /* Typography improvements */
77
+ body {
78
+ font-feature-settings: "salt", "ss01", "ss02";
79
+ letter-spacing: -0.01em;
80
+ }
81
+
82
+ h1, h2, h3, h4, h5, h6 {
83
+ font-weight: 600;
84
+ line-height: 1.3;
85
+ margin-top: 2em;
86
+ margin-bottom: 0.5em;
87
+ color: var(--sky-text);
88
+ }
89
+
90
+ h1 {
91
+ font-size: 2.25rem;
92
+ font-weight: 700;
93
+ margin-top: 0;
94
+ }
95
+
96
+ h2 {
97
+ font-size: 1.75rem;
98
+ border-bottom: 1px solid var(--sky-border-light);
99
+ padding-bottom: 0.5rem;
100
+ }
101
+
102
+ h3 {
103
+ font-size: 1.5rem;
104
+ }
105
+
106
+ h4 {
107
+ font-size: 1.25rem;
108
+ }
109
+
110
+ a {
111
+ color: var(--link-color);
112
+ text-decoration: none;
113
+ transition: color 0.2s ease;
114
+ }
115
+
116
+ a:hover {
117
+ text-decoration: underline;
118
+ }
119
+
120
+ p {
121
+ margin: .5em 0;
122
+ padding: .5em 0;
123
+ line-height: 1.7;
124
+
125
+ }
126
+
127
+ /* Sidebar refinements */
128
+ .sidebar {
129
+ box-shadow: var(--shadow-sm);
130
+ }
131
+
132
+ .sidebar nav li a {
133
+ border-radius: 6px;
134
+ margin-bottom: 2px;
135
+ transition: all 0.2s ease;
136
+ }
137
+
138
+ .sidebar nav li a:hover {
139
+ background-color: var(--sidebar-link-active-bg);
140
+ color: var(--sidebar-link-active-text);
141
+ }
142
+
143
+ .sidebar nav li a.active {
144
+ background-color: var(--sidebar-link-active-bg);
145
+ color: var(--sidebar-link-active-text);
146
+ font-weight: 500;
147
+ }
148
+
149
+ /* Content area */
150
+ .content-area {
151
+ padding: 2.5rem 5%;
152
+
153
+ }
154
+
155
+ /* Code blocks */
156
+ pre {
157
+ background-color: var(--code-bg);
158
+ border-radius: 8px;
159
+ margin: 1.5em 0;
160
+ padding: 1.25em;
161
+ box-shadow: var(--shadow-sm);
162
+ }
163
+
164
+ code {
165
+ font-size: 0.9em;
166
+ border-radius: 4px;
167
+ padding: 0.2em 0.4em;
168
+ }
169
+
170
+ /* Tables */
171
+ table {
172
+ width: 100%;
173
+ border-collapse: separate;
174
+ border-spacing: 0;
175
+ margin: 1.5em 0;
176
+ border-radius: 8px;
177
+ overflow: hidden;
178
+ box-shadow: var(--shadow-sm);
179
+ }
180
+
181
+ th {
182
+ background-color: var(--sky-background-alt);
183
+ text-align: left;
184
+ font-weight: 600;
185
+ padding: 0.75rem 1rem;
186
+ }
187
+
188
+ td {
189
+ padding: 0.75rem 1rem;
190
+ border-top: 1px solid var(--sky-border-light);
191
+ }
192
+
193
+ tr:hover {
194
+ background-color: var(--sky-background-alt);
195
+ }
196
+
197
+ /* Custom container styling for Sky theme */
198
+ .docmd-container {
199
+ padding: .5rem 1.5rem;
200
+ margin: 1.75rem 0;
201
+ border-radius: 10px;
202
+ border: 1px solid var(--sky-border-light);
203
+ background-color: var(--sky-background);
204
+ box-shadow: var(--shadow-sm);
205
+
206
+ }
207
+
208
+ /* Callouts */
209
+ .callout {
210
+ position: relative;
211
+ border: none;
212
+ border-left: 5px solid;
213
+ background-color: var(--card-bg);
214
+
215
+ }
216
+
217
+ .callout-title {
218
+ font-weight: 600;
219
+ margin-bottom: 0.75em;
220
+ display: flex;
221
+ align-items: center;
222
+ }
223
+
224
+ .callout-title::before {
225
+ margin-right: 0.5rem;
226
+ font-size: 1.1em;
227
+ }
228
+
229
+ .callout-info {
230
+ border-left-color: var(--sky-primary);
231
+ }
232
+
233
+ .callout-info .callout-title::before {
234
+ content: "ℹ️";
235
+ }
236
+
237
+ .callout-warning {
238
+ border-left-color: #f59e0b;
239
+ }
240
+
241
+ .callout-warning .callout-title::before {
242
+ content: "⚠️";
243
+ }
244
+
245
+ .callout-tip {
246
+ border-left-color: #10b981;
247
+ }
248
+
249
+ .callout-tip .callout-title::before {
250
+ content: "💡";
251
+ }
252
+
253
+ .callout-danger {
254
+ border-left-color: #ef4444;
255
+ }
256
+
257
+ .callout-danger .callout-title::before {
258
+ content: "🚨";
259
+ }
260
+
261
+ .callout-success {
262
+ border-left-color: #10b981;
263
+ }
264
+
265
+ .callout-success .callout-title::before {
266
+ content: "✅";
267
+ }
268
+
269
+ /* Cards */
270
+ .card {
271
+ border: 1px solid var(--sky-border);
272
+ background-color: var(--card-bg);
273
+ box-shadow: var(--text-color);
274
+ transition: transform 0.2s ease, box-shadow 0.2s ease;
275
+ overflow: hidden;
276
+ display: flex;
277
+ flex-direction: column;
278
+
279
+ }
280
+
281
+ .card:hover {
282
+ transform: translateY(-2px);
283
+ box-shadow: var(--shadow-lg);
284
+ }
285
+
286
+ .card .card-title {
287
+ padding: .5rem 1.5rem 1rem;
288
+ border-bottom: 1px solid var(--sky-border);
289
+ font-weight: 600;
290
+ margin-top: 0;
291
+
292
+ }
293
+
294
+ .card .card-content {
295
+ flex: 1;
296
+ padding: .25rem;
297
+
298
+ }
299
+
300
+ .card .card-content > *:first-child {
301
+ margin-top: 0;
302
+ }
303
+
304
+ .card .card-content > *:last-child {
305
+ margin-bottom: 0;
306
+ }
307
+
308
+ /* Steps - Mintlify-inspired connected style */
309
+ .steps {
310
+ counter-reset: step-counter;
311
+ border: none;
312
+ background-color: transparent;
313
+ box-shadow: none;
314
+ padding: 0;
315
+ position: relative;
316
+ margin-left: 1rem;
317
+ }
318
+
319
+ /* The vertical line connecting steps */
320
+ .steps::before {
321
+ content: '';
322
+ position: absolute;
323
+ top: 0;
324
+ bottom: 0;
325
+ left: .5rem;
326
+ width: 2px;
327
+ background-color: var(--sky-border);
328
+ transform: translateX(-50%);
329
+ z-index: 0;
330
+
331
+ }
332
+
333
+ .steps .step {
334
+ position: relative;
335
+ padding: .5rem 2.5em;
336
+ border-radius: 10px;
337
+ margin-bottom: 1em;
338
+ display: block;
339
+ background-color: var(--card-bg);
340
+
341
+ }
342
+
343
+ .steps .step:last-child {
344
+ padding-bottom: 0;
345
+ }
346
+
347
+ /* Fix step headers */
348
+ .steps h4,
349
+ .steps ol li:first-child,
350
+ .steps ol li strong:first-child {
351
+ position: relative;
352
+ counter-increment: step-counter;
353
+ margin-bottom: 1rem;
354
+ font-weight: 600;
355
+ font-size: 1.1rem;
356
+ display: block;
357
+
358
+ }
359
+
360
+ .steps h4::before,
361
+ .steps ol li::before {
362
+ content: counter(step-counter);
363
+ position: absolute;
364
+ left: -2.5rem;
365
+ top: 0;
366
+ width: 2rem;
367
+ height: 2rem;
368
+ background-color: var(--sky-primary);
369
+ color: white;
370
+ border-radius: 50%;
371
+ display: flex;
372
+ align-items: center;
373
+ justify-content: center;
374
+ font-size: 0.9rem;
375
+ font-weight: 600;
376
+ z-index: 1;
377
+ }
378
+
379
+ /* Step content container */
380
+ .step-content {
381
+ display: block;
382
+ margin-top: 0.5rem;
383
+ margin-bottom: 1rem;
384
+ }
385
+
386
+ .step-content > p,
387
+ .step-content > div,
388
+ .step-content > pre {
389
+ display: block;
390
+ margin-top: 0.5rem;
391
+ margin-bottom: 1rem;
392
+ }
393
+
394
+ /* Additional styling for ordered lists in steps */
395
+ .steps ol {
396
+ list-style: none;
397
+ padding-left: 0;
398
+ margin-left: 0;
399
+ display: block;
400
+ }
401
+
402
+ .steps ol li {
403
+ position: relative;
404
+ margin-bottom: 1rem;
405
+ display: block;
406
+ }
407
+
408
+ /* Ensure the step number appears correctly */
409
+ .steps .step h4 {
410
+ display: block;
411
+ font-weight: 600;
412
+ margin-bottom: 1rem;
413
+ }
414
+
415
+ /* Ensure content after the heading appears properly */
416
+ .steps .step > p,
417
+ .steps .step > div,
418
+ .steps .step > pre {
419
+ display: block;
420
+
421
+ }
422
+
423
+ /* Fix for numerical steps in ordered lists */
424
+ .steps .step ol {
425
+ counter-reset: none;
426
+ list-style: decimal;
427
+ padding-left: 1.5rem;
428
+ margin-top: 0.5rem;
429
+ display: block;
430
+ }
431
+
432
+ .steps .step ol li {
433
+ padding-left: 0;
434
+ margin-bottom: 0.5rem;
435
+ display: list-item;
436
+ }
437
+
438
+ /* Remove the pseudo-element from nested list items */
439
+ .steps .step ol li::before {
440
+ display: none;
441
+ }
442
+
443
+ .steps pre {
444
+ margin-top: 1rem;
445
+ margin-bottom: 1rem;
446
+
447
+ }
448
+
449
+ .steps ol + * {
450
+ margin-top: 1rem;
451
+
452
+ }
453
+
454
+ /* Buttons */
455
+ button, .button {
456
+ padding: 0.5rem 1rem;
457
+ background-color: var(--sky-primary);
458
+ color: white;
459
+ border: none;
460
+ border-radius: 6px;
461
+ font-weight: 500;
462
+ cursor: pointer;
463
+ transition: background-color 0.2s ease;
464
+ }
465
+
466
+ button:hover, .button:hover {
467
+ background-color: var(--sky-primary-dark);
468
+ }
469
+
470
+ /* Theme toggle improvements */
471
+ .theme-toggle-button {
472
+ background-color: var(--sky-background-alt);
473
+ border-color: var(--sky-border-light);
474
+ border-radius: 6px;
475
+ transition: all 0.2s ease;
476
+ }
477
+
478
+ .theme-toggle-button:hover {
479
+ background-color: var(--sky-primary-light);
480
+ }
481
+
482
+ /* Mobile responsiveness improvements */
483
+ @media (max-width: 768px) {
484
+ .content-area {
485
+ padding: 1.5rem 1rem;
486
+ }
487
+
488
+ h1 {
489
+ font-size: 1.75rem;
490
+ }
491
+
492
+ h2 {
493
+ font-size: 1.5rem;
494
+ }
495
+
496
+ h3 {
497
+ font-size: 1.25rem;
498
+ }
499
+ }
@@ -0,0 +1,76 @@
1
+ /* TOC Styles - Simplified Hyperlink Style */
2
+ .toc-container {
3
+ margin: 0;
4
+ padding: 0;
5
+ border: none;
6
+ background-color: transparent;
7
+ }
8
+
9
+ .toc-title {
10
+ margin-top: 0;
11
+ margin-bottom: 0.5rem;
12
+ font-size: 1rem;
13
+ font-weight: bold;
14
+ color: var(--text-muted);
15
+
16
+ }
17
+
18
+ .toc-list {
19
+ list-style: none;
20
+ padding-left: 0;
21
+ margin: 0;
22
+ }
23
+
24
+ .toc-item {
25
+ margin-bottom: 0.25rem;
26
+ line-height: 1.4;
27
+ }
28
+
29
+ .toc-link {
30
+ text-decoration: none;
31
+ color: var(--link-color);
32
+ display: inline-block;
33
+ padding: 0.1rem 0;
34
+ font-size: 0.9rem;
35
+ font-weight: 500;
36
+
37
+ }
38
+
39
+ .toc-link:hover {
40
+ text-decoration: underline;
41
+ }
42
+
43
+ /* Indentation for different heading levels */
44
+ .toc-level-2 {
45
+ margin-left: 0;
46
+ }
47
+
48
+ .toc-level-3 {
49
+ margin-left: 0.75rem;
50
+ font-size: 0.85rem;
51
+ }
52
+
53
+ .toc-level-4 {
54
+ margin-left: 1.5rem;
55
+ font-size: 0.8rem;
56
+ }
57
+
58
+ /* TOC sidebar should only display on active pages */
59
+ .toc-sidebar {
60
+ width: 180px;
61
+ position: sticky;
62
+ top: 2rem;
63
+ max-height: calc(100vh - 4rem);
64
+ overflow-y: auto;
65
+ align-self: flex-start;
66
+
67
+ }
68
+
69
+ /* Hide TOC on mobile */
70
+ @media (max-width: 1024px) {
71
+ .toc-sidebar {
72
+ width: 100%;
73
+ position: static;
74
+ margin-bottom: 1rem;
75
+ }
76
+ }
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,59 @@
1
+ // src/assets/js/theme-toggle.js
2
+ function applyTheme(theme, isInitialLoad = false) {
3
+ document.body.setAttribute('data-theme', theme);
4
+ if (!isInitialLoad) {
5
+ localStorage.setItem('docmd-theme', theme);
6
+ }
7
+
8
+ // Change highlight.js theme dynamically (if separate themes are loaded)
9
+ const highlightThemeLink = document.getElementById('highlight-theme');
10
+ if (highlightThemeLink) {
11
+ const isDark = theme.includes('dark');
12
+ const isLight = theme.includes('light');
13
+ const currentHref = highlightThemeLink.href;
14
+
15
+ if (isDark && currentHref.includes('highlight-light.css')) {
16
+ highlightThemeLink.href = currentHref.replace('highlight-light.css', 'highlight-dark.css');
17
+ } else if (isLight && currentHref.includes('highlight-dark.css')) {
18
+ highlightThemeLink.href = currentHref.replace('highlight-dark.css', 'highlight-light.css');
19
+ }
20
+ }
21
+ }
22
+
23
+ function getInitialTheme() {
24
+ const storedTheme = localStorage.getItem('docmd-theme');
25
+ if (storedTheme) {
26
+ return storedTheme;
27
+ }
28
+ // The server sets the initial data-theme based on config.theme.defaultMode.
29
+ // We respect localStorage first, then what the server provided.
30
+ // Optionally, could check prefers-color-scheme if neither is set, but defaultMode covers this.
31
+ return document.body.getAttribute('data-theme') || 'light';
32
+ }
33
+
34
+ document.addEventListener('DOMContentLoaded', () => {
35
+ // Apply initial theme (respecting localStorage over server-rendered if set)
36
+ const initialTheme = getInitialTheme();
37
+ applyTheme(initialTheme, true); // true indicates it's the initial load
38
+
39
+ const themeToggleButton = document.getElementById('theme-toggle-button');
40
+ if (themeToggleButton) {
41
+ themeToggleButton.addEventListener('click', () => {
42
+ let currentTheme = document.body.getAttribute('data-theme');
43
+
44
+ // Handle both regular themes and sky theme variants
45
+ let newTheme;
46
+ if (currentTheme === 'light') {
47
+ newTheme = 'dark';
48
+ } else if (currentTheme === 'dark') {
49
+ newTheme = 'light';
50
+ } else if (currentTheme === 'sky-light') {
51
+ newTheme = 'sky-dark';
52
+ } else if (currentTheme === 'sky-dark') {
53
+ newTheme = 'sky-light';
54
+ }
55
+
56
+ applyTheme(newTheme); // isInitialLoad is false here, so it saves to localStorage
57
+ });
58
+ }
59
+ });