@mgks/docmd 0.3.2 → 0.3.3

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 (77) hide show
  1. package/README.md +5 -1
  2. package/package.json +28 -24
  3. package/.gitattributes +0 -2
  4. package/.github/CODE_OF_CONDUCT.md +0 -48
  5. package/.github/CONTRIBUTING.md +0 -129
  6. package/.github/FUNDING.yml +0 -15
  7. package/.github/ISSUE_TEMPLATE/bug_report.yml +0 -58
  8. package/.github/ISSUE_TEMPLATE/feature_request.yml +0 -27
  9. package/.github/PULL_REQUEST_TEMPLATE.md +0 -16
  10. package/.github/SECURITY.md +0 -18
  11. package/.github/workflows/deploy-docmd.yml +0 -45
  12. package/.github/workflows/npm-publish.yml +0 -49
  13. package/assets/css/welcome.css +0 -6
  14. package/assets/images/preview-dark-1.webp +0 -0
  15. package/assets/images/preview-dark-2.webp +0 -0
  16. package/assets/images/preview-dark-3.webp +0 -0
  17. package/assets/images/preview-dark-welcome.png +0 -0
  18. package/assets/images/preview-light-1.webp +0 -0
  19. package/assets/images/preview-light-2.webp +0 -0
  20. package/assets/images/preview-light-3.webp +0 -0
  21. package/docs/cli-commands.md +0 -108
  22. package/docs/comparison.md +0 -56
  23. package/docs/configuration.md +0 -289
  24. package/docs/content/containers/buttons.md +0 -88
  25. package/docs/content/containers/callouts.md +0 -154
  26. package/docs/content/containers/cards.md +0 -93
  27. package/docs/content/containers/changelogs.md +0 -128
  28. package/docs/content/containers/collapsible.md +0 -89
  29. package/docs/content/containers/index.md +0 -35
  30. package/docs/content/containers/nested-containers.md +0 -329
  31. package/docs/content/containers/steps.md +0 -175
  32. package/docs/content/containers/tabs.md +0 -228
  33. package/docs/content/custom-containers.md +0 -24
  34. package/docs/content/frontmatter.md +0 -84
  35. package/docs/content/images.md +0 -205
  36. package/docs/content/index.md +0 -19
  37. package/docs/content/markdown-syntax.md +0 -309
  38. package/docs/content/mermaid.md +0 -723
  39. package/docs/content/no-style-example.md +0 -112
  40. package/docs/content/no-style-pages.md +0 -226
  41. package/docs/content/search.md +0 -68
  42. package/docs/contributing.md +0 -101
  43. package/docs/deployment.md +0 -120
  44. package/docs/getting-started/basic-usage.md +0 -89
  45. package/docs/getting-started/index.md +0 -21
  46. package/docs/getting-started/installation.md +0 -75
  47. package/docs/index.md +0 -168
  48. package/docs/overview.md +0 -63
  49. package/docs/plugins/analytics.md +0 -75
  50. package/docs/plugins/index.md +0 -70
  51. package/docs/plugins/seo.md +0 -127
  52. package/docs/plugins/sitemap.md +0 -87
  53. package/docs/recipes/custom-fonts.md +0 -43
  54. package/docs/recipes/favicon.md +0 -38
  55. package/docs/recipes/index.md +0 -12
  56. package/docs/recipes/landing-page.md +0 -46
  57. package/docs/theming/assets-management.md +0 -126
  58. package/docs/theming/available-themes.md +0 -77
  59. package/docs/theming/custom-css-js.md +0 -79
  60. package/docs/theming/icons.md +0 -92
  61. package/docs/theming/index.md +0 -19
  62. package/docs/theming/light-dark-mode.md +0 -114
  63. package/src/assets/css/docmd-highlight-dark.css +0 -1
  64. package/src/assets/css/docmd-highlight-light.css +0 -1
  65. package/src/assets/css/docmd-main.css +0 -1627
  66. package/src/assets/css/docmd-theme-retro.css +0 -868
  67. package/src/assets/css/docmd-theme-ruby.css +0 -629
  68. package/src/assets/css/docmd-theme-sky.css +0 -618
  69. package/src/assets/favicon.ico +0 -0
  70. package/src/assets/images/docmd-logo-dark.png +0 -0
  71. package/src/assets/images/docmd-logo-light.png +0 -0
  72. package/src/assets/images/docmd-logo.png +0 -0
  73. package/src/assets/images/docmd-preview.png +0 -0
  74. package/src/assets/js/docmd-image-lightbox.js +0 -74
  75. package/src/assets/js/docmd-main.js +0 -285
  76. package/src/assets/js/docmd-mermaid.js +0 -205
  77. package/src/assets/js/docmd-search.js +0 -218
@@ -1,112 +0,0 @@
1
- ---
2
- title: "No-Style Page Example"
3
- description: "An example of a page using the no-style feature"
4
- noStyle: true
5
- components:
6
- meta: true
7
- favicon: true
8
- css: true
9
- theme: true
10
- scripts: true
11
- mainScripts: true
12
- copyCode: true
13
- customHead: |
14
- <style>
15
- body {
16
- font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
17
- margin: 0;
18
- padding: 0;
19
- line-height: 1.6;
20
- }
21
- .container {
22
- max-width: 800px;
23
- margin: 0 auto;
24
- padding: 40px 20px;
25
- }
26
- .header {
27
- text-align: center;
28
- margin-bottom: 40px;
29
- }
30
- .header h1 {
31
- font-size: 3rem;
32
- margin-bottom: 10px;
33
- color: #4a6cf7;
34
- }
35
- .header p {
36
- font-size: 1.2rem;
37
- color: #666;
38
- }
39
- .content {
40
- background-color: #f8f9fa;
41
- padding: 30px;
42
- border-radius: 8px;
43
- box-shadow: 0 2px 10px rgba(0,0,0,0.05);
44
- }
45
- .button {
46
- display: inline-block;
47
- padding: 12px 24px;
48
- background-color: #4a6cf7;
49
- color: white;
50
- text-decoration: none;
51
- border-radius: 4px;
52
- font-weight: 600;
53
- margin-top: 20px;
54
- }
55
- .button:hover {
56
- background-color: #3a5ce4;
57
- }
58
- [data-theme="dark"] {
59
- color-scheme: dark;
60
- }
61
- [data-theme="dark"] body {
62
- background-color: #121212;
63
- color: #e0e0e0;
64
- }
65
- [data-theme="dark"] .content {
66
- background-color: #1e1e1e;
67
- box-shadow: 0 2px 10px rgba(0,0,0,0.2);
68
- }
69
- [data-theme="dark"] .header p {
70
- color: #aaa;
71
- }
72
- </style>
73
- bodyClass: "no-style-example"
74
- ---
75
-
76
- <div class="container">
77
- <div class="header">
78
- <h1>No-Style Page Example</h1>
79
- <p>This page demonstrates the no-style feature with a custom layout</p>
80
- </div>
81
-
82
- <div class="content">
83
- <h2>What is this page?</h2>
84
- <p>
85
- This is an example page that uses the <code>noStyle: true</code> frontmatter option to create a completely custom page layout.
86
- Unlike regular documentation pages, this page doesn't use the standard docmd layout with sidebar navigation and table of contents.
87
- </p>
88
-
89
- <h2>How does it work?</h2>
90
- <p>
91
- The <code>noStyle</code> option tells docmd to use a special template that only includes the components you explicitly request
92
- via the <code>components</code> object in frontmatter. This gives you complete control over the page structure.
93
- </p>
94
-
95
- <h2>Features enabled on this page:</h2>
96
- <ul>
97
- <li><strong>meta</strong>: Meta tags, title, and description for SEO</li>
98
- <li><strong>favicon</strong>: The site favicon</li>
99
- <li><strong>css</strong>: Basic CSS for markdown content</li>
100
- <li><strong>theme</strong>: Theme support for light/dark mode</li>
101
- <li><strong>scripts</strong>: JavaScript for functionality</li>
102
- </ul>
103
-
104
- <h2>Custom styling</h2>
105
- <p>
106
- This page includes custom CSS in the <code>customHead</code> frontmatter field. This allows you to define page-specific styles
107
- without affecting the rest of your site.
108
- </p>
109
-
110
- <a href="/content/no-style-pages/" class="button">Get Back to No-Style Pages Documentation</a>
111
- </div>
112
- </div>
@@ -1,226 +0,0 @@
1
- ---
2
- title: "No-Style Pages"
3
- description: "Create custom standalone pages with minimal styling and only the components you need."
4
- ---
5
-
6
- # No-Style Pages
7
-
8
- docmd offers a "no-style" page format that gives you maximum flexibility to create custom standalone pages while still leveraging the docmd infrastructure. This is perfect for creating:
9
-
10
- - Landing pages with custom layouts
11
- - Welcome pages with unique designs
12
- - Single-page websites
13
- - Special marketing pages
14
- - Any page that needs a completely custom design
15
-
16
- ## How It Works
17
-
18
- To create a no-style page, add `noStyle: true` to your page's frontmatter. This tells docmd to use a special template that only includes the components you explicitly request.
19
-
20
- By default, a no-style page will render just your content with minimal HTML structure. **All components are disabled by default** and must be explicitly enabled via the `components` object in frontmatter.
21
-
22
- > **Note:** This behavior changed in v0.2.0. Previously, some components were enabled by default and had to be disabled. Now all components are opt-in only.
23
-
24
- ## HTML Support
25
-
26
- No-style pages fully support raw HTML content without any escaping or processing. You can write pure HTML in your markdown files, and it will be rendered exactly as written. This gives you complete control over the page structure and design.
27
-
28
- Unlike regular markdown pages, where HTML might be processed or escaped, no-style pages treat your content as raw HTML, making them perfect for custom layouts and designs.
29
-
30
- ## Basic Example
31
-
32
- Here's a minimal example of a no-style page:
33
-
34
- ```yaml
35
- ---
36
- title: "Welcome"
37
- description: "Welcome to my project"
38
- noStyle: true
39
- components:
40
- meta: true # Include meta tags, title, description
41
- # css: false # Not needed - CSS is disabled by default
42
- ---
43
-
44
- <div style="text-align: center; padding: 50px;">
45
- <h1>Welcome to My Project</h1>
46
- <p>This is a completely custom page with only the components I need.</p>
47
- <a href="/docs/" class="button">View Documentation</a>
48
- </div>
49
- ```
50
-
51
- ## Available Components
52
-
53
- You can control exactly which components are included in your page by setting them to `true` in the `components` object. **All components are disabled by default** and must be explicitly enabled:
54
-
55
- | Component | Description | Required Setting |
56
- |-----------|-------------|------------------|
57
- | `meta` | Meta tags, title, description | `meta: true` |
58
- | `siteTitle` | Include site title after page title | `siteTitle: true` |
59
- | `favicon` | Include favicon | `favicon: true` |
60
- | `css` | Include main CSS | `css: true` |
61
- | `highlight` | Include syntax highlighting CSS | `highlight: true` |
62
- | `theme` | Include theme-specific CSS | `theme: true` |
63
- | `themeMode` | Include theme mode toggle functionality | `themeMode: true` |
64
- | `customCss` | Include custom CSS files from config | `customCss: true` |
65
- | `pluginStyles` | Include plugin-specific CSS | `pluginStyles: true` |
66
- | `pluginHeadScripts` | Include plugin scripts in head | `pluginHeadScripts: true` |
67
- | `layout` | Use main content layout (`true`, `'full'`, or `false`) | `layout: true` or `layout: 'full'` |
68
- | `sidebar` | Include sidebar | `sidebar: true` |
69
- | `header` | Include page header | `header: true` |
70
- | `pageTitle` | Include page title in header | `pageTitle: true` |
71
- | `footer` | Include page footer | `footer: true` |
72
- | `branding` | Include docmd branding in footer | `branding: true` |
73
- | `logo` | Include logo in sidebar | `logo: true` |
74
- | `navigation` | Include navigation in sidebar | `navigation: true` |
75
- | `themeToggle` | Include theme toggle button | `themeToggle: true` |
76
- | `toc` | Include table of contents | `toc: true` |
77
- | `scripts` | Enable script loading (required for other script components) | `scripts: true` |
78
- | `mainScripts` | Include main JavaScript (copy code, theme toggle, etc.) | `mainScripts: true` |
79
- | `lightbox` | Include image lightbox functionality | `lightbox: true` |
80
- | `customJs` | Include custom JS files from config | `customJs: true` |
81
- | `pluginBodyScripts` | Include plugin scripts at end of body | `pluginBodyScripts: true` |
82
-
83
- ## Layout Options
84
-
85
- The `components.layout` property has three possible values:
86
-
87
- - `false` (default): No layout wrapper, just your raw content
88
- - `true`: Use the main content layout with optional header and footer
89
- - `'full'`: Same as `true`, a full layout with content area
90
-
91
- ## Script Components
92
-
93
- Script components work in a hierarchical manner:
94
-
95
- 1. **`scripts: true`** - Enables script loading (required for all other script components)
96
- 2. **`mainScripts: true`** - Includes main JavaScript functionality (copy code, theme toggle, etc.)
97
- 3. **`lightbox: true`** - Includes image lightbox functionality (requires `mainScripts: true`)
98
-
99
- **Example:**
100
- ```yaml
101
- components:
102
- scripts: true # Enable script loading
103
- mainScripts: true # Include main JavaScript
104
- lightbox: true # Include lightbox (requires mainScripts)
105
- ```
106
-
107
- ## Sidebar Option
108
-
109
- If you set `components.sidebar: true`, the sidebar will be included with optional logo, navigation, and theme toggle button.
110
-
111
- ## Custom HTML in Head and Body
112
-
113
- You can also include custom HTML in the head and body sections:
114
-
115
- ```yaml
116
- ---
117
- title: "Custom Page"
118
- noStyle: true
119
- customHead: |
120
- <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" rel="stylesheet">
121
- <style>
122
- body { font-family: 'Roboto', sans-serif; }
123
- </style>
124
- customScripts: |
125
- <script>
126
- document.addEventListener('DOMContentLoaded', () => {
127
- console.log('Page loaded!');
128
- });
129
- </script>
130
- bodyClass: "landing-page"
131
- ---
132
- ```
133
-
134
- ## Complete Example
135
-
136
- Here's a more complete example of a landing page:
137
-
138
- ```yaml
139
- ---
140
- title: "My Project"
141
- description: "A powerful tool for developers"
142
- noStyle: true
143
- components:
144
- meta: true
145
- favicon: true
146
- css: true
147
- theme: true
148
- themeMode: true
149
- layout: true
150
- header: true
151
- pageTitle: true
152
- footer: true
153
- branding: true
154
- scripts: true
155
- mainScripts: true
156
- lightbox: true
157
- customHead: |
158
- <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap" rel="stylesheet">
159
- <style>
160
- body { font-family: 'Poppins', sans-serif; }
161
- .hero { text-align: center; padding: 80px 20px; }
162
- .cta-button { display: inline-block; padding: 12px 24px; background: #4a6cf7; color: white;
163
- text-decoration: none; border-radius: 4px; font-weight: 600; }
164
- </style>
165
- bodyClass: "landing-page"
166
- ---
167
-
168
- <div class="hero">
169
- <h1>Welcome to My Project</h1>
170
- <p>A powerful tool that helps developers build amazing things.</p>
171
- <a href="/docs/" class="cta-button">Get Started</a>
172
- </div>
173
-
174
- <div class="features">
175
- <div class="feature">
176
- <h2>Easy to Use</h2>
177
- <p>Simple API and clear documentation make it easy to get started.</p>
178
- </div>
179
- <div class="feature">
180
- <h2>Powerful</h2>
181
- <p>Advanced features for when you need them.</p>
182
- </div>
183
- <div class="feature">
184
- <h2>Flexible</h2>
185
- <p>Adapt to your workflow, not the other way around.</p>
186
- </div>
187
- </div>
188
- ```
189
-
190
- ## HTML and Markdown Mixed Content
191
-
192
- No-style pages support both HTML and Markdown content. You can freely mix them in your page:
193
-
194
- ```markdown
195
- ---
196
- title: "Mixed Content"
197
- noStyle: true
198
- components:
199
- meta: true
200
- css: true
201
- ---
202
-
203
- <div style="text-align: center">
204
- <h1>My Custom Page</h1>
205
- </div>
206
-
207
- ## Regular Markdown Heading
208
-
209
- This is regular **Markdown** content that will be processed normally.
210
-
211
- <div class="custom-section">
212
- <h3>HTML Section</h3>
213
- <p>This is HTML content within the page.</p>
214
- </div>
215
-
216
- - Markdown list item 1
217
- - Markdown list item 2
218
- ```
219
-
220
- ## Best Practices
221
-
222
- 1. Start with minimal components and add only what you need
223
- 2. Use the `customHead` property for page-specific styles
224
- 3. Consider creating a separate CSS file for your custom pages
225
- 4. Test your page in both light and dark modes if using theme support
226
- 5. Remember that no-style pages still benefit from docmd's plugins (SEO, analytics, etc.)
@@ -1,68 +0,0 @@
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.
@@ -1,101 +0,0 @@
1
- ---
2
- title: "Contributing to docmd"
3
- description: "Learn how you can contribute to the development and improvement of docmd."
4
- ---
5
-
6
- # Contributing to docmd
7
-
8
- Thank you for your interest in contributing to `docmd`! We welcome contributions from the community to help make `docmd` even better. Whether it's reporting a bug, suggesting a feature, improving documentation, or writing code, your help is appreciated.
9
-
10
- ## How to Contribute
11
-
12
- There are many ways to contribute to `docmd`:
13
-
14
- * **Reporting Bugs:** If you find a bug, please open an issue on our [GitHub Issues page](https://github.com/mgks/docmd/issues). Provide as much detail as possible, including steps to reproduce, expected behavior, and actual behavior.
15
- * **Suggesting Features:** Have ideas for improvements? Open an issue and describe what you'd like to see.
16
- * **Improving Documentation:** The documentation you're reading now (this site itself!) is built with `docmd` and lives in the `docs/` directory of the repository.
17
- * **Writing Code:** If you're interested in fixing bugs or implementing new features, read on for development setup instructions.
18
-
19
- ## Development Setup
20
-
21
- To set up `docmd` for local development:
22
-
23
- 1. **Fork the Repository:**
24
- Click the "Fork" button on the [docmd GitHub page](https://github.com/mgks/docmd) to create your own copy.
25
-
26
- 2. **Clone Your Fork:**
27
- ```bash
28
- git clone https://github.com/YOUR_USERNAME/docmd.git
29
- cd docmd
30
- ```
31
-
32
- 3. **Install Dependencies:**
33
- ```bash
34
- npm install
35
- ```
36
-
37
- ### Development Workflow
38
-
39
- `docmd` uses Node.js and npm.
40
-
41
- 1. **Make Your Changes:**
42
- * Fix bugs or add features in the `/src` directory.
43
- * Add or update tests in the `/tests` directory (if applicable).
44
- * Update or add documentation in the `/docs` directory to reflect your changes.
45
-
46
- 2. **Link for Local Testing:**
47
- To use your development version of `docmd` as a global command-line tool on your system:
48
- ```bash
49
- npm link
50
- ```
51
- This allows you to run `docmd` from any directory and test your changes.
52
-
53
- 3. **Test Your Changes:**
54
- * Run automated tests with `npm test` (if available).
55
- * Test your changes by running `docmd build` or `docmd dev` (which will use `docmd` itself to build its own documentation located in `docs/`).
56
-
57
- 4. **Code Style:**
58
- * Follow the existing code style and formatting.
59
- * Consider running `npm run lint` to check for style issues (if set up).
60
-
61
- ### Environment Setup
62
-
63
- To enable live change tracking for internal files during development, set the DOCMD_DEV environment variable:
64
-
65
- - **Temporarily:** Run `export DOCMD_DEV=true` in your terminal before starting the dev server.
66
- - **Permanently:** Add `export DOCMD_DEV=true` to your `~/.zshrc` file and run `source ~/.zshrc`.
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
-
76
- ## Pull Request Process
77
-
78
- Once you're satisfied with your changes:
79
-
80
- 1. **Commit Your Changes:**
81
- ```bash
82
- git add .
83
- git commit -m "Brief description of your changes"
84
- ```
85
-
86
- 2. **Push to Your Fork:**
87
- ```bash
88
- git push origin main # or the branch you created
89
- ```
90
-
91
- 3. **Submit a Pull Request:**
92
- Go to your fork on GitHub and open a pull request to the `main` branch of the original `mgks/docmd` repository. Provide a clear description of your changes.
93
-
94
- 4. **Code Review:**
95
- Maintainers will review your PR and may suggest changes or improvements. Please be responsive to feedback.
96
-
97
- ## Code of Conduct
98
-
99
- Please be respectful and considerate when interacting with others in the project. We aim to foster an inclusive and welcoming community.
100
-
101
- Thank you for helping make `docmd` a great tool for documentation!
@@ -1,120 +0,0 @@
1
- ---
2
- title: "Deployment"
3
- description: "Learn how to deploy your docmd-generated static site to various hosting platforms, including GitHub Pages."
4
- ---
5
-
6
- # Deploying Your docmd Site
7
-
8
- Once you've built your documentation site using `docmd build`, the entire static site is generated into the `site/` directory (or your configured `outputDir`). This `site/` directory contains all the HTML, CSS, JavaScript, and assets needed, making it deployable to any static hosting service.
9
-
10
- ## Building for Production
11
-
12
- Before deployment, ensure you build your site in production mode:
13
-
14
- ```bash
15
- docmd build
16
- ```
17
-
18
- This generates optimized HTML, CSS, and assets ready for production use. In production, `docmd` may:
19
- - Minify CSS and JavaScript assets (future feature)
20
- - Optimize HTML output
21
-
22
- ## Deployment Options
23
-
24
- Since `docmd` generates a standard static site, you can use any static hosting service. Here are some popular options:
25
-
26
- ### GitHub Pages
27
-
28
- GitHub Pages is a popular and free way to host static sites directly from your GitHub repository. `docmd` sites are perfectly suited for this.
29
-
30
- #### Option 1: Deploy from a Branch
31
-
32
- 1. **Push your source files and built site to GitHub.**
33
- 2. **Go to your repository settings.**
34
- 3. **Navigate to the "Pages" section.**
35
- 4. **Under "Source", select the branch and directory where your built site is located.**
36
-
37
- The simplest approach is to choose one of:
38
-
39
- * **Built site in the `docs/` folder on the main branch:**
40
- * Configure `docmd`'s `outputDir` to be `docs` in your `docmd.config.js` (e.g., `outputDir: 'docs'`).
41
- * Select "Deploy from a branch" → "main" → "/docs"
42
-
43
- If you set `outputDir: 'docs'`, your `docmd.config.js` for `docmd` itself (when building its own docs) would look like:
44
-
45
- ```javascript
46
- // docmd.config.js for docmd's own docs, deploying from /docs on main
47
- module.exports = {
48
- siteTitle: 'docmd Docs',
49
- srcDir: 'documentation', // Assuming actual source MD files are NOT in the output 'docs'
50
- outputDir: 'docs',
51
- // ... other config ...
52
- };
53
- ```
54
-
55
- #### Option 2: GitHub Actions (Recommended)
56
-
57
- The most robust and automated way to deploy to GitHub Pages is using a GitHub Actions workflow. This workflow will run `docmd build` and then deploy the resulting `site/` directory.
58
-
59
- Create a file at `.github/workflows/deploy-docs.yml` with the following content:
60
-
61
- ```yaml
62
- name: Deploy docmd docs to GitHub Pages
63
-
64
- on:
65
- push:
66
- branches: ["main"] # Your default branch
67
- workflow_dispatch: # Allows manual workflow trigger from Actions tab
68
-
69
- # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
70
- permissions:
71
- contents: read
72
- pages: write
73
- id-token: write
74
-
75
- jobs:
76
- build-and-deploy:
77
- runs-on: ubuntu-latest
78
- environment:
79
- name: github-pages
80
- url: ${{ steps.deployment.outputs.page_url }}
81
- steps:
82
- - name: Checkout
83
- uses: actions/checkout@v4
84
-
85
- - name: Set up Node.js
86
- uses: actions/setup-node@v4
87
- with:
88
- node-version: '22'
89
- cache: 'npm'
90
-
91
- - name: Install docmd (globally or from devDependencies)
92
- run: npm install -g @mgks/docmd
93
-
94
- - name: Build site with docmd
95
- run: docmd build # Assumes docmd.config.js is in the root and correctly points to srcDir/outputDir
96
-
97
- - name: Setup Pages
98
- uses: actions/configure-pages@v5
99
-
100
- - name: Upload artifact
101
- uses: actions/upload-pages-artifact@v3
102
- with:
103
- path: ./site # This should be your outputDir path
104
-
105
- - name: Deploy to GitHub Pages
106
- id: deployment
107
- uses: actions/deploy-pages@v4
108
- ```
109
-
110
- Then:
111
- 1. **Enable GitHub Pages in your repository settings**, selecting "GitHub Actions" as the source.
112
- 2. **Push the workflow file to your repository**.
113
- 3. On the next push to `main` (or if you manually trigger the workflow), the Action will run, build your `docmd` site, and deploy it. The URL will be something like `https://YOUR_USERNAME.github.io/YOUR_REPOSITORY/`.
114
-
115
- ### Other Hosting Options
116
-
117
- * **Netlify, Vercel, Cloudflare Pages** - Upload or connect your Git repository and set the build command to your npm script that runs `docmd build`.
118
- * **Any Web Server** - Simply upload the contents of the `site/` directory to any web server that can serve static files.
119
-
120
- By following these guidelines, you can easily get your `docmd`-powered documentation online and accessible to your users.