@mgks/docmd 0.2.9 → 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 +133 -165
- package/docs/comparison.md +5 -0
- package/docs/configuration.md +7 -1
- package/docs/content/search.md +68 -0
- package/docs/overview.md +1 -0
- package/package.json +5 -2
- package/src/assets/css/docmd-main.css +262 -20
- package/src/assets/css/docmd-theme-sky.css +5 -1
- package/src/assets/js/docmd-main.js +1 -0
- package/src/assets/js/docmd-mermaid.js +4 -1
- package/src/assets/js/docmd-search.js +212 -0
- package/src/commands/build.js +116 -1
- package/src/commands/init.js +5 -0
- package/src/core/file-processor.js +12 -1
- package/src/templates/layout.ejs +40 -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,207 +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
|
-
|
|
22
|
-
|
|
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
|
|
23
27
|
|
|
24
|
-
// Sidebar
|
|
28
|
+
// --- Sidebar & Theme ---
|
|
25
29
|
sidebar: {
|
|
26
|
-
collapsible: true,
|
|
27
|
-
defaultCollapsed: false,
|
|
30
|
+
collapsible: true,
|
|
31
|
+
defaultCollapsed: false,
|
|
28
32
|
},
|
|
29
|
-
|
|
30
|
-
// Theme Configuration
|
|
31
33
|
theme: {
|
|
32
|
-
name: 'sky',
|
|
33
|
-
defaultMode: 'light', //
|
|
34
|
-
enableModeToggle: true, // Show
|
|
35
|
-
positionMode: 'top', // 'top' or 'bottom'
|
|
36
|
-
codeHighlight: true,
|
|
37
|
-
customCss: [
|
|
38
|
-
// '/assets/css/custom.css', // Custom TOC styles
|
|
39
|
-
],
|
|
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
|
|
40
40
|
},
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
customJs: [ // Array of paths to custom JS files, loaded at end of body
|
|
44
|
-
'/assets/js/docmd-image-lightbox.js', // Image lightbox functionality
|
|
41
|
+
customJs: [
|
|
42
|
+
'/assets/js/docmd-image-lightbox.js',
|
|
45
43
|
],
|
|
46
44
|
|
|
47
|
-
//
|
|
48
|
-
autoTitleFromH1: true, // Set to true to automatically use the first H1 as page title
|
|
49
|
-
copyCode: true, // Enable/disable the copy code button on code blocks
|
|
50
|
-
|
|
51
|
-
// Plugins Configuration (Object format)
|
|
52
|
-
// Plugins are configured here. docmd will look for these keys.
|
|
45
|
+
// --- Plugins ---
|
|
53
46
|
plugins: {
|
|
54
|
-
// SEO Plugin Configuration
|
|
55
|
-
// These are site-wide fallbacks. For detailed per-page SEO controls,
|
|
56
|
-
// including structured data (LD+JSON), use the `seo` key in your page's frontmatter.
|
|
57
|
-
// See the SEO plugin documentation for all available frontmatter options.
|
|
58
47
|
seo: {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
openGraph: { // For Facebook, LinkedIn, etc.
|
|
62
|
-
// siteName: 'docmd Documentation', // Optional, defaults to config.siteTitle
|
|
63
|
-
// Default image for `og:image` if not specified in page frontmatter
|
|
64
|
-
// Path relative to outputDir root
|
|
48
|
+
defaultDescription: 'The minimalist, zero-config documentation generator for Node.js developers.',
|
|
49
|
+
openGraph: {
|
|
65
50
|
defaultImage: '/assets/images/docmd-preview.png',
|
|
66
51
|
},
|
|
67
|
-
twitter: {
|
|
68
|
-
cardType: 'summary_large_image',
|
|
69
|
-
// siteUsername: '@docmd_handle', // Your site's Twitter handle (optional)
|
|
70
|
-
// creatorUsername: '@your_handle', // Default author handle (optional, can be overridden in frontmatter)
|
|
52
|
+
twitter: {
|
|
53
|
+
cardType: 'summary_large_image',
|
|
71
54
|
}
|
|
72
55
|
},
|
|
73
|
-
// Analytics Plugin Configuration
|
|
74
56
|
analytics: {
|
|
75
|
-
// Google Analytics 4 (GA4)
|
|
76
57
|
googleV4: {
|
|
77
|
-
measurementId: 'G-8QVBDQ4KM1'
|
|
78
|
-
}
|
|
79
|
-
// Google Universal Analytics (UA) - Legacy (optional)
|
|
80
|
-
// googleUA: {
|
|
81
|
-
// trackingId: 'UA-XXXXXXXXX-Y' // Replace with your actual UA Tracking ID
|
|
82
|
-
// }
|
|
58
|
+
measurementId: 'G-8QVBDQ4KM1'
|
|
59
|
+
}
|
|
83
60
|
},
|
|
84
|
-
// Enable Sitemap plugin
|
|
85
61
|
sitemap: {
|
|
86
62
|
defaultChangefreq: 'weekly',
|
|
87
63
|
defaultPriority: 0.8
|
|
88
64
|
}
|
|
89
|
-
// Add other future plugin configurations here by their key
|
|
90
65
|
},
|
|
91
66
|
|
|
92
|
-
//
|
|
67
|
+
// --- Doc Source Link ---
|
|
93
68
|
editLink: {
|
|
94
69
|
enabled: true,
|
|
95
|
-
// The URL to the folder containing your docs in the git repo
|
|
96
|
-
// Note: It usually ends with /edit/main/docs or /blob/main/docs
|
|
97
70
|
baseUrl: 'https://github.com/mgks/docmd/edit/main/docs',
|
|
98
71
|
text: 'Edit this page on GitHub'
|
|
99
72
|
},
|
|
100
73
|
|
|
101
|
-
// Navigation
|
|
102
|
-
// Icons are kebab-case names from Lucide Icons (https://lucide.dev/)
|
|
74
|
+
// --- Navigation ---
|
|
103
75
|
navigation: [
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
// { title: 'Support the Project', path: 'https://github.com/sponsors/mgks', icon: 'heart', external: true },
|
|
107
|
-
{
|
|
108
|
-
title: 'Getting Started',
|
|
109
|
-
icon: 'rocket',
|
|
110
|
-
path: '/getting-started/',
|
|
111
|
-
children: [
|
|
112
|
-
{ title: 'Installation', path: '/getting-started/installation', icon: 'download' },
|
|
113
|
-
{ title: 'Basic Usage', path: '/getting-started/basic-usage', icon: 'play' },
|
|
114
|
-
],
|
|
115
|
-
},
|
|
116
|
-
{ title: 'Configuration', path: '/configuration', icon: 'settings' },
|
|
117
|
-
{
|
|
118
|
-
title: 'Content',
|
|
119
|
-
icon: 'layout-template',
|
|
120
|
-
path: '/content/',
|
|
121
|
-
collapsible: true,
|
|
122
|
-
children: [
|
|
123
|
-
{ title: 'Frontmatter', path: '/content/frontmatter', icon: 'file-text' },
|
|
124
|
-
{ title: 'Markdown Syntax', path: '/content/markdown-syntax', icon: 'code-2' },
|
|
125
|
-
{ title: 'Images', path: '/content/images', icon: 'image' },
|
|
126
|
-
{ title: 'Mermaid Diagrams', path: '/content/mermaid', icon: 'network' },
|
|
127
|
-
{
|
|
128
|
-
title: 'Custom Containers',
|
|
129
|
-
path: '/content/containers/',
|
|
130
|
-
icon: 'box',
|
|
131
|
-
collapsible: true,
|
|
132
|
-
children: [
|
|
133
|
-
{ title: 'Callouts', path: '/content/containers/callouts', icon: 'megaphone' },
|
|
134
|
-
{ title: 'Cards', path: '/content/containers/cards', icon: 'panel-top' },
|
|
135
|
-
{ title: 'Steps', path: '/content/containers/steps', icon: 'list-ordered' },
|
|
136
|
-
{ title: 'Tabs', path: '/content/containers/tabs', icon: 'columns-3' },
|
|
137
|
-
{ title: 'Collapsible', path: '/content/containers/collapsible', icon: 'chevrons-down' },
|
|
138
|
-
{ title: 'Changelogs', path: '/content/containers/changelogs', icon: 'logs' },
|
|
139
|
-
{ title: 'Buttons', path: '/content/containers/buttons', icon: 'mouse-pointer-click' },
|
|
140
|
-
{ title: 'Nested Containers', path: '/content/containers/nested-containers', icon: 'folder-tree' },
|
|
141
|
-
]
|
|
142
|
-
},
|
|
143
|
-
{ title: 'No-Style Pages', path: '/content/no-style-pages', icon: 'layout' },
|
|
144
|
-
{ title: 'No-Style Example', path: '/content/no-style-example', icon: 'sparkles' },
|
|
145
|
-
],
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
title: 'Theming',
|
|
149
|
-
icon: 'palette',
|
|
150
|
-
path: '/theming/',
|
|
151
|
-
collapsible: true,
|
|
152
|
-
children: [
|
|
153
|
-
{ title: 'Available Themes', path: '/theming/available-themes', icon: 'layout-grid' },
|
|
154
|
-
{ title: 'Light & Dark Mode', path: '/theming/light-dark-mode', icon: 'sun-moon' },
|
|
155
|
-
{ title: 'Custom CSS & JS', path: '/theming/custom-css-js', icon: 'file-code' },
|
|
156
|
-
{ title: 'Icons', path: '/theming/icons', icon: 'pencil-ruler' },
|
|
157
|
-
],
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
title: 'Plugins',
|
|
161
|
-
icon: 'puzzle',
|
|
162
|
-
path: '/plugins/',
|
|
163
|
-
collapsible: true,
|
|
164
|
-
children: [
|
|
165
|
-
{ title: 'SEO & Meta Tags', path: '/plugins/seo', icon: 'search' },
|
|
166
|
-
{ title: 'Analytics', path: '/plugins/analytics', icon: 'bar-chart' },
|
|
167
|
-
{ title: 'Sitemap', path: '/plugins/sitemap', icon: 'map' },
|
|
168
|
-
],
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
title: 'Recipes',
|
|
172
|
-
icon: 'chef-hat',
|
|
173
|
-
path: '/recipes/',
|
|
174
|
-
collapsible: true,
|
|
175
|
-
children: [
|
|
176
|
-
{ title: 'Landing Page', path: '/recipes/landing-page', icon: 'panel-top' },
|
|
177
|
-
{ title: 'Custom Fonts', path: '/recipes/custom-fonts', icon: 'type-outline' },
|
|
178
|
-
{ title: 'Favicon', path: '/recipes/favicon', icon: 'circle-dashed' },
|
|
179
|
-
],
|
|
180
|
-
},
|
|
181
|
-
{ title: 'CLI Commands', path: '/cli-commands', icon: 'terminal' },
|
|
182
|
-
{ title: 'Deployment', path: '/deployment', icon: 'upload-cloud' },
|
|
183
|
-
{ title: 'Contributing', path: '/contributing', icon: 'users-2' },
|
|
184
|
-
{ title: 'Comparison', path: '/comparison', icon: 'shapes' },
|
|
185
|
-
|
|
186
|
-
{ title: 'GitHub', path: 'https://github.com/mgks/docmd', icon: 'github', external: true },
|
|
187
|
-
{ title: 'Discussions', path: 'https://github.com/mgks/docmd/discussions', icon: 'message-square', external: true },
|
|
188
|
-
{ title: 'Issues', path: 'https://github.com/mgks/docmd/issues', icon: 'badge-alert', external: true }
|
|
189
|
-
],
|
|
76
|
+
{ title: 'Welcome', path: '/', icon: 'feather' },
|
|
77
|
+
{ title: 'Overview', path: '/overview', icon: 'home' },
|
|
190
78
|
|
|
191
|
-
|
|
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
|
+
},
|
|
192
88
|
|
|
193
|
-
|
|
194
|
-
sponsor: {
|
|
195
|
-
enabled: true, // Enable/disable the sponsor ribbon
|
|
196
|
-
title: 'Sponsor', // Text to display on the ribbon
|
|
197
|
-
link: 'https://github.com/sponsors/mgks', // URL for the sponsor link
|
|
198
|
-
},
|
|
89
|
+
{ title: 'Configuration', path: '/configuration', icon: 'settings' },
|
|
199
90
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
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
|
+
},
|
|
203
121
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
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
|
+
},
|
|
207
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,13 +127,17 @@ 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
|
+
|
|
128
135
|
## `minify`
|
|
129
136
|
* **Type:** `Boolean`
|
|
130
137
|
* **Optional**
|
|
131
138
|
* **Default:** `true` when running `docmd build`, `false` when running `docmd dev`.
|
|
132
139
|
* **Description:** Controls whether CSS and JavaScript assets are minified (compressed) during the build.
|
|
133
140
|
* **Usage:** You can force this to `false` if you need to debug production builds.
|
|
134
|
-
* **Example:** `minify: false`
|
|
135
141
|
|
|
136
142
|
### `autoTitleFromH1`
|
|
137
143
|
* **Type:** `Boolean`
|
|
@@ -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/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": {
|
|
@@ -59,6 +59,9 @@
|
|
|
59
59
|
"markdown-it-deflist": "^3.0.0",
|
|
60
60
|
"markdown-it-footnote": "^4.0.0",
|
|
61
61
|
"markdown-it-task-lists": "^2.1.1",
|
|
62
|
+
"mermaid": "^11.12.1",
|
|
63
|
+
"minisearch": "^7.2.0",
|
|
64
|
+
"striptags": "^3.2.0",
|
|
62
65
|
"ws": "^8.17.0"
|
|
63
66
|
},
|
|
64
67
|
"devDependencies": {
|
|
@@ -70,4 +73,4 @@
|
|
|
70
73
|
"directories": {
|
|
71
74
|
"doc": "docs"
|
|
72
75
|
}
|
|
73
|
-
}
|
|
76
|
+
}
|