@mgks/docmd 0.2.4 → 0.2.6
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 +66 -41
- package/assets/css/welcome.css +1 -1
- package/bin/docmd.js +54 -10
- package/bin/postinstall.js +14 -0
- package/config.js +4 -1
- package/docs/cli-commands.md +22 -13
- package/docs/configuration.md +4 -5
- package/docs/content/frontmatter.md +8 -0
- package/docs/content/index.md +1 -0
- package/docs/content/mermaid.md +723 -0
- package/docs/deployment.md +5 -5
- package/docs/getting-started/basic-usage.md +7 -7
- package/docs/overview.md +9 -3
- package/docs/plugins/analytics.md +1 -2
- package/docs/plugins/index.md +2 -3
- package/docs/plugins/seo.md +2 -3
- package/docs/plugins/sitemap.md +2 -3
- package/docs/theming/assets-management.md +2 -2
- package/docs/theming/available-themes.md +2 -3
- package/docs/theming/custom-css-js.md +3 -5
- package/docs/theming/icons.md +1 -2
- package/docs/theming/light-dark-mode.md +1 -3
- package/package.json +4 -1
- package/src/assets/css/docmd-main.css +4 -1
- package/src/assets/css/docmd-theme-sky.css +1 -1
- package/src/assets/js/docmd-mermaid.js +203 -0
- package/src/commands/build.js +15 -64
- package/src/commands/dev.js +3 -3
- package/src/commands/init.js +12 -8
- package/src/core/config-loader.js +2 -1
- package/src/core/file-processor.js +18 -0
- package/src/core/html-generator.js +2 -2
- package/src/core/logger.js +21 -0
- package/src/core/navigation-helper.js +62 -0
- package/src/templates/layout.ejs +5 -1
- package/src/templates/toc.ejs +1 -1
package/README.md
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
</p>
|
|
6
6
|
|
|
7
7
|
<p align="center">
|
|
8
|
-
<b>Generate beautiful, lightweight static documentation sites from Markdown files.</b
|
|
9
|
-
Zero clutter, just content.
|
|
8
|
+
<b>Generate beautiful, lightweight static documentation sites from Markdown files.</b>
|
|
9
|
+
<br>Zero clutter, just content.
|
|
10
10
|
</p>
|
|
11
11
|
|
|
12
12
|
<p align="center">
|
|
@@ -15,69 +15,94 @@
|
|
|
15
15
|
<a href="https://github.com/mgks/docmd/blob/main/LICENSE"><img src="https://img.shields.io/github/license/mgks/docmd.svg" alt="license"></a>
|
|
16
16
|
</p>
|
|
17
17
|
|
|
18
|
-
Docmd
|
|
18
|
+
Docmd is a Node.js command-line tool for generating fast, beautiful, and lightweight static documentation sites from standard Markdown files. It champions the philosophy of "zero clutter, just content," prioritizing a simple authoring experience and a clean, performant result for readers.
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
**:rocket: [Live Preview](https://docmd.mgks.dev): Official documentation site powered by `docmd`.**
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
22
|
+
## Key Features
|
|
23
|
+
|
|
24
|
+
- **Markdown First:** Write your content in standard Markdown with simple YAML frontmatter.
|
|
25
|
+
- **Beautiful Themes:** Comes with multiple built-in themes (`sky`, `ruby`, `retro`) and automatic light/dark mode support.
|
|
26
|
+
- **Fast & Lightweight:** Blazing fast static site generation with a minimal client-side footprint.
|
|
27
|
+
- **Rich Content:** Go beyond basic Markdown with custom components like callouts, cards, steps, tabs, and Mermaid diagrams.
|
|
28
|
+
- **Built-in Plugins:** SEO meta tags, sitemap, and analytics are all included out-of-the-box.
|
|
29
|
+
- **No-Style Pages:** Create completely custom pages (like landing pages) with full control over the HTML.
|
|
30
|
+
- **Customizable:** Easily extend or override styles with your own CSS and JavaScript.
|
|
31
|
+
- **Simple CLI:** A straightforward workflow with three main commands: `init`, `dev`, and `build`.
|
|
32
|
+
- **Deploy Anywhere:** The generated `site/` folder can be hosted on any static web host (GitHub Pages, Netlify, Vercel, etc.).
|
|
31
33
|
|
|
32
34
|
## Installation
|
|
35
|
+
**Prerequisites:** [Node.js](https://nodejs.org/) (version 22.x or higher)
|
|
36
|
+
|
|
37
|
+
### Quick Start: Your First Site in 60 Seconds
|
|
33
38
|
|
|
34
|
-
|
|
39
|
+
No global installation is required. You can create and run your site in a new folder with one command.
|
|
35
40
|
|
|
36
41
|
```bash
|
|
37
|
-
#
|
|
38
|
-
|
|
42
|
+
# Create a new project in 'my-docs' and navigate into it
|
|
43
|
+
npx @mgks/docmd init my-docs && cd my-docs
|
|
39
44
|
|
|
40
|
-
#
|
|
41
|
-
npm
|
|
45
|
+
# Start the development server
|
|
46
|
+
npm start
|
|
42
47
|
```
|
|
43
48
|
|
|
44
|
-
|
|
49
|
+
Your new documentation site is now running at `http://localhost:3000` *(or, at your selected or available port)*.
|
|
45
50
|
|
|
46
|
-
|
|
47
|
-
# Initialize a new documentation project
|
|
48
|
-
docmd init
|
|
51
|
+
### Global Installation
|
|
49
52
|
|
|
50
|
-
|
|
51
|
-
docmd dev
|
|
53
|
+
For frequent use, or if you prefer to have the command available system-wide, you can install `docmd` globally using npm.
|
|
52
54
|
|
|
53
|
-
|
|
54
|
-
docmd
|
|
55
|
+
```bash
|
|
56
|
+
npm install -g @mgks/docmd
|
|
55
57
|
```
|
|
58
|
+
After installation, you can run the `docmd` commands from any directory.
|
|
56
59
|
|
|
57
|
-
###
|
|
60
|
+
### Basic Workflow
|
|
58
61
|
|
|
59
|
-
|
|
62
|
+
1. **Initialize a Project:**
|
|
63
|
+
```bash
|
|
64
|
+
docmd init
|
|
65
|
+
```
|
|
66
|
+
This creates a `docs/` directory, a `docmd.config.js` file, and a sample `index.md` to get you started.
|
|
60
67
|
|
|
61
|
-
|
|
68
|
+
2. **Start the Dev Server:**
|
|
69
|
+
```bash
|
|
70
|
+
docmd dev
|
|
71
|
+
```
|
|
72
|
+
This starts a live-reloading server to preview your site as you write.
|
|
62
73
|
|
|
63
|
-
|
|
74
|
+
3. **Build for Production:**
|
|
75
|
+
```bash
|
|
76
|
+
docmd build
|
|
77
|
+
```
|
|
78
|
+
This generates the complete, optimized static site into the `site/` directory, ready for deployment.
|
|
64
79
|
|
|
65
|
-
|
|
66
|
-
2. Clone your fork: `git clone https://github.com/YOUR_USERNAME/docmd.git`
|
|
67
|
-
3. Install dependencies: `npm install`
|
|
68
|
-
4. Make your changes and test them
|
|
69
|
-
5. Submit a pull request
|
|
80
|
+
## Documentation
|
|
70
81
|
|
|
71
|
-
|
|
82
|
+
For a complete guide covering all features, including theming, custom containers, and plugin configuration, please visit the official documentation website: **[docmd.mgks.dev](https://docmd.mgks.dev)**.
|
|
83
|
+
|
|
84
|
+
## Contributing
|
|
85
|
+
|
|
86
|
+
We welcome contributions of all kinds! Whether it's reporting a bug, suggesting a feature, or submitting a pull request, your help is appreciated.
|
|
72
87
|
|
|
73
|
-
|
|
88
|
+
1. Fork the repository.
|
|
89
|
+
2. Clone your fork: `git clone https://github.com/YOUR_USERNAME/docmd.git`
|
|
90
|
+
3. Install dependencies: `npm install`
|
|
91
|
+
4. Make your changes and test them thoroughly.
|
|
92
|
+
5. Submit a pull request to the `main` branch.
|
|
93
|
+
|
|
94
|
+
Please check our [contributing guidelines](https://docmd.mgks.dev/contributing/) for more detailed information.
|
|
74
95
|
|
|
75
96
|
## Support the Project
|
|
76
97
|
|
|
77
98
|
If you find `docmd` useful, please consider:
|
|
78
99
|
|
|
79
|
-
-
|
|
80
|
-
-
|
|
81
|
-
-
|
|
100
|
+
- Starring the repository on GitHub.
|
|
101
|
+
- Sharing it with others who might benefit.
|
|
102
|
+
- Reporting issues or submitting pull requests.
|
|
103
|
+
|
|
104
|
+
❤️ **[GitHub Sponsors](https://github.com/sponsors/mgks): Become a sponsor to support the ongoing development of `docmd`.**
|
|
105
|
+
|
|
106
|
+
## License
|
|
82
107
|
|
|
83
|
-
|
|
108
|
+
Docmd is licensed under the [MIT License](https://github.com/mgks/docmd/blob/main/LICENSE).
|
package/assets/css/welcome.css
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Source file from the docmd project — https://github.com/mgks/docmd
|
|
3
|
-
*
|
|
3
|
+
* Welcome page stylesheet for the docmd project's own documentation
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
:root,html[data-theme=light]{--primary-color:#047bf1;--primary-hover:#026ed9;--text-color:#333;--text-light:#666;--bg-color:#fff;--bg-secondary:#f8f9fa;--border-color:#eaeaea}.theme-toggle,body{color:var(--text-color);display:flex}.logo-text,h1{font-weight:700}.install-code pre,.logo-text{font-family:'PT Mono',monospace}:root{--shadow-color:#00000014;--container-padding:5rem}@media (prefers-color-scheme:dark){:root{--primary-color:#047bf1;--primary-hover:#026ed9;--text-color:#e0e0e0;--text-light:#aaa;--bg-color:#121212;--bg-secondary:#1e1e1e;--border-color:#333;--shadow-color:#0000004d}}[data-theme=light]{--shadow-color:#00000059}[data-theme=dark]{--primary-color:#1955b6;--primary-hover:#084dbd;--text-color:#e0e0e0;--text-light:#aaa;--bg-color:#121212;--bg-secondary:#1e1e1e;--border-color:#333;--shadow-color:#000000de}*{margin:0;padding:0;box-sizing:border-box}body{font-family:Inter,-apple-system,BlinkMacSystemFont,sans-serif;line-height:1.5;background-color:var(--bg-color);height:100vh;overflow:hidden}.landing-container{display:flex;width:100%;height:100%;padding:0 var(--container-padding);max-width:1600px;margin:0 auto}.content-side{flex:1;padding:3rem 2rem 3rem 0;display:flex;flex-direction:column;justify-content:center}.preview-side{flex:1;display:flex;align-items:center;justify-content:flex-start;position:relative;overflow:visible}.header-top{position:absolute;top:2rem;right:3rem;z-index:100}.theme-toggle{background:var(--bg-secondary);border:1px solid var(--border-color);width:40px;height:40px;border-radius:50%;align-items:center;justify-content:center;cursor:pointer;transition:.2s}.theme-toggle:hover{background:var(--border-color)}.logo{margin-bottom:1.5rem;display:flex;align-items:center}.buttons,.features,.install-section,.tagline{margin-bottom:2rem}.logo svg{height:48px;width:auto}.logo-text{font-size:2em;margin-left:.25em}h1{font-size:3rem;margin-bottom:1rem;letter-spacing:-.02em}.tagline{font-size:1.25rem;color:var(--text-light);font-weight:400}.btn-primary,.feature-icon{background-color:var(--primary-color);color:#fff}.features{display:grid;grid-template-columns:repeat(2,1fr);gap:1.5rem}.feature{display:flex;align-items:flex-start;gap:.75rem}.feature-icon{width:32px;height:32px;border-radius:6px;display:flex;align-items:center;justify-content:center;flex-shrink:0}.feature-text{font-size:.9rem}.feature-text strong{display:block;margin-bottom:.25rem}.buttons{display:flex;gap:1rem}.btn{display:inline-flex;align-items:center;gap:.5rem;padding:.75rem 1.5rem;border-radius:8px;font-weight:600;font-size:1rem;text-decoration:none;transition:.2s}.btn-primary{border:none}.btn-secondary,.install-code pre{background-color:var(--bg-secondary);border:1px solid var(--border-color)}.btn-primary:hover{background-color:var(--primary-hover)}.btn-secondary{color:var(--text-color)}.btn-secondary:hover{background-color:var(--border-color)}.social-links{display:flex;gap:1rem;padding:0 .25em}.social-link{color:var(--text-light);transition:color .2s}.social-link:hover{color:var(--primary-color)}.preview-stack{position:relative;width:100%;height:400px;transform:translateX(15%);perspective:1000px}.preview-image{position:absolute;width:100%;max-width:700px;height:400px;border-radius:20px;box-shadow:0 25px 50px -12px var(--shadow-color);transition:.3s;overflow:hidden}.preview-image img{width:100%;height:100%;object-fit:cover;object-position:left top;border-radius:8px;pointer-events:none}.preview-image.top{z-index:3;transform:rotate(3deg) translateY(-10%) translateX(7%)}.preview-image.middle{z-index:2;transform:rotate(-3deg) translateY(1%) translateX(-2%)}.preview-image.bottom{z-index:1;transform:rotate(-8deg) translateY(10%) translateX(-10%)}[data-theme=dark] .preview-image .dark-img,[data-theme=light] .preview-image .light-img{display:block}[data-theme=dark] .preview-image .light-img,[data-theme=light] .preview-image .dark-img{display:none}@media (max-width:1400px){:root{--container-padding:3rem}.preview-stack{transform:translateX(15%)}}@media (max-width:1200px){:root{--container-padding:2rem}.preview-side{display:none}.content-side{max-width:100%;padding:3rem 0}.header-top{right:2rem}}@media (max-width:768px){:root{--container-padding:1.5rem}body{overflow:auto}.content-side{padding:2rem 0}.features{grid-template-columns:1fr}.buttons{flex-direction:column}.header-top{padding:1rem 0;text-align:center;right:1rem}h1{font-size:2.5rem}.tagline{font-size:1em;font-weight:500}.landing-container{padding:1rem;flex-direction:column}}.social-links .lucide-heart-handshake{color:#cd2727}.install-code{position:relative;display:inline-block}.install-code pre{border-radius:8px;padding:1rem 3.5rem 1rem 1rem;margin:0;font-size:.9rem;color:var(--text-color)}.install-code code{background:0 0;padding:0;color:inherit}.copy-button{position:absolute;top:.5rem;right:.5rem;background:var(--bg-color);border:1px solid var(--border-color);border-radius:4px;padding:.5rem;cursor:pointer;transition:.2s;color:var(--text-light)}.copy-button:hover{background:var(--border-color);color:var(--text-color)}
|
package/bin/docmd.js
CHANGED
|
@@ -1,10 +1,28 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
const { Command } = require('commander');
|
|
4
|
+
const fs = require('fs-extra');
|
|
5
|
+
const path = require('path');
|
|
4
6
|
const { version } = require('../package.json');
|
|
5
7
|
const { initProject } = require('../src/commands/init');
|
|
6
8
|
const { buildSite } = require('../src/commands/build');
|
|
7
9
|
const { startDevServer } = require('../src/commands/dev');
|
|
10
|
+
const { printBanner } = require('../src/core/logger');
|
|
11
|
+
|
|
12
|
+
// Helper function to find the config file
|
|
13
|
+
const findConfigFile = () => {
|
|
14
|
+
const newConfigPath = 'docmd.config.js';
|
|
15
|
+
const oldConfigPath = 'config.js';
|
|
16
|
+
|
|
17
|
+
if (fs.existsSync(path.resolve(process.cwd(), newConfigPath))) {
|
|
18
|
+
return newConfigPath;
|
|
19
|
+
}
|
|
20
|
+
if (fs.existsSync(path.resolve(process.cwd(), oldConfigPath))) {
|
|
21
|
+
return oldConfigPath;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
throw new Error('Configuration file not found. Please create a docmd.config.js file or run "docmd init".');
|
|
25
|
+
};
|
|
8
26
|
|
|
9
27
|
const program = new Command();
|
|
10
28
|
|
|
@@ -15,7 +33,7 @@ program
|
|
|
15
33
|
|
|
16
34
|
program
|
|
17
35
|
.command('init')
|
|
18
|
-
.description('Initialize a new docmd project (creates docs/ and config
|
|
36
|
+
.description('Initialize a new docmd project (creates docs/ and config file)')
|
|
19
37
|
.action(async () => {
|
|
20
38
|
try {
|
|
21
39
|
await initProject();
|
|
@@ -28,20 +46,32 @@ program
|
|
|
28
46
|
|
|
29
47
|
program
|
|
30
48
|
.command('build')
|
|
31
|
-
.description('Build the static site from Markdown files and config
|
|
32
|
-
.option('-c, --config <path>', 'Path to config
|
|
49
|
+
.description('Build the static site from Markdown files and config')
|
|
50
|
+
.option('-c, --config <path>', 'Path to config file')
|
|
33
51
|
.option('-p, --preserve', 'Preserve existing asset files instead of updating them')
|
|
34
52
|
.option('--no-preserve', 'Force update all asset files, overwriting existing ones')
|
|
53
|
+
.option('--silent', 'Suppress log output')
|
|
35
54
|
.action(async (options) => {
|
|
36
55
|
try {
|
|
37
|
-
|
|
38
|
-
|
|
56
|
+
if (!options.silent) { printBanner(); }
|
|
57
|
+
|
|
58
|
+
const originalLog = console.log;
|
|
59
|
+
if (options.silent) { console.log = () => {}; }
|
|
60
|
+
|
|
61
|
+
const configPath = options.config || findConfigFile();
|
|
62
|
+
console.log(`🚀 Starting build process using ${configPath}...`);
|
|
63
|
+
await buildSite(configPath, {
|
|
39
64
|
preserve: options.preserve
|
|
40
65
|
});
|
|
41
|
-
|
|
66
|
+
|
|
67
|
+
console.log = originalLog;
|
|
68
|
+
if (!options.silent) {
|
|
69
|
+
console.log('✅ Build complete! Site generated in `site/` directory.');
|
|
70
|
+
}
|
|
71
|
+
|
|
42
72
|
} catch (error) {
|
|
43
73
|
console.error('❌ Build failed:', error.message);
|
|
44
|
-
console.error(error.stack);
|
|
74
|
+
// console.error(error.stack);
|
|
45
75
|
process.exit(1);
|
|
46
76
|
}
|
|
47
77
|
});
|
|
@@ -49,15 +79,29 @@ program
|
|
|
49
79
|
program
|
|
50
80
|
.command('dev')
|
|
51
81
|
.description('Start a live preview development server')
|
|
52
|
-
.option('-c, --config <path>', 'Path to config
|
|
82
|
+
.option('-c, --config <path>', 'Path to config file')
|
|
83
|
+
.option('--port <number>', 'Specify a port for the dev server')
|
|
53
84
|
.option('-p, --preserve', 'Preserve existing asset files instead of updating them')
|
|
54
85
|
.option('--no-preserve', 'Force update all asset files, overwriting existing ones')
|
|
86
|
+
.option('--silent', 'Suppress log output')
|
|
55
87
|
.action(async (options) => {
|
|
56
88
|
try {
|
|
57
|
-
|
|
89
|
+
if (!options.silent) { printBanner(); }
|
|
90
|
+
|
|
91
|
+
if (options.silent) {
|
|
92
|
+
const originalLog = console.log;
|
|
93
|
+
console.log = (message) => {
|
|
94
|
+
if (message && message.includes('Dev server started at')) {
|
|
95
|
+
originalLog(message);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
const configPath = options.config || findConfigFile();
|
|
100
|
+
await startDevServer(configPath, { preserve: options.preserve, port: options.port });
|
|
101
|
+
|
|
58
102
|
} catch (error) {
|
|
59
103
|
console.error('❌ Dev server failed:', error.message);
|
|
60
|
-
console.error(error.stack);
|
|
104
|
+
// console.error(error.stack);
|
|
61
105
|
process.exit(1);
|
|
62
106
|
}
|
|
63
107
|
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// bin/postinstall.js
|
|
2
|
+
|
|
3
|
+
const chalk = require('chalk');
|
|
4
|
+
|
|
5
|
+
// This script runs after 'npm install', runs only when the user installs it globally and not in a CI environment
|
|
6
|
+
|
|
7
|
+
if (process.env.npm_config_global && !process.env.CI) {
|
|
8
|
+
console.log(chalk.green('\n🎉 Thank you for installing docmd!'));
|
|
9
|
+
console.log('\nTo get started, run the following commands:');
|
|
10
|
+
console.log(`\n ${chalk.cyan('docmd init my-awesome-docs')}`);
|
|
11
|
+
console.log(` ${chalk.cyan('cd my-awesome-docs')}`);
|
|
12
|
+
console.log(` ${chalk.cyan('npm start')}`);
|
|
13
|
+
console.log('\nFor complete documentation, visit: https://docmd.mgks.dev');
|
|
14
|
+
}
|
package/config.js
CHANGED
|
@@ -112,6 +112,7 @@ module.exports = {
|
|
|
112
112
|
{ title: 'Frontmatter', path: '/content/frontmatter', icon: 'file-text' },
|
|
113
113
|
{ title: 'Markdown Syntax', path: '/content/markdown-syntax', icon: 'code-2' },
|
|
114
114
|
{ title: 'Images', path: '/content/images', icon: 'image' },
|
|
115
|
+
{ title: 'Mermaid Diagrams', path: '/content/mermaid', icon: 'network' },
|
|
115
116
|
{
|
|
116
117
|
title: 'Custom Containers',
|
|
117
118
|
path: '/content/containers/',
|
|
@@ -163,10 +164,12 @@ module.exports = {
|
|
|
163
164
|
{ title: 'Issues', path: 'https://github.com/mgks/docmd/issues', icon: 'badge-alert', external: true }
|
|
164
165
|
],
|
|
165
166
|
|
|
167
|
+
pageNavigation: true, // Enable previous / next page navigation at the bottom of each page
|
|
168
|
+
|
|
166
169
|
// Sponsor Ribbon Configuration
|
|
167
170
|
sponsor: {
|
|
168
171
|
enabled: true, // Enable/disable the sponsor ribbon
|
|
169
|
-
title: '
|
|
172
|
+
title: 'Sponsor', // Text to display on the ribbon
|
|
170
173
|
link: 'https://github.com/sponsors/mgks', // URL for the sponsor link
|
|
171
174
|
},
|
|
172
175
|
|
package/docs/cli-commands.md
CHANGED
|
@@ -20,9 +20,9 @@ docmd init
|
|
|
20
20
|
This command creates the basic file and directory structure required for a `docmd` project:
|
|
21
21
|
* `docs/`: A directory to store your Markdown source files.
|
|
22
22
|
* `docs/index.md`: A sample Markdown file.
|
|
23
|
-
* `config.js`: The main configuration file for your site, pre-filled with default settings.
|
|
23
|
+
* `docmd.config.js`: The main configuration file for your site, pre-filled with default settings.
|
|
24
24
|
|
|
25
|
-
If a `docs/` directory or `config.js` file already exists, `docmd init` will typically warn you and avoid overwriting them to prevent accidental data loss.
|
|
25
|
+
If a `docs/` directory or `docmd.config.js` file already exists, `docmd init` will typically warn you and avoid overwriting them to prevent accidental data loss.
|
|
26
26
|
|
|
27
27
|
**Options:**
|
|
28
28
|
This command currently does not take any options.
|
|
@@ -37,7 +37,7 @@ docmd build [options]
|
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
**Description:**
|
|
40
|
-
The `build` command reads your Markdown files from the source directory (specified by `srcDir` in `config.js`, defaults to `docs/`), processes them along with your `config.js`, and generates a complete static website in the output directory (specified by `outputDir` in `config.js`, defaults to `site/`).
|
|
40
|
+
The `build` command reads your Markdown files from the source directory (specified by `srcDir` in `docmd.config.js`, defaults to `docs/`), processes them along with your `docmd.config.js`, and generates a complete static website in the output directory (specified by `outputDir` in `docmd.config.js`, defaults to `site/`).
|
|
41
41
|
|
|
42
42
|
The output `site/` directory contains all the HTML, CSS, JavaScript, and other assets needed to deploy your documentation.
|
|
43
43
|
|
|
@@ -46,14 +46,16 @@ By default, the build process will update all assets to ensure you have the late
|
|
|
46
46
|
**Options:**
|
|
47
47
|
|
|
48
48
|
* `-c, --config <path>`
|
|
49
|
-
* **Default:** `config.js`
|
|
50
|
-
* **Description:** Specifies the path to the configuration file.
|
|
51
|
-
* **Example:** `docmd build --config my.docmd.config.js`
|
|
49
|
+
* **Default:** `docmd.config.js` or `config.js`
|
|
50
|
+
* **Description:** Specifies the path to the configuration file.
|
|
52
51
|
|
|
53
52
|
* `-p, --preserve`
|
|
54
53
|
* **Default:** `false`
|
|
55
|
-
* **Description:** Preserves existing asset files instead of updating them.
|
|
56
|
-
|
|
54
|
+
* **Description:** Preserves existing asset files instead of updating them.
|
|
55
|
+
|
|
56
|
+
* `--silent`
|
|
57
|
+
* **Default:** `false`
|
|
58
|
+
* **Description:** Suppresses most log output in the console. Useful for running in automated environments.
|
|
57
59
|
|
|
58
60
|
## `docmd dev`
|
|
59
61
|
|
|
@@ -68,7 +70,7 @@ docmd dev [options]
|
|
|
68
70
|
The `dev` command is essential for writing and previewing your documentation. It:
|
|
69
71
|
1. Performs an initial build of your site.
|
|
70
72
|
2. Starts a local web server (usually on `http://localhost:3000`).
|
|
71
|
-
3. Watches your source files (`docs/` directory, `config.js`, and internal `docmd` theme assets) for changes.
|
|
73
|
+
3. Watches your source files (`docs/` directory, `docmd.config.js`, and internal `docmd` theme assets) for changes.
|
|
72
74
|
4. When a change is detected, it automatically rebuilds the necessary parts of your site and triggers a live reload in your browser.
|
|
73
75
|
|
|
74
76
|
This provides a fast feedback loop, allowing you to see your changes almost instantly.
|
|
@@ -76,14 +78,21 @@ This provides a fast feedback loop, allowing you to see your changes almost inst
|
|
|
76
78
|
**Options:**
|
|
77
79
|
|
|
78
80
|
* `-c, --config <path>`
|
|
79
|
-
* **Default:** `config.js`
|
|
81
|
+
* **Default:** `docmd.config.js` or `config.js`
|
|
80
82
|
* **Description:** Specifies the path to the configuration file.
|
|
81
|
-
|
|
83
|
+
|
|
84
|
+
* `--port <number>`
|
|
85
|
+
* **Default:** `3000`
|
|
86
|
+
* **Description:** Specifies the port for the development server. If the port is in use, docmd will automatically try the next available one.
|
|
87
|
+
* **Example:** `docmd dev --port 8080`
|
|
82
88
|
|
|
83
89
|
* `-p, --preserve`
|
|
84
90
|
* **Default:** `false`
|
|
85
|
-
* **Description:** Preserves existing asset files instead of updating them.
|
|
86
|
-
|
|
91
|
+
* **Description:** Preserves existing asset files instead of updating them.
|
|
92
|
+
|
|
93
|
+
* `--silent`
|
|
94
|
+
* **Default:** `false`
|
|
95
|
+
* **Description:** Suppresses most log output in the console. Useful for running in automated environments.
|
|
87
96
|
|
|
88
97
|
**Note:** The development server starts on port 3000 by default. If port 3000 is already in use, the server will automatically try the next available port (3001, 3002, etc.) until it finds an open port.
|
|
89
98
|
|
package/docs/configuration.md
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: "Configuration"
|
|
3
|
-
description: "Detailed explanation of all options available in the docmd config
|
|
3
|
+
description: "Detailed explanation of all options available in the docmd config file, including logo, theming, plugins, and more."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Configuration (`config.js`)
|
|
6
|
+
# Configuration (`docmd.config.js`)
|
|
7
7
|
|
|
8
|
-
`docmd` uses a `config.js` file in the root of your
|
|
8
|
+
`docmd` uses a `docmd.config.js` file in the root of your project... For backward compatibility, it will fall back to using `config.js` if `docmd.config.js` is not found.
|
|
9
9
|
|
|
10
|
-
## Example `config.js` Structure:
|
|
10
|
+
## Example `docmd.config.js` Structure:
|
|
11
11
|
|
|
12
12
|
```javascript
|
|
13
|
-
// config.js
|
|
14
13
|
module.exports = {
|
|
15
14
|
siteTitle: 'My Awesome Project Docs',
|
|
16
15
|
logo: {
|
|
@@ -52,6 +52,14 @@ Examples of custom fields you *might* add (these are not built-in features):
|
|
|
52
52
|
* `tags`: ["tag1", "tag2"]
|
|
53
53
|
* `permalink`: "https://example.com/your-canonical-url/" (Sets the canonical URL for SEO purposes)
|
|
54
54
|
|
|
55
|
+
## Page-Specific Behavior Fields
|
|
56
|
+
|
|
57
|
+
* **`toc`** (Boolean, Optional)
|
|
58
|
+
* **Purpose:** Controls the visibility of the "On This Page" table of contents sidebar.
|
|
59
|
+
* **Default:** `true` (TOC is visible if the page has headings).
|
|
60
|
+
* **Usage:** Set to `false` to completely hide the TOC sidebar for a specific page. This is useful for landing pages or pages with minimal content.
|
|
61
|
+
* **Example:** `toc: false`
|
|
62
|
+
|
|
55
63
|
## Example Usage
|
|
56
64
|
|
|
57
65
|
Consider a file named `docs/guides/installation.md`:
|
package/docs/content/index.md
CHANGED
|
@@ -12,6 +12,7 @@ docmd uses Markdown files to create beautiful documentation. This section covers
|
|
|
12
12
|
- [**Frontmatter**](/content/frontmatter/) - Learn how to add metadata to your pages
|
|
13
13
|
- [**Markdown Syntax**](/content/markdown-syntax/) - Basic and advanced Markdown features
|
|
14
14
|
- [**Images**](/content/images/) - How to add and style images in your documentation
|
|
15
|
+
- [**Mermaid Diagrams**](/content/mermaid/) - Create beautiful diagrams and flowcharts with Mermaid
|
|
15
16
|
- [**Custom Containers**](/content/custom-containers/) - Special content blocks like callouts and cards
|
|
16
17
|
- [**noStyle Pages**](/content/no-style-pages/) - Create custom standalone pages with complete HTML control
|
|
17
18
|
|