@mgks/docmd 0.2.8 → 0.3.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.
- package/README.md +3 -1
- package/assets/images/preview-dark-welcome.png +0 -0
- package/config.js +139 -161
- package/docs/comparison.md +5 -0
- package/docs/configuration.md +35 -1
- package/docs/content/markdown-syntax.md +32 -0
- package/docs/content/search.md +68 -0
- package/docs/contributing.md +8 -0
- package/docs/overview.md +1 -0
- package/package.json +7 -2
- package/src/assets/css/docmd-main.css +681 -341
- package/src/assets/css/docmd-theme-retro.css +860 -1
- package/src/assets/css/docmd-theme-ruby.css +621 -1
- package/src/assets/css/docmd-theme-sky.css +610 -1
- package/src/assets/js/docmd-image-lightbox.js +13 -13
- package/src/assets/js/docmd-main.js +24 -23
- package/src/assets/js/docmd-mermaid.js +32 -30
- package/src/assets/js/docmd-search.js +212 -0
- package/src/commands/build.js +195 -41
- package/src/commands/init.js +15 -0
- package/src/core/file-processor.js +12 -1
- package/src/core/html-generator.js +23 -0
- package/src/core/markdown/setup.js +27 -11
- package/src/templates/layout.ejs +55 -3
package/README.md
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
<br>
|
|
29
29
|
|
|
30
30
|
<p align="center">
|
|
31
|
-
<img width="2856" height="1558" alt="519536477-8d948e18-8e2d-420d-8902-96e1aafab1ba-modified" src="https://
|
|
31
|
+
<img width="2856" height="1558" alt="519536477-8d948e18-8e2d-420d-8902-96e1aafab1ba-modified" src="https://docmd.mgks.dev/assets/images/preview-dark-welcome.png" />
|
|
32
32
|
<sup><i>docmd noStyle page preview in dark mode</i></sup>
|
|
33
33
|
</p>
|
|
34
34
|
|
|
@@ -39,6 +39,7 @@ Most documentation tools today are too heavy (React hydration, massive bundles)
|
|
|
39
39
|
**docmd** fills the gap. It is a native Node.js tool that generates **pure, static HTML**.
|
|
40
40
|
|
|
41
41
|
* ⚡ **Blazing Fast:** No hydration delay. Instant page loads.
|
|
42
|
+
* 🔍 **Offline Search:** Powerful full-text search included automatically.
|
|
42
43
|
* 🛠 **Zero Config:** Works out of the box with sensible defaults.
|
|
43
44
|
* 🎨 **Theming:** Built-in light/dark modes and multiple themes (`sky`, `ruby`, `retro`).
|
|
44
45
|
* 📦 **Node.js Native:** No Python, no Gemfiles. Just `npm install`.
|
|
@@ -92,6 +93,7 @@ Live reload is active. Browser will refresh automatically when files change.
|
|
|
92
93
|
| **Markdown First** | Standard Markdown + Frontmatter. No proprietary syntax to learn. |
|
|
93
94
|
| **Smart CLI** | Intelligent config validation catches typos before they break your build. |
|
|
94
95
|
| **Custom Containers** | Use `::: callout`, `::: card`, `::: steps`, `::: tabs`, `::: collapsible`, `::: changelog`, and more to enrich content. |
|
|
96
|
+
| **Smart Search** | Built-in, offline-capable full-text search with fuzzy matching and highlighting. No API keys required. |
|
|
95
97
|
| **Diagrams** | Create flowcharts, relationship diagrams, journey, piecharts, graphs, timelines and more with Mermaid. |
|
|
96
98
|
| **No-Style Pages** | Create custom landing pages (highly customizable custom HTML pages) without theme constraints. |
|
|
97
99
|
| **Auto Dark Mode** | Respects system preference and saves user choice. |
|
|
Binary file
|
package/config.js
CHANGED
|
@@ -1,197 +1,175 @@
|
|
|
1
1
|
// Source file from the docmd project — https://github.com/mgks/docmd
|
|
2
2
|
|
|
3
|
-
// Configuration for the docmd project's own documentation
|
|
4
3
|
module.exports = {
|
|
5
|
-
// Core
|
|
4
|
+
// --- Core Metadata ---
|
|
6
5
|
siteTitle: 'docmd',
|
|
7
|
-
|
|
8
|
-
// No trailing slash
|
|
9
|
-
siteUrl: 'https://docmd.mgks.dev', // Replace with your actual deployed URL
|
|
6
|
+
siteUrl: 'https://docmd.mgks.dev', // No trailing slash
|
|
10
7
|
|
|
11
|
-
//
|
|
8
|
+
// --- Branding ---
|
|
12
9
|
logo: {
|
|
13
|
-
light: '/assets/images/docmd-logo-light.png',
|
|
14
|
-
dark: '/assets/images/docmd-logo-dark.png',
|
|
15
|
-
alt: 'docmd Logo',
|
|
16
|
-
href: '/',
|
|
10
|
+
light: '/assets/images/docmd-logo-light.png',
|
|
11
|
+
dark: '/assets/images/docmd-logo-dark.png',
|
|
12
|
+
alt: 'docmd Logo',
|
|
13
|
+
href: '/',
|
|
17
14
|
},
|
|
15
|
+
favicon: '/assets/favicon.ico',
|
|
16
|
+
|
|
17
|
+
// --- Structure ---
|
|
18
|
+
srcDir: 'docs', // Source markdown files directory
|
|
19
|
+
outputDir: 'site', // Output directory for generated site
|
|
18
20
|
|
|
19
|
-
//
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
// --- Features & UX ---
|
|
22
|
+
search: true, // Built-in offline search
|
|
23
|
+
minify: true, // Production build optimization
|
|
24
|
+
autoTitleFromH1: true, // Auto-generate title from first H1 if frontmatter title is missing
|
|
25
|
+
copyCode: true, // Enable "copy to clipboard" on code blocks
|
|
26
|
+
pageNavigation: true, // Next/Prev links
|
|
22
27
|
|
|
23
|
-
// Sidebar
|
|
28
|
+
// --- Sidebar & Theme ---
|
|
24
29
|
sidebar: {
|
|
25
|
-
collapsible: true,
|
|
26
|
-
defaultCollapsed: false,
|
|
30
|
+
collapsible: true,
|
|
31
|
+
defaultCollapsed: false,
|
|
27
32
|
},
|
|
28
|
-
|
|
29
|
-
// Theme Configuration
|
|
30
33
|
theme: {
|
|
31
|
-
name: 'sky',
|
|
32
|
-
defaultMode: 'light', //
|
|
33
|
-
enableModeToggle: true, // Show
|
|
34
|
-
positionMode: 'top', // 'top' or 'bottom'
|
|
35
|
-
codeHighlight: true,
|
|
36
|
-
customCss: [
|
|
37
|
-
// '/assets/css/custom.css', // Custom TOC styles
|
|
38
|
-
],
|
|
34
|
+
name: 'sky', // 'default', 'sky', 'ruby', 'retro'
|
|
35
|
+
defaultMode: 'light', // 'light' or 'dark'
|
|
36
|
+
enableModeToggle: true, // Show theme mode toggle button
|
|
37
|
+
positionMode: 'top', // 'top' or 'bottom' of header
|
|
38
|
+
codeHighlight: true, // Enable code syntax highlighting
|
|
39
|
+
customCss: [], // Add paths relative to outputDir here
|
|
39
40
|
},
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
customJs: [ // Array of paths to custom JS files, loaded at end of body
|
|
43
|
-
'/assets/js/docmd-image-lightbox.js', // Image lightbox functionality
|
|
41
|
+
customJs: [
|
|
42
|
+
'/assets/js/docmd-image-lightbox.js',
|
|
44
43
|
],
|
|
45
44
|
|
|
46
|
-
//
|
|
47
|
-
autoTitleFromH1: true, // Set to true to automatically use the first H1 as page title
|
|
48
|
-
copyCode: true, // Enable/disable the copy code button on code blocks
|
|
49
|
-
|
|
50
|
-
// Plugins Configuration (Object format)
|
|
51
|
-
// Plugins are configured here. docmd will look for these keys.
|
|
45
|
+
// --- Plugins ---
|
|
52
46
|
plugins: {
|
|
53
|
-
// SEO Plugin Configuration
|
|
54
|
-
// These are site-wide fallbacks. For detailed per-page SEO controls,
|
|
55
|
-
// including structured data (LD+JSON), use the `seo` key in your page's frontmatter.
|
|
56
|
-
// See the SEO plugin documentation for all available frontmatter options.
|
|
57
47
|
seo: {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
openGraph: { // For Facebook, LinkedIn, etc.
|
|
61
|
-
// siteName: 'docmd Documentation', // Optional, defaults to config.siteTitle
|
|
62
|
-
// Default image for `og:image` if not specified in page frontmatter
|
|
63
|
-
// Path relative to outputDir root
|
|
48
|
+
defaultDescription: 'The minimalist, zero-config documentation generator for Node.js developers.',
|
|
49
|
+
openGraph: {
|
|
64
50
|
defaultImage: '/assets/images/docmd-preview.png',
|
|
65
51
|
},
|
|
66
|
-
twitter: {
|
|
67
|
-
cardType: 'summary_large_image',
|
|
68
|
-
// siteUsername: '@docmd_handle', // Your site's Twitter handle (optional)
|
|
69
|
-
// creatorUsername: '@your_handle', // Default author handle (optional, can be overridden in frontmatter)
|
|
52
|
+
twitter: {
|
|
53
|
+
cardType: 'summary_large_image',
|
|
70
54
|
}
|
|
71
55
|
},
|
|
72
|
-
// Analytics Plugin Configuration
|
|
73
56
|
analytics: {
|
|
74
|
-
// Google Analytics 4 (GA4)
|
|
75
57
|
googleV4: {
|
|
76
|
-
measurementId: 'G-8QVBDQ4KM1'
|
|
77
|
-
}
|
|
78
|
-
// Google Universal Analytics (UA) - Legacy (optional)
|
|
79
|
-
// googleUA: {
|
|
80
|
-
// trackingId: 'UA-XXXXXXXXX-Y' // Replace with your actual UA Tracking ID
|
|
81
|
-
// }
|
|
58
|
+
measurementId: 'G-8QVBDQ4KM1'
|
|
59
|
+
}
|
|
82
60
|
},
|
|
83
|
-
// Enable Sitemap plugin
|
|
84
61
|
sitemap: {
|
|
85
62
|
defaultChangefreq: 'weekly',
|
|
86
63
|
defaultPriority: 0.8
|
|
87
64
|
}
|
|
88
|
-
// Add other future plugin configurations here by their key
|
|
89
65
|
},
|
|
90
66
|
|
|
91
|
-
//
|
|
92
|
-
|
|
67
|
+
// --- Doc Source Link ---
|
|
68
|
+
editLink: {
|
|
69
|
+
enabled: true,
|
|
70
|
+
baseUrl: 'https://github.com/mgks/docmd/edit/main/docs',
|
|
71
|
+
text: 'Edit this page on GitHub'
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
// --- Navigation ---
|
|
93
75
|
navigation: [
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
// { title: 'Support the Project', path: 'https://github.com/sponsors/mgks', icon: 'heart', external: true },
|
|
97
|
-
{
|
|
98
|
-
title: 'Getting Started',
|
|
99
|
-
icon: 'rocket',
|
|
100
|
-
path: '/getting-started/',
|
|
101
|
-
children: [
|
|
102
|
-
{ title: 'Installation', path: '/getting-started/installation', icon: 'download' },
|
|
103
|
-
{ title: 'Basic Usage', path: '/getting-started/basic-usage', icon: 'play' },
|
|
104
|
-
],
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
title: 'Content',
|
|
108
|
-
icon: 'layout-template',
|
|
109
|
-
path: '/content/',
|
|
110
|
-
collapsible: true,
|
|
111
|
-
children: [
|
|
112
|
-
{ title: 'Frontmatter', path: '/content/frontmatter', icon: 'file-text' },
|
|
113
|
-
{ title: 'Markdown Syntax', path: '/content/markdown-syntax', icon: 'code-2' },
|
|
114
|
-
{ title: 'Images', path: '/content/images', icon: 'image' },
|
|
115
|
-
{ title: 'Mermaid Diagrams', path: '/content/mermaid', icon: 'network' },
|
|
116
|
-
{
|
|
117
|
-
title: 'Custom Containers',
|
|
118
|
-
path: '/content/containers/',
|
|
119
|
-
icon: 'box',
|
|
120
|
-
collapsible: true,
|
|
121
|
-
children: [
|
|
122
|
-
{ title: 'Callouts', path: '/content/containers/callouts', icon: 'megaphone' },
|
|
123
|
-
{ title: 'Cards', path: '/content/containers/cards', icon: 'panel-top' },
|
|
124
|
-
{ title: 'Steps', path: '/content/containers/steps', icon: 'list-ordered' },
|
|
125
|
-
{ title: 'Tabs', path: '/content/containers/tabs', icon: 'columns-3' },
|
|
126
|
-
{ title: 'Collapsible', path: '/content/containers/collapsible', icon: 'chevrons-down' },
|
|
127
|
-
{ title: 'Changelogs', path: '/content/containers/changelogs', icon: 'logs' },
|
|
128
|
-
{ title: 'Buttons', path: '/content/containers/buttons', icon: 'mouse-pointer-click' },
|
|
129
|
-
{ title: 'Nested Containers', path: '/content/containers/nested-containers', icon: 'folder-tree' },
|
|
130
|
-
]
|
|
131
|
-
},
|
|
132
|
-
{ title: 'No-Style Pages', path: '/content/no-style-pages', icon: 'layout' },
|
|
133
|
-
{ title: 'No-Style Example', path: '/content/no-style-example', icon: 'sparkles' },
|
|
134
|
-
],
|
|
135
|
-
},
|
|
136
|
-
{ title: 'Configuration', path: '/configuration', icon: 'settings' },
|
|
137
|
-
{
|
|
138
|
-
title: 'Theming',
|
|
139
|
-
icon: 'palette',
|
|
140
|
-
path: '/theming/',
|
|
141
|
-
collapsible: true,
|
|
142
|
-
children: [
|
|
143
|
-
{ title: 'Available Themes', path: '/theming/available-themes', icon: 'layout-grid' },
|
|
144
|
-
{ title: 'Light & Dark Mode', path: '/theming/light-dark-mode', icon: 'sun-moon' },
|
|
145
|
-
{ title: 'Custom CSS & JS', path: '/theming/custom-css-js', icon: 'file-code' },
|
|
146
|
-
{ title: 'Icons', path: '/theming/icons', icon: 'pencil-ruler' },
|
|
147
|
-
],
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
title: 'Plugins',
|
|
151
|
-
icon: 'puzzle',
|
|
152
|
-
path: '/plugins/',
|
|
153
|
-
collapsible: true,
|
|
154
|
-
children: [
|
|
155
|
-
{ title: 'SEO & Meta Tags', path: '/plugins/seo', icon: 'search' },
|
|
156
|
-
{ title: 'Analytics', path: '/plugins/analytics', icon: 'bar-chart' },
|
|
157
|
-
{ title: 'Sitemap', path: '/plugins/sitemap', icon: 'map' },
|
|
158
|
-
],
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
title: 'Recipes',
|
|
162
|
-
icon: 'chef-hat',
|
|
163
|
-
path: '/recipes/',
|
|
164
|
-
collapsible: true,
|
|
165
|
-
children: [
|
|
166
|
-
{ title: 'Landing Page', path: '/recipes/landing-page', icon: 'panel-top' },
|
|
167
|
-
{ title: 'Custom Fonts', path: '/recipes/custom-fonts', icon: 'type-outline' },
|
|
168
|
-
{ title: 'Favicon', path: '/recipes/favicon', icon: 'circle-dashed' },
|
|
169
|
-
],
|
|
170
|
-
},
|
|
171
|
-
{ title: 'CLI Commands', path: '/cli-commands', icon: 'terminal' },
|
|
172
|
-
{ title: 'Deployment', path: '/deployment', icon: 'upload-cloud' },
|
|
173
|
-
{ title: 'Contributing', path: '/contributing', icon: 'users-2' },
|
|
174
|
-
{ title: 'Comparison', path: '/comparison', icon: 'shapes' },
|
|
175
|
-
|
|
176
|
-
{ title: 'GitHub', path: 'https://github.com/mgks/docmd', icon: 'github', external: true },
|
|
177
|
-
{ title: 'Discussions', path: 'https://github.com/mgks/docmd/discussions', icon: 'message-square', external: true },
|
|
178
|
-
{ title: 'Issues', path: 'https://github.com/mgks/docmd/issues', icon: 'badge-alert', external: true }
|
|
179
|
-
],
|
|
76
|
+
{ title: 'Welcome', path: '/', icon: 'feather' },
|
|
77
|
+
{ title: 'Overview', path: '/overview', icon: 'home' },
|
|
180
78
|
|
|
181
|
-
|
|
79
|
+
{
|
|
80
|
+
title: 'Getting Started',
|
|
81
|
+
icon: 'rocket',
|
|
82
|
+
path: '/getting-started/',
|
|
83
|
+
children: [
|
|
84
|
+
{ title: 'Installation', path: '/getting-started/installation', icon: 'download' },
|
|
85
|
+
{ title: 'Basic Usage', path: '/getting-started/basic-usage', icon: 'play' },
|
|
86
|
+
],
|
|
87
|
+
},
|
|
182
88
|
|
|
183
|
-
|
|
184
|
-
sponsor: {
|
|
185
|
-
enabled: true, // Enable/disable the sponsor ribbon
|
|
186
|
-
title: 'Sponsor', // Text to display on the ribbon
|
|
187
|
-
link: 'https://github.com/sponsors/mgks', // URL for the sponsor link
|
|
188
|
-
},
|
|
89
|
+
{ title: 'Configuration', path: '/configuration', icon: 'settings' },
|
|
189
90
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
91
|
+
{
|
|
92
|
+
title: 'Content',
|
|
93
|
+
icon: 'layout-template',
|
|
94
|
+
path: '/content/',
|
|
95
|
+
collapsible: true,
|
|
96
|
+
children: [
|
|
97
|
+
{ title: 'Markdown Syntax', path: '/content/markdown-syntax', icon: 'code-2' },
|
|
98
|
+
{ title: 'Frontmatter', path: '/content/frontmatter', icon: 'file-text' },
|
|
99
|
+
{ title: 'Images & Lightbox', path: '/content/images', icon: 'image' },
|
|
100
|
+
{ title: 'Search', path: '/content/search', icon: 'search' },
|
|
101
|
+
{ title: 'Mermaid Diagrams', path: '/content/mermaid', icon: 'network' },
|
|
102
|
+
{
|
|
103
|
+
title: 'Containers',
|
|
104
|
+
path: '/content/containers/',
|
|
105
|
+
icon: 'box',
|
|
106
|
+
collapsible: true,
|
|
107
|
+
children: [
|
|
108
|
+
{ title: 'Callouts', path: '/content/containers/callouts', icon: 'megaphone' },
|
|
109
|
+
{ title: 'Cards', path: '/content/containers/cards', icon: 'panel-top' },
|
|
110
|
+
{ title: 'Steps', path: '/content/containers/steps', icon: 'list-ordered' },
|
|
111
|
+
{ title: 'Tabs', path: '/content/containers/tabs', icon: 'columns-3' },
|
|
112
|
+
{ title: 'Collapsible', path: '/content/containers/collapsible', icon: 'chevrons-down' },
|
|
113
|
+
{ title: 'Changelogs', path: '/content/containers/changelogs', icon: 'history' },
|
|
114
|
+
{ title: 'Buttons', path: '/content/containers/buttons', icon: 'mouse-pointer-click' },
|
|
115
|
+
{ title: 'Nested Containers', path: '/content/containers/nested-containers', icon: 'folder-tree' },
|
|
116
|
+
]
|
|
117
|
+
},
|
|
118
|
+
{ title: 'No-Style Pages', path: '/content/no-style-pages', icon: 'layout' },
|
|
119
|
+
],
|
|
120
|
+
},
|
|
193
121
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
122
|
+
{
|
|
123
|
+
title: 'Theming',
|
|
124
|
+
icon: 'palette',
|
|
125
|
+
path: '/theming/',
|
|
126
|
+
collapsible: true,
|
|
127
|
+
children: [
|
|
128
|
+
{ title: 'Available Themes', path: '/theming/available-themes', icon: 'layout-grid' },
|
|
129
|
+
{ title: 'Light & Dark Mode', path: '/theming/light-dark-mode', icon: 'sun-moon' },
|
|
130
|
+
{ title: 'Custom CSS & JS', path: '/theming/custom-css-js', icon: 'file-code' },
|
|
131
|
+
{ title: 'Icons', path: '/theming/icons', icon: 'pencil-ruler' },
|
|
132
|
+
],
|
|
133
|
+
},
|
|
134
|
+
|
|
135
|
+
{
|
|
136
|
+
title: 'Plugins',
|
|
137
|
+
icon: 'puzzle',
|
|
138
|
+
path: '/plugins/',
|
|
139
|
+
collapsible: true,
|
|
140
|
+
children: [
|
|
141
|
+
{ title: 'SEO & Meta', path: '/plugins/seo', icon: 'search' },
|
|
142
|
+
{ title: 'Analytics', path: '/plugins/analytics', icon: 'bar-chart' },
|
|
143
|
+
{ title: 'Sitemap', path: '/plugins/sitemap', icon: 'map' },
|
|
144
|
+
],
|
|
145
|
+
},
|
|
146
|
+
|
|
147
|
+
{
|
|
148
|
+
title: 'Recipes',
|
|
149
|
+
icon: 'chef-hat',
|
|
150
|
+
path: '/recipes/',
|
|
151
|
+
collapsible: true,
|
|
152
|
+
children: [
|
|
153
|
+
{ title: 'Landing Page', path: '/recipes/landing-page', icon: 'layout-template' },
|
|
154
|
+
{ title: 'Custom Fonts', path: '/recipes/custom-fonts', icon: 'type' },
|
|
155
|
+
{ title: 'Favicon', path: '/recipes/favicon', icon: 'image-plus' },
|
|
156
|
+
],
|
|
157
|
+
},
|
|
158
|
+
|
|
159
|
+
{ title: 'CLI Commands', path: '/cli-commands', icon: 'terminal' },
|
|
160
|
+
{ title: 'Deployment', path: '/deployment', icon: 'upload-cloud' },
|
|
161
|
+
{ title: 'Comparison', path: '/comparison', icon: 'scale' },
|
|
162
|
+
{ title: 'Contributing', path: '/contributing', icon: 'git-pull-request' },
|
|
163
|
+
|
|
164
|
+
{ title: 'GitHub', path: 'https://github.com/mgks/docmd', icon: 'github', external: true },
|
|
165
|
+
{ title: 'Discussions', path: 'https://github.com/mgks/docmd/discussions', icon: 'message-circle', external: true },
|
|
166
|
+
],
|
|
167
|
+
|
|
168
|
+
// --- Footer & Sponsor ---
|
|
169
|
+
footer: '© ' + new Date().getFullYear() + ' Project docmd.',
|
|
170
|
+
sponsor: {
|
|
171
|
+
enabled: true,
|
|
172
|
+
title: 'Sponsor',
|
|
173
|
+
link: 'https://github.com/sponsors/mgks',
|
|
174
|
+
},
|
|
197
175
|
};
|
package/docs/comparison.md
CHANGED
|
@@ -16,12 +16,17 @@ Choosing the right tool depends on your specific needs. `docmd` was built to fil
|
|
|
16
16
|
| **Setup Time** | ~2 minutes | ~15 minutes | ~10 mins (Python env) | Instant (SaaS) | Instant |
|
|
17
17
|
| **Client JS Size** | **Tiny (< 15kb)** | Heavy (React Bundle) | Minimal | Medium | Medium |
|
|
18
18
|
| **Customization** | Standard CSS/JS | React Components | Python/Jinja2 | JSON Config | Vue/Plugins |
|
|
19
|
+
| **Search** | **Built-in (Offline)** | Algolia (Requires Setup) | Built-in (Lunr) | Built-in | Client-side Plugin |
|
|
19
20
|
| **SEO** | **Excellent** | Excellent | Excellent | Excellent | **Poor** |
|
|
20
21
|
| **Hosting** | **Anywhere** | Anywhere | Anywhere | **Vendor Locked** | Anywhere |
|
|
21
22
|
| **Cost** | **100% Free OSS** | 100% Free OSS | 100% Free OSS | Freemium | 100% Free OSS |
|
|
22
23
|
|
|
23
24
|
## Detailed Breakdown
|
|
24
25
|
|
|
26
|
+
### The Search Advantage
|
|
27
|
+
* **Docusaurus and others** rely on 3rd party services like Algolia and others. This is great for enterprise scale, but for most projects, it's a hassle. You have to apply for an account, manage API keys, and configure crawlers.
|
|
28
|
+
* **docmd** includes a production-grade search engine out of the box. It generates a local index during the build. This means your documentation is **searchable even offline** (perfect for Intranets or air-gapped networks) and respects user privacy completely.
|
|
29
|
+
|
|
25
30
|
### vs. Docusaurus
|
|
26
31
|
**Docusaurus** is the gold standard for large-scale React projects (like Meta's own docs).
|
|
27
32
|
* **Choose Docusaurus if:** You need to embed complex React components inside your markdown, need versioning *today*, or are building a massive site with thousands of pages.
|
package/docs/configuration.md
CHANGED
|
@@ -22,6 +22,8 @@ module.exports = {
|
|
|
22
22
|
srcDir: 'docs',
|
|
23
23
|
outputDir: 'site',
|
|
24
24
|
|
|
25
|
+
search: true,
|
|
26
|
+
|
|
25
27
|
sidebar: {
|
|
26
28
|
collapsible: true,
|
|
27
29
|
defaultCollapsed: false,
|
|
@@ -125,6 +127,18 @@ module.exports = {
|
|
|
125
127
|
* **Default:** `'site'`
|
|
126
128
|
* **Description:** Directory where the static site will be generated.
|
|
127
129
|
|
|
130
|
+
### `search`
|
|
131
|
+
* **Type:** `Boolean`
|
|
132
|
+
* **Default:** `true`
|
|
133
|
+
* **Description:** Controls the visibility of the full-text search bar in the header and the generation of the search index. Set to `false` to disable search capabilities entirely.
|
|
134
|
+
|
|
135
|
+
## `minify`
|
|
136
|
+
* **Type:** `Boolean`
|
|
137
|
+
* **Optional**
|
|
138
|
+
* **Default:** `true` when running `docmd build`, `false` when running `docmd dev`.
|
|
139
|
+
* **Description:** Controls whether CSS and JavaScript assets are minified (compressed) during the build.
|
|
140
|
+
* **Usage:** You can force this to `false` if you need to debug production builds.
|
|
141
|
+
|
|
128
142
|
### `autoTitleFromH1`
|
|
129
143
|
* **Type:** `Boolean`
|
|
130
144
|
* **Default:** `true`
|
|
@@ -145,7 +159,9 @@ module.exports = {
|
|
|
145
159
|
### `copyCode`
|
|
146
160
|
* **Type:** `Boolean`
|
|
147
161
|
* **Default:** `true`
|
|
148
|
-
* **Description:** If `true`, a "Copy" button will be added to the top-right corner of all code blocks, allowing users to easily copy the code to their clipboard with a single click.
|
|
162
|
+
* **Description:** If `true`, a "Copy" button will be added to the top-right corner of all code blocks, allowing users to easily copy the code to their clipboard with a single click.
|
|
163
|
+
|
|
164
|
+
**Note:** This setting only applies to regular pages. For noStyle pages, copy code functionality must be explicitly enabled via the `components.mainScripts: true` setting.
|
|
149
165
|
|
|
150
166
|
## `sidebar` (Object)
|
|
151
167
|
|
|
@@ -218,6 +234,24 @@ Configures the visual theme of your site.
|
|
|
218
234
|
* `sitemap: { defaultChangefreq: 'weekly', defaultPriority: 0.8 }`
|
|
219
235
|
* **See Also:** [Plugins](/plugins/)
|
|
220
236
|
|
|
237
|
+
## `editLink` (Object, Optional)
|
|
238
|
+
* **Type:** `Object`
|
|
239
|
+
* **Description:** Configures a link in the page footer that points to the source file on GitHub (or GitLab/Bitbucket), allowing users to propose changes.
|
|
240
|
+
* **Properties:**
|
|
241
|
+
* `enabled` (Boolean): Set to `true` to show the link.
|
|
242
|
+
* `baseUrl` (String): The base URL to your repository's documentation source folder.
|
|
243
|
+
* *GitHub Example:* `https://github.com/USERNAME/REPO/edit/main/docs`
|
|
244
|
+
* *Note:* Do not include a trailing slash. `docmd` appends the file path automatically.
|
|
245
|
+
* `text` (String, Optional): The text to display. Defaults to "Edit this page".
|
|
246
|
+
* **Example:**
|
|
247
|
+
```javascript
|
|
248
|
+
editLink: {
|
|
249
|
+
enabled: true,
|
|
250
|
+
baseUrl: 'https://github.com/mgks/docmd/edit/main/docs',
|
|
251
|
+
text: 'Edit on GitHub'
|
|
252
|
+
}
|
|
253
|
+
```
|
|
254
|
+
|
|
221
255
|
## `navigation` (Array of Objects)
|
|
222
256
|
* **Description:** Defines the sidebar navigation. (Content mostly same as before, but add the `icon` property explanation).
|
|
223
257
|
* **Navigation Item Properties:**
|
|
@@ -197,6 +197,38 @@ docmd supports GitHub Flavored Markdown extensions including:
|
|
|
197
197
|
|
|
198
198
|
Renders emoji symbols like: I ❤️ documentation! 🚀 😄
|
|
199
199
|
|
|
200
|
+
## Custom Attributes (IDs and Classes)
|
|
201
|
+
|
|
202
|
+
You can add custom IDs and CSS classes to headers, images, and links using curly braces `{}`.
|
|
203
|
+
|
|
204
|
+
### Custom IDs
|
|
205
|
+
By default, `docmd` generates IDs for headers automatically. You can override this:
|
|
206
|
+
|
|
207
|
+
```markdown
|
|
208
|
+
## My Header {#custom-id}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### Custom Classes
|
|
212
|
+
Add styling classes to elements:
|
|
213
|
+
|
|
214
|
+
```markdown
|
|
215
|
+
## Styled Header {.text-center .text-red}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Links and Buttons
|
|
219
|
+
Create buttons using standard links and classes:
|
|
220
|
+
|
|
221
|
+
```markdown
|
|
222
|
+
[Download Now](/download){.btn .btn-primary}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Images
|
|
226
|
+
Control image styling directly:
|
|
227
|
+
|
|
228
|
+
```markdown
|
|
229
|
+
{width="100%" .shadow-lg}
|
|
230
|
+
```
|
|
231
|
+
|
|
200
232
|
## Footnotes
|
|
201
233
|
|
|
202
234
|
You can add footnotes to your content for references or additional information[^1].
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Full-Text Search"
|
|
3
|
+
description: "How to use and configure the built-in, offline-capable search engine in docmd."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Full-Text Search
|
|
7
|
+
|
|
8
|
+
`docmd` comes with a powerful, built-in full-text search engine. It requires **zero configuration**, works completely **offline**, and provides instant results with keyword highlighting.
|
|
9
|
+
|
|
10
|
+
## How It Works
|
|
11
|
+
|
|
12
|
+
Unlike other documentation tools that rely on external services (like Algolia) or heavy server-side indexing, `docmd` takes a modern, lightweight approach:
|
|
13
|
+
|
|
14
|
+
1. **Build Time:** During `docmd build`, the system scans all your markdown files. It strips HTML tags, extracts headings, and compiles a highly optimized `search-index.json`.
|
|
15
|
+
2. **Client Side:** When a user visits your site, a lightweight search library (MiniSearch) is loaded.
|
|
16
|
+
3. **Instant Querying:** Searching happens entirely in the user's browser. There is no network latency, no API limits, and no tracking.
|
|
17
|
+
|
|
18
|
+
## Features
|
|
19
|
+
|
|
20
|
+
* **Fuzzy Matching:** Finds results even if there are typos (e.g., "installation" matches "instalation").
|
|
21
|
+
* **Smart Snippets:** Shows the exact context of the keyword in the search results, with the matching terms highlighted.
|
|
22
|
+
* **Keyboard Navigation:** Full support for `ArrowUp`, `ArrowDown`, and `Enter`.
|
|
23
|
+
* **Shortcuts:** Press `Cmd + K` (Mac) or `Ctrl + K` (Windows/Linux) to open anywhere.
|
|
24
|
+
* **Offline Capable:** Once the page loads, search works without an internet connection.
|
|
25
|
+
|
|
26
|
+
## Configuration
|
|
27
|
+
|
|
28
|
+
Search is **enabled by default**. You don't need to do anything to get started.
|
|
29
|
+
|
|
30
|
+
### Disabling Search
|
|
31
|
+
If you prefer to hide the search bar, set `search: false` in your config:
|
|
32
|
+
|
|
33
|
+
```javascript
|
|
34
|
+
// docmd.config.js
|
|
35
|
+
module.exports = {
|
|
36
|
+
// ...
|
|
37
|
+
search: false,
|
|
38
|
+
// ...
|
|
39
|
+
};
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Excluding Pages
|
|
43
|
+
Sometimes you have utility pages or draft content you don't want appearing in search results. You can exclude specific pages using frontmatter:
|
|
44
|
+
|
|
45
|
+
```yaml
|
|
46
|
+
---
|
|
47
|
+
title: "Private Draft"
|
|
48
|
+
noindex: true
|
|
49
|
+
---
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Using `noindex: true` does two things:
|
|
53
|
+
1. Removes the page from the internal **Search Index**.
|
|
54
|
+
2. Adds a `<meta name="robots" content="noindex">` tag to prevent Google/Bing indexing.
|
|
55
|
+
|
|
56
|
+
## Comparison vs. Algolia
|
|
57
|
+
|
|
58
|
+
Many documentation generators (like Docusaurus) rely on **Algolia DocSearch**. While Algolia is powerful, it introduces friction:
|
|
59
|
+
|
|
60
|
+
| Feature | docmd Search | Algolia / External |
|
|
61
|
+
| :--- | :--- | :--- |
|
|
62
|
+
| **Setup** | **Zero Config** (Automatic) | Complex (API Keys, CI/CD crawling) |
|
|
63
|
+
| **Privacy** | **100% Private** (Client-side) | Data sent to 3rd party servers |
|
|
64
|
+
| **Offline** | **Yes** | No |
|
|
65
|
+
| **Cost** | **Free** | Free tier limits or Paid |
|
|
66
|
+
| **Speed** | **Instant** (In-memory) | Fast (Network latency dependent) |
|
|
67
|
+
|
|
68
|
+
`docmd` creates a frictionless experience: you write Markdown, we handle the discovery.
|
package/docs/contributing.md
CHANGED
|
@@ -65,6 +65,14 @@ To enable live change tracking for internal files during development, set the DO
|
|
|
65
65
|
- **Temporarily:** Run `export DOCMD_DEV=true` in your terminal before starting the dev server.
|
|
66
66
|
- **Permanently:** Add `export DOCMD_DEV=true` to your `~/.zshrc` file and run `source ~/.zshrc`.
|
|
67
67
|
|
|
68
|
+
### Debugging Build Issues
|
|
69
|
+
|
|
70
|
+
If you are working on the build process and need to see detailed logs about asset processing or minification, you can run:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
DOCMD_DEBUG=true docmd build
|
|
74
|
+
```
|
|
75
|
+
|
|
68
76
|
## Pull Request Process
|
|
69
77
|
|
|
70
78
|
Once you're satisfied with your changes:
|
package/docs/overview.md
CHANGED
|
@@ -30,6 +30,7 @@ This very documentation site is built using `docmd`!
|
|
|
30
30
|
## Key Features
|
|
31
31
|
|
|
32
32
|
* 📝 **Standard Markdown & Frontmatter:** Write content naturally, define page metadata (title, description) easily.
|
|
33
|
+
* 🔍 **Smart Search:** Built-in, offline-capable full-text search with fuzzy matching and highlighting. No API keys required.
|
|
33
34
|
* 🎨 **Themeable:** Built-in light/dark modes, customizable via CSS variables. Uses `highlight.js` for code blocks.
|
|
34
35
|
* 🧩 **Custom Containers:** Add richer components like callouts, cards, and steps using simple `::: name :::` syntax.
|
|
35
36
|
* ⚙️ **Config-Driven Navigation:** Define your site structure and sidebar navigation in `docmd.config.js`. Supports nested items.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mgks/docmd",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Generate beautiful, lightweight static documentation sites directly from your Markdown files. Zero clutter, just content.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -44,8 +44,10 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"chalk": "^4.1.2",
|
|
46
46
|
"chokidar": "^4.0.3",
|
|
47
|
+
"clean-css": "^5.3.3",
|
|
47
48
|
"commander": "^14.0.0",
|
|
48
49
|
"ejs": "^3.1.9",
|
|
50
|
+
"esbuild": "^0.27.0",
|
|
49
51
|
"express": "^5.1.0",
|
|
50
52
|
"fs-extra": "^11.2.0",
|
|
51
53
|
"gray-matter": "^4.0.3",
|
|
@@ -57,6 +59,9 @@
|
|
|
57
59
|
"markdown-it-deflist": "^3.0.0",
|
|
58
60
|
"markdown-it-footnote": "^4.0.0",
|
|
59
61
|
"markdown-it-task-lists": "^2.1.1",
|
|
62
|
+
"mermaid": "^11.12.1",
|
|
63
|
+
"minisearch": "^7.2.0",
|
|
64
|
+
"striptags": "^3.2.0",
|
|
60
65
|
"ws": "^8.17.0"
|
|
61
66
|
},
|
|
62
67
|
"devDependencies": {
|
|
@@ -68,4 +73,4 @@
|
|
|
68
73
|
"directories": {
|
|
69
74
|
"doc": "docs"
|
|
70
75
|
}
|
|
71
|
-
}
|
|
76
|
+
}
|