@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
package/.gitattributes ADDED
@@ -0,0 +1,2 @@
1
+ # Auto detect text files and perform LF normalization
2
+ * text=auto
@@ -0,0 +1,15 @@
1
+ # These are supported funding model platforms
2
+
3
+ github: mgks # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4
+ patreon: # Replace with a single Patreon username
5
+ open_collective: # Replace with a single Open Collective username
6
+ ko_fi: # Replace with a single Ko-fi username
7
+ tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8
+ community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9
+ liberapay: # Replace with a single Liberapay username
10
+ issuehunt: # Replace with a single IssueHunt username
11
+ lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
12
+ polar: # Replace with a single Polar username
13
+ buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
14
+ thanks_dev: # Replace with a single thanks.dev username
15
+ custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
@@ -0,0 +1,45 @@
1
+ name: deploy docmd
2
+
3
+ on:
4
+ push:
5
+ branches: [main] # Your default branch
6
+ workflow_dispatch: # Allows manual triggering
7
+
8
+ permissions:
9
+ contents: read
10
+ pages: write
11
+ id-token: write
12
+
13
+ jobs:
14
+ build-and-deploy:
15
+ runs-on: ubuntu-latest
16
+ environment:
17
+ name: github-pages
18
+ url: ${{ steps.deployment.outputs.page_url }}
19
+ steps:
20
+ - name: Checkout 🛎️
21
+ uses: actions/checkout@v4
22
+
23
+ - name: Set up Node.js ⚙️
24
+ uses: actions/setup-node@v4
25
+ with:
26
+ node-version: '22' # Use Node.js 22
27
+ cache: 'npm'
28
+
29
+ - name: Install Dependencies 📦
30
+ run: npm ci # Use ci for cleaner installs in CI
31
+
32
+ - name: Build docmd's Own Docs 🛠️
33
+ run: node ./bin/docmd.js build
34
+
35
+ - name: Setup Pages
36
+ uses: actions/configure-pages@v5
37
+
38
+ - name: Upload artifact
39
+ uses: actions/upload-pages-artifact@v3
40
+ with:
41
+ path: ./site
42
+
43
+ - name: Deploy to GitHub Pages 🚀
44
+ id: deployment
45
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,84 @@
1
+ name: Publish Package to NPM and GitHub Packages
2
+
3
+ on:
4
+ release:
5
+ types: [created] # Triggers when a new GitHub Release is published
6
+ workflow_dispatch: # Allows manual triggering for testing
7
+
8
+ jobs:
9
+ publish:
10
+ runs-on: ubuntu-latest
11
+ permissions:
12
+ contents: read
13
+ packages: write # Required for GitHub Packages
14
+ steps:
15
+ - name: Checkout repository
16
+ uses: actions/checkout@v4
17
+ # Your package.json in the workspace should now have name: "@mgks/docmd"
18
+
19
+ - name: Set up Node.js (common for all steps)
20
+ uses: actions/setup-node@v4
21
+ with:
22
+ node-version: '22'
23
+ cache: 'npm' # Cache npm dependencies
24
+
25
+ - name: Install dependencies
26
+ run: npm ci
27
+
28
+ # Optional: Run build script if you have one for the package itself
29
+ # - name: Build package
30
+ # run: npm run build
31
+
32
+ # Optional: Run tests
33
+ # - name: Test package
34
+ # run: npm test
35
+
36
+ # --- Publish to NPM Registry (npmjs.com) ---
37
+ - name: Set up Node.js for npmjs.com
38
+ uses: actions/setup-node@v4
39
+ with:
40
+ node-version: '22' # Redundant if already set, but harmless
41
+ registry-url: 'https://registry.npmjs.org/'
42
+ env:
43
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} # Configures .npmrc for npmjs.com
44
+
45
+ # No need to change package.json name if it's already @mgks/docmd
46
+ # Just ensure no GPR-specific publishConfig is present
47
+ - name: Prepare package.json for npmjs.com
48
+ run: |
49
+ echo "package.json for npmjs.com publishing (should be @mgks/docmd):"
50
+ cat package.json
51
+ # Remove publishConfig if it exists, just in case
52
+ if jq -e '.publishConfig' package.json > /dev/null; then
53
+ echo "Removing publishConfig for npmjs.com publish"
54
+ jq 'del(.publishConfig)' package.json > package_temp.json && mv package_temp.json package.json
55
+ else
56
+ echo "No publishConfig found, package.json is ready for npmjs.com."
57
+ fi
58
+ cat package.json
59
+
60
+ - name: Publish to NPM Registry (npmjs.com)
61
+ # For scoped packages on npmjs.com, --access=public is needed for the first publish
62
+ # and if it's intended to be a public package.
63
+ run: npm publish --access=public
64
+
65
+ # --- Publish to GitHub Packages ---
66
+ - name: Set up Node.js for GitHub Packages
67
+ uses: actions/setup-node@v4
68
+ with:
69
+ node-version: '22' # Redundant if already set, but harmless
70
+ registry-url: 'https://npm.pkg.github.com'
71
+ # scope: '@mgks' # Not strictly needed here if package.json name is already @mgks/docmd
72
+ # but good for ensuring .npmrc is correctly configured for the @mgks scope.
73
+ env:
74
+ NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Configures .npmrc for GPR
75
+
76
+ # The package name is already @mgks/docmd from checkout (and npmjs.com step didn't change it).
77
+ # No jq transformation of the name is needed.
78
+ - name: Verify package.json for GitHub Packages
79
+ run: |
80
+ echo "package.json for GPR publishing (should be @mgks/docmd):"
81
+ cat package.json
82
+
83
+ - name: Publish to GitHub Packages
84
+ run: npm publish
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 mgks
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,83 @@
1
+ <p align="center">
2
+ <img src="https://github.com/mgks/docmd/blob/main/src/assets/images/docmd-logo.png" alt="docmd logo" width="65" />
3
+ <br />
4
+ <img src="https://github.com/mgks/docmd/blob/main/src/assets/images/logo-light.png" alt="docmd dark logo" width="200" />
5
+ </p>
6
+
7
+ <p align="center">
8
+ <b>Generate beautiful, lightweight static documentation sites from Markdown files.</b><br>
9
+ Zero clutter, just content.
10
+ </p>
11
+
12
+ <p align="center">
13
+ <a href="https://www.npmjs.com/package/@mgks/docmd"><img src="https://img.shields.io/npm/v/@mgks/docmd.svg" alt="npm version"></a>
14
+ <a href="https://www.npmjs.com/package/@mgks/docmd"><img src="https://img.shields.io/npm/dm/@mgks/docmd.svg" alt="npm downloads"></a>
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
+ </p>
17
+
18
+ Docmd (`docmd`) is a Node.js command-line tool dedicated to generating beautiful, lightweight static documentation sites from standard Markdown files. It champions the philosophy of "zero clutter, just content," prioritizing ease of use for documentation authors and a clean, performant experience for readers.
19
+
20
+ ## Features
21
+
22
+ - 📝 **Markdown First** - Standard Markdown with YAML frontmatter
23
+ - 🎨 **Beautiful Themes** - Multiple themes and light/dark modes with syntax highlighting
24
+ - 🚀 **Fast & Lightweight** - Static site generation with minimal JS
25
+ - 🧩 **Custom Components** - Callouts, cards, steps, and more
26
+ - 🔌 **Built-in Plugins** - SEO, Analytics, and Sitemap support
27
+ - 💻 **Simple CLI** - Easy `init`, `dev`, and `build` commands
28
+ - 🌐 **Deploy Anywhere** - Deploy the generated sites anywhere (GitHub Pages, Netlify, Vercel, etc.).
29
+
30
+ ## Installation
31
+
32
+ ### From npm
33
+
34
+ ```bash
35
+ # Global installation (recommended)
36
+ npm install -g @mgks/docmd
37
+
38
+ # Local project installation
39
+ npm install --save-dev @mgks/docmd
40
+ ```
41
+
42
+ ### Quick Start
43
+
44
+ ```bash
45
+ # Initialize a new documentation project
46
+ docmd init
47
+
48
+ # Start the development server
49
+ docmd dev
50
+
51
+ # Build for production
52
+ docmd build
53
+ ```
54
+
55
+ ### Documentation
56
+
57
+ For complete documentation, visit **[docmd.mgks.dev](https://docmd.mgks.dev)**
58
+
59
+ ## Contributing
60
+
61
+ Contributions are welcome! Please check our [contributing guidelines](https://docmd.mgks.dev/contributing/) to get started.
62
+
63
+ 1. Fork the repository
64
+ 2. Clone your fork: `git clone https://github.com/YOUR_USERNAME/docmd.git`
65
+ 3. Install dependencies: `npm install`
66
+ 4. Make your changes and test them
67
+ 5. Submit a pull request
68
+
69
+ ## License
70
+
71
+ `docmd` is licensed under the [MIT License](LICENSE).
72
+
73
+ ## Support the Project
74
+
75
+ If you find `docmd` useful, please consider:
76
+
77
+ - Starring the repository on GitHub
78
+ - Sharing it with others who might benefit
79
+ - Reporting issues or submitting pull requests
80
+
81
+ **[GitHub Sponsors](https://github.com/sponsors/mgks): Become a monthly or one-time GitHub sponsor to support docmd & other projects developed by [me](https://mgks.dev).**
82
+
83
+ <br /><img src="https://forthebadge.com/images/badges/built-with-love.svg" alt="Built with Love">
package/bin/docmd.js ADDED
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { Command } = require('commander');
4
+ const { version } = require('../package.json');
5
+ const { initProject } = require('../src/commands/init');
6
+ const { buildSite } = require('../src/commands/build');
7
+ const { startDevServer } = require('../src/commands/dev');
8
+
9
+ const program = new Command();
10
+
11
+ program
12
+ .name('docmd')
13
+ .description('Generate beautiful, lightweight static documentation sites directly from your Markdown files.')
14
+ .version(version);
15
+
16
+ program
17
+ .command('init')
18
+ .description('Initialize a new docmd project (creates docs/ and config.js)')
19
+ .action(async () => {
20
+ try {
21
+ await initProject();
22
+ console.log('✅ docmd project initialized successfully!');
23
+ } catch (error) {
24
+ console.error('❌ Error initializing project:', error.message);
25
+ process.exit(1);
26
+ }
27
+ });
28
+
29
+ program
30
+ .command('build')
31
+ .description('Build the static site from Markdown files and config.js')
32
+ .option('-c, --config <path>', 'Path to config.js file', 'config.js')
33
+ .action(async (options) => {
34
+ try {
35
+ console.log('🚀 Starting build process...');
36
+ await buildSite(options.config);
37
+ console.log('✅ Build complete! Site generated in `site/` directory.');
38
+ } catch (error) {
39
+ console.error('❌ Build failed:', error.message);
40
+ console.error(error.stack);
41
+ process.exit(1);
42
+ }
43
+ });
44
+
45
+ program
46
+ .command('dev')
47
+ .description('Start a live preview development server')
48
+ .option('-c, --config <path>', 'Path to config.js file', 'config.js')
49
+ .action(async (options) => {
50
+ try {
51
+ await startDevServer(options.config);
52
+ } catch (error) {
53
+ console.error('❌ Dev server failed:', error.message);
54
+ console.error(error.stack);
55
+ process.exit(1);
56
+ }
57
+ });
58
+
59
+ program.parse(process.argv);
60
+
61
+ if (!process.argv.slice(2).length) {
62
+ program.outputHelp();
63
+ }
package/config.js ADDED
@@ -0,0 +1,137 @@
1
+ // config.js (for docmd's own documentation)
2
+ module.exports = {
3
+ // Core Site Metadata
4
+ siteTitle: 'docmd',
5
+ // Define a base URL for your site, crucial for SEO and absolute paths
6
+ // No trailing slash
7
+ siteUrl: 'https://docmd.mgks.dev', // Replace with your actual deployed URL
8
+
9
+ // Logo Configuration
10
+ logo: {
11
+ light: '/assets/images/logo-light.png', // Path relative to outputDir root
12
+ dark: '/assets/images/logo-dark.png', // Path relative to outputDir root
13
+ alt: 'docmd Logo', // Alt text for the logo
14
+ href: '/', // Link for the logo, defaults to site root
15
+ // height: '30px', // Optional: control via CSS is often better
16
+ },
17
+
18
+ // Directory Configuration
19
+ srcDir: 'docs', // Source directory for Markdown files
20
+ outputDir: 'site', // Directory for generated static site
21
+
22
+ // Theme Configuration
23
+ theme: {
24
+ name: 'sky', // Themes: 'default', 'sky'
25
+ defaultMode: 'light', // Initial color mode: 'light' or 'dark'
26
+ enableModeToggle: true, // Show UI button to toggle light/dark modes
27
+ customCss: [ // Array of paths to custom CSS files
28
+ '/assets/css/toc.css', // Custom TOC styles
29
+ ],
30
+ // options: { /* Future: theme-specific options */ }
31
+ },
32
+
33
+ // Custom JavaScript Files
34
+ customJs: [ // Array of paths to custom JS files, loaded at end of body
35
+ // '/assets/js/custom-script.js', // Paths relative to outputDir root
36
+ ],
37
+
38
+ // Plugins Configuration (Object format)
39
+ // Plugins are configured here. docmd will look for these keys.
40
+ plugins: {
41
+ // SEO Plugin Configuration
42
+ // Most SEO data is pulled from page frontmatter (title, description, image, etc.)
43
+ // These are fallbacks or site-wide settings.
44
+ seo: {
45
+ // Default meta description if a page doesn't have one in its frontmatter
46
+ defaultDescription: 'docmd is a Node.js command-line tool for generating beautiful, lightweight static documentation sites from Markdown files.',
47
+ openGraph: { // For Facebook, LinkedIn, etc.
48
+ // siteName: 'docmd Documentation', // Optional, defaults to config.siteTitle
49
+ // Default image for `og:image` if not specified in page frontmatter
50
+ // Path relative to outputDir root
51
+ defaultImage: '/assets/images/docmd-preview.png',
52
+ },
53
+ twitter: { // For Twitter Cards
54
+ cardType: 'summary_large_image', // 'summary', 'summary_large_image'
55
+ // siteUsername: '@docmd_handle', // Your site's Twitter handle (optional)
56
+ // creatorUsername: '@your_handle', // Default author handle (optional, can be overridden in frontmatter)
57
+ }
58
+ },
59
+ // Analytics Plugin Configuration
60
+ analytics: {
61
+ // Google Analytics 4 (GA4)
62
+ googleV4: {
63
+ measurementId: 'G-8QVBDQ4KM1' // Replace with your actual GA4 Measurement ID
64
+ },
65
+ // Google Universal Analytics (UA) - Legacy (optional)
66
+ // googleUA: {
67
+ // trackingId: 'UA-XXXXXXXXX-Y' // Replace with your actual UA Tracking ID
68
+ // }
69
+ },
70
+ // Enable Sitemap plugin
71
+ sitemap: {
72
+ defaultChangefreq: 'weekly',
73
+ defaultPriority: 0.8
74
+ }
75
+ // Add other future plugin configurations here by their key
76
+ },
77
+
78
+ // Navigation Structure (Sidebar)
79
+ // Icons are kebab-case names from Lucide Icons (https://lucide.dev/)
80
+ navigation: [
81
+ { title: 'GitHub', path: 'https://github.com/mgks/docmd', icon: 'github', external: true },
82
+ { title: 'Home', path: '/', icon: 'home' }, // Corresponds to docs/index.md
83
+ {
84
+ title: 'Getting Started',
85
+ icon: 'rocket', // Lucide: rocket
86
+ path: '/getting-started/', // Path to the index.md in this folder
87
+ children: [
88
+ { title: 'Installation', path: '/getting-started/installation', icon: 'download' }, // Lucide: download
89
+ { title: 'Basic Usage', path: '/getting-started/basic-usage', icon: 'play' }, // Lucide: play
90
+ ],
91
+ },
92
+ {
93
+ title: 'Writing Content',
94
+ icon: 'pencil', // Lucide: pencil
95
+ path: '/writing-content/',
96
+ children: [
97
+ { title: 'Frontmatter', path: '/writing-content/frontmatter', icon: 'file-text' }, // Lucide: file-text
98
+ { title: 'Markdown Syntax', path: '/writing-content/markdown-syntax', icon: 'code-2' }, // Lucide: code-2
99
+ { title: 'Custom Containers', path: '/writing-content/custom-containers', icon: 'box' }, // Lucide: box
100
+ ],
101
+ },
102
+ { title: 'Configuration', path: '/configuration', icon: 'settings' }, // Lucide: settings or cog
103
+ {
104
+ title: 'Theming',
105
+ icon: 'palette', // Lucide: palette
106
+ path: '/theming/',
107
+ children: [
108
+ { title: 'Available Themes', path: '/theming/available-themes', icon: 'layout-grid' }, // Lucide: layout-grid
109
+ { title: 'Light & Dark Mode', path: '/theming/light-dark-mode', icon: 'sun-moon' }, // Lucide: sun-moon
110
+ { title: 'Custom CSS & JS', path: '/theming/custom-css-js', icon: 'file-code' }, // Lucide: file-code
111
+ { title: 'Icons', path: '/theming/icons', icon: 'image' }, // Lucide: image
112
+ ],
113
+ },
114
+ {
115
+ title: 'Plugins',
116
+ icon: 'puzzle', // Lucide: puzzle
117
+ path: '/plugins/',
118
+ children: [
119
+ { title: 'SEO & Meta Tags', path: '/plugins/seo', icon: 'search' }, // Lucide: search
120
+ { title: 'Analytics', path: '/plugins/analytics', icon: 'bar-chart' }, // Lucide: bar-chart
121
+ { title: 'Sitemap', path: '/plugins/sitemap', icon: 'map' }, // Lucide: map
122
+ ],
123
+ },
124
+ { title: 'CLI Commands', path: '/cli-commands', icon: 'terminal' }, // Lucide: terminal
125
+ { title: 'Deployment', path: '/deployment', icon: 'upload-cloud' }, // Lucide: upload-cloud
126
+ { title: 'Contributing', path: '/contributing', icon: 'users-2' }, // Lucide: users-2
127
+ // Example of an external link:
128
+ ],
129
+
130
+ // Footer Configuration
131
+ // Markdown is supported here.
132
+ footer: '© ' + new Date().getFullYear() + ' Project docmd.',
133
+
134
+ // Favicon Configuration
135
+ // Path relative to outputDir root
136
+ favicon: '/assets/favicon.ico',
137
+ };
@@ -0,0 +1,87 @@
1
+ ---
2
+ title: "CLI Commands"
3
+ description: "A reference guide to all available docmd command-line interface (CLI) commands and their options."
4
+ ---
5
+
6
+ # CLI Commands
7
+
8
+ `docmd` provides a set of commands to help you initialize, build, and preview your documentation site.
9
+
10
+ ## `docmd init`
11
+
12
+ Initializes a new `docmd` project in the current directory.
13
+
14
+ **Usage:**
15
+ ```bash
16
+ docmd init
17
+ ```
18
+
19
+ **Description:**
20
+ This command creates the basic file and directory structure required for a `docmd` project:
21
+ * `docs/`: A directory to store your Markdown source files.
22
+ * `docs/index.md`: A sample Markdown file.
23
+ * `config.js`: The main configuration file for your site, pre-filled with default settings.
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.
26
+
27
+ **Options:**
28
+ This command currently does not take any options.
29
+
30
+ ## `docmd build`
31
+
32
+ Builds your static documentation site.
33
+
34
+ **Usage:**
35
+ ```bash
36
+ docmd build [options]
37
+ ```
38
+
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/`).
41
+
42
+ The output `site/` directory contains all the HTML, CSS, JavaScript, and other assets needed to deploy your documentation.
43
+
44
+ **Options:**
45
+
46
+ * `-c, --config <path>`
47
+ * **Default:** `config.js`
48
+ * **Description:** Specifies the path to the configuration file. Useful if your config file is not named `config.js` or is not in the project root.
49
+ * **Example:** `docmd build --config my.docmd.config.js`
50
+
51
+ ## `docmd dev`
52
+
53
+ Starts a local development server with live reloading.
54
+
55
+ **Usage:**
56
+ ```bash
57
+ docmd dev [options]
58
+ ```
59
+
60
+ **Description:**
61
+ The `dev` command is essential for writing and previewing your documentation. It:
62
+ 1. Performs an initial build of your site.
63
+ 2. Starts a local web server (usually on `http://localhost:3000`).
64
+ 3. Watches your source files (`docs/` directory, `config.js`, and internal `docmd` theme assets) for changes.
65
+ 4. When a change is detected, it automatically rebuilds the necessary parts of your site and triggers a live reload in your browser.
66
+
67
+ This provides a fast feedback loop, allowing you to see your changes almost instantly.
68
+
69
+ **Options:**
70
+
71
+ * `-c, --config <path>`
72
+ * **Default:** `config.js`
73
+ * **Description:** Specifies the path to the configuration file.
74
+ * **Example:** `docmd dev --config my.docmd.config.js`
75
+ * `-p, --port <port_number>` (Future Option)
76
+ * **Description:** While not yet implemented, a future version might allow specifying a custom port for the development server. Currently, it defaults to port 3000 or the next available port if 3000 is in use.
77
+
78
+ ## Global Options (Apply to all commands)
79
+
80
+ * `--version`
81
+ * **Usage:** `docmd --version`
82
+ * **Description:** Displays the installed version of `docmd`.
83
+ * `--help`
84
+ * **Usage:** `docmd --help` or `docmd <command> --help` (e.g., `docmd build --help`)
85
+ * **Description:** Displays help information for `docmd` or a specific command, including available options.
86
+
87
+ This reference should help you effectively use `docmd` from your command line. For more detailed explanations of how these commands fit into the workflow, see the [Getting Started > Basic Usage](/getting-started/basic-usage/) guide.