@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.
- package/.gitattributes +2 -0
- package/.github/FUNDING.yml +15 -0
- package/.github/workflows/deploy-docmd.yml +45 -0
- package/.github/workflows/publish.yml +84 -0
- package/LICENSE +21 -0
- package/README.md +83 -0
- package/bin/docmd.js +63 -0
- package/config.js +137 -0
- package/docs/cli-commands.md +87 -0
- package/docs/configuration.md +166 -0
- package/docs/contributing.md +86 -0
- package/docs/deployment.md +129 -0
- package/docs/getting-started/basic-usage.md +88 -0
- package/docs/getting-started/index.md +21 -0
- package/docs/getting-started/installation.md +75 -0
- package/docs/index.md +56 -0
- package/docs/plugins/analytics.md +76 -0
- package/docs/plugins/index.md +71 -0
- package/docs/plugins/seo.md +79 -0
- package/docs/plugins/sitemap.md +88 -0
- package/docs/theming/available-themes.md +85 -0
- package/docs/theming/custom-css-js.md +84 -0
- package/docs/theming/icons.md +93 -0
- package/docs/theming/index.md +19 -0
- package/docs/theming/light-dark-mode.md +107 -0
- package/docs/writing-content/custom-containers.md +129 -0
- package/docs/writing-content/frontmatter.md +76 -0
- package/docs/writing-content/index.md +17 -0
- package/docs/writing-content/markdown-syntax.md +277 -0
- package/package.json +56 -0
- package/src/assets/css/highlight-dark.css +1 -0
- package/src/assets/css/highlight-light.css +1 -0
- package/src/assets/css/main.css +562 -0
- package/src/assets/css/theme-sky.css +499 -0
- package/src/assets/css/toc.css +76 -0
- package/src/assets/favicon.ico +0 -0
- package/src/assets/images/docmd-logo.png +0 -0
- package/src/assets/images/docmd-preview.png +0 -0
- package/src/assets/images/logo-dark.png +0 -0
- package/src/assets/images/logo-light.png +0 -0
- package/src/assets/js/theme-toggle.js +59 -0
- package/src/commands/build.js +300 -0
- package/src/commands/dev.js +182 -0
- package/src/commands/init.js +51 -0
- package/src/core/config-loader.js +28 -0
- package/src/core/file-processor.js +376 -0
- package/src/core/html-generator.js +139 -0
- package/src/core/icon-renderer.js +105 -0
- package/src/plugins/analytics.js +44 -0
- package/src/plugins/seo.js +65 -0
- package/src/plugins/sitemap.js +100 -0
- package/src/templates/layout.ejs +174 -0
- package/src/templates/navigation.ejs +107 -0
- package/src/templates/toc.ejs +34 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Configuration"
|
|
3
|
+
description: "Detailed explanation of all options available in the docmd config.js file, including logo, theming, plugins, and more."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Configuration (`config.js`)
|
|
7
|
+
|
|
8
|
+
`docmd` uses a `config.js` file in the root of your documentation project to control various aspects of your site. This file should export a JavaScript object containing your configuration options.
|
|
9
|
+
|
|
10
|
+
## Example `config.js` Structure:
|
|
11
|
+
|
|
12
|
+
```javascript
|
|
13
|
+
// config.js
|
|
14
|
+
module.exports = {
|
|
15
|
+
siteTitle: 'My Awesome Project Docs',
|
|
16
|
+
logo: {
|
|
17
|
+
light: '/assets/images/logo-light.svg', // Path to logo for light mode
|
|
18
|
+
dark: '/assets/images/logo-dark.svg', // Path to logo for dark mode
|
|
19
|
+
alt: 'My Project Logo', // Alt text for the logo
|
|
20
|
+
// href: '/', // Optional: link for the logo, defaults to site root
|
|
21
|
+
// height: '30px', // Optional: specify height via CSS is often better
|
|
22
|
+
},
|
|
23
|
+
srcDir: 'docs',
|
|
24
|
+
outputDir: 'site',
|
|
25
|
+
|
|
26
|
+
theme: {
|
|
27
|
+
name: 'default', // Name of the built-in theme to use (e.g., 'default', 'classic')
|
|
28
|
+
defaultMode: 'light', // 'light' or 'dark'
|
|
29
|
+
enableModeToggle: true, // Show UI button to toggle light/dark modes
|
|
30
|
+
customCss: [ // Array of paths to your custom CSS files
|
|
31
|
+
// '/css/override-styles.css', // Paths are relative to the outputDir root
|
|
32
|
+
],
|
|
33
|
+
// options: { /* Future: theme-specific options */ }
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
customJs: [ // Array of paths to your custom JS files
|
|
37
|
+
// '/js/extra-functionality.js', // Loaded at the end of the body
|
|
38
|
+
],
|
|
39
|
+
|
|
40
|
+
plugins: [
|
|
41
|
+
// Example: Enable built-in SEO enhancements
|
|
42
|
+
// ['seo', {
|
|
43
|
+
// defaultDescription: 'A fantastic site about interesting things.',
|
|
44
|
+
// openGraph: { defaultImage: '/assets/images/og-social-default.png' },
|
|
45
|
+
// twitter: { cardType: 'summary_large_image', siteUsername: '@MyProject' }
|
|
46
|
+
// }],
|
|
47
|
+
|
|
48
|
+
// Example: Enable Google Analytics (Universal Analytics)
|
|
49
|
+
// ['analytics-google-ua', { trackingId: 'UA-XXXXXXXXX-Y' }],
|
|
50
|
+
|
|
51
|
+
// Example: Enable Google Analytics 4
|
|
52
|
+
// ['analytics-google-v4', { measurementId: 'G-XXXXXXXXXX' }],
|
|
53
|
+
],
|
|
54
|
+
|
|
55
|
+
navigation: [
|
|
56
|
+
{ title: 'Home', path: '/', icon: 'home' }, // Icon names correspond to SVGs
|
|
57
|
+
{
|
|
58
|
+
title: 'Guides',
|
|
59
|
+
icon: 'book-open',
|
|
60
|
+
children: [
|
|
61
|
+
{ title: 'Installation', path: '/guides/installation', icon: 'download' },
|
|
62
|
+
{ title: 'Project GitHub', path: 'https://github.com/mgks/docmd', icon: 'github', external: true }
|
|
63
|
+
],
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
footer: '© ' + new Date().getFullYear() + ' My Project. Made with [docmd](https://github.com/mgks/docmd).',
|
|
67
|
+
favicon: '/assets/favicon.ico', // Path relative to outputDir root
|
|
68
|
+
};
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Top-Level Options
|
|
72
|
+
|
|
73
|
+
### `siteTitle`
|
|
74
|
+
* **Type:** `String`
|
|
75
|
+
* **Required:** Yes
|
|
76
|
+
* **Description:** The main title for your documentation site. Used as a fallback if no logo is provided, in the HTML `<title>` tag, and potentially by plugins (e.g., SEO).
|
|
77
|
+
* **Example:** `siteTitle: 'My Product Documentation'`
|
|
78
|
+
|
|
79
|
+
### `logo`
|
|
80
|
+
* **Type:** `Object`
|
|
81
|
+
* **Optional**
|
|
82
|
+
* **Description:** Configures a logo to be displayed in the site header/sidebar, typically replacing or complementing the `siteTitle` text.
|
|
83
|
+
* **Properties:**
|
|
84
|
+
* `light` (String, Required if using logo): Path to the logo image file for light mode. Path should be relative to the `outputDir` root (e.g., `/assets/images/logo-light.svg`).
|
|
85
|
+
* `dark` (String, Required if using logo): Path to the logo image file for dark mode.
|
|
86
|
+
* `alt` (String, Required if using logo): Alternative text for the logo image (for accessibility).
|
|
87
|
+
* `href` (String, Optional): The URL the logo should link to. Defaults to the site root (`/`).
|
|
88
|
+
* `height` (String, Optional): Suggested height for the logo (e.g., `'30px'`, `'2rem'`). It's often better to control size via CSS for more flexibility.
|
|
89
|
+
* **Note:** Ensure your logo image files are copied to the specified paths within your `outputDir` during the build. Usually, this means placing them in an assets folder that `docmd` copies.
|
|
90
|
+
|
|
91
|
+
### `srcDir`
|
|
92
|
+
* **Type:** `String`
|
|
93
|
+
* **Default:** `'docs'`
|
|
94
|
+
* **Description:** Directory containing your Markdown source files.
|
|
95
|
+
|
|
96
|
+
### `outputDir`
|
|
97
|
+
* **Type:** `String`
|
|
98
|
+
* **Default:** `'site'`
|
|
99
|
+
* **Description:** Directory where the static site will be generated.
|
|
100
|
+
|
|
101
|
+
## `theme` (Object)
|
|
102
|
+
|
|
103
|
+
Configures the visual theme of your site.
|
|
104
|
+
|
|
105
|
+
### `theme.name`
|
|
106
|
+
* **Type:** `String`
|
|
107
|
+
* **Default:** `'default'`
|
|
108
|
+
* **Description:** Specifies which built-in `docmd` theme to use. Future versions may offer multiple themes like `'classic'`, `'minimalist-pro'`. Each theme would correspond to a CSS file (e.g., `theme-default.css`).
|
|
109
|
+
* **See Also:** [Available Themes](/theming/available-themes/)
|
|
110
|
+
|
|
111
|
+
### `theme.defaultMode`
|
|
112
|
+
* **Type:** `String`
|
|
113
|
+
* **Default:** `'light'`
|
|
114
|
+
* **Values:** `'light'` or `'dark'`
|
|
115
|
+
* **Description:** Sets the default color mode (light or dark) for the site.
|
|
116
|
+
|
|
117
|
+
### `theme.enableModeToggle`
|
|
118
|
+
* **Type:** `Boolean`
|
|
119
|
+
* **Default:** `true` (assuming it's now a core feature)
|
|
120
|
+
* **Description:** If `true`, a UI toggle button will be displayed allowing users to switch between light and dark modes. Their preference is typically saved in `localStorage`.
|
|
121
|
+
|
|
122
|
+
### `theme.customCss`
|
|
123
|
+
* **Type:** `Array` of `String`
|
|
124
|
+
* **Default:** `[]` (empty array)
|
|
125
|
+
* **Description:** An array of paths to your custom CSS files. These files will be linked in the `<head>` of every page *after* the main theme CSS, allowing you to override or extend styles.
|
|
126
|
+
* **Paths:** Should be relative to the `outputDir` root (e.g., `'/css/my-styles.css'`). You are responsible for ensuring these files exist at the specified location in your final `site/` output (e.g., by placing them in an assets folder that `docmd` copies, or in your project's static assets if your `srcDir` is part of a larger project).
|
|
127
|
+
* **Example:** `customCss: ['/assets/css/custom-branding.css']`
|
|
128
|
+
|
|
129
|
+
### `theme.options` (Future Placeholder)
|
|
130
|
+
* **Type:** `Object`
|
|
131
|
+
* **Description:** A placeholder for theme-specific configuration options if a theme (`theme.name`) exposes its own settings (e.g., primary color, font choices for a more advanced theme).
|
|
132
|
+
|
|
133
|
+
## `customJs` (Array of String)
|
|
134
|
+
* **Type:** `Array` of `String`
|
|
135
|
+
* **Default:** `[]`
|
|
136
|
+
* **Description:** An array of paths to your custom JavaScript files. These files will be included as `<script>` tags just before the closing `</body>` tag on every page.
|
|
137
|
+
* **Paths:** Should be relative to the `outputDir` root (e.g., `'/js/my-analytics-alternative.js'`).
|
|
138
|
+
* **Example:** `customJs: ['/assets/js/interactive-component.js']`
|
|
139
|
+
|
|
140
|
+
## `plugins` (Array)
|
|
141
|
+
* **Type:** `Array`
|
|
142
|
+
* **Default:** `[]`
|
|
143
|
+
* **Description:** An array to configure and enable plugins. `docmd` will ship with some core "local" plugins (like SEO and Analytics) that you can enable here. Future versions might support third-party plugins.
|
|
144
|
+
* **Format:** Each item in the array is typically another array: `['plugin-name', { pluginOptions }]` or a direct `require()` for local project plugins (advanced usage).
|
|
145
|
+
* **Built-in Plugin Examples:**
|
|
146
|
+
* `['seo', { defaultDescription: '...', openGraph: { ... }, ... }]`
|
|
147
|
+
* `['analytics-google-ua', { trackingId: 'UA-...' }]`
|
|
148
|
+
* `['analytics-google-v4', { measurementId: 'G-...' }]`
|
|
149
|
+
* **See Also:** [Plugins](/plugins/)
|
|
150
|
+
|
|
151
|
+
## `navigation` (Array of Objects)
|
|
152
|
+
* **Description:** Defines the sidebar navigation. (Content mostly same as before, but add the `icon` property explanation).
|
|
153
|
+
* **Navigation Item Properties:**
|
|
154
|
+
* `title` (String, Required)
|
|
155
|
+
* `path` (String, Required for direct links)
|
|
156
|
+
* `children` (Array, Optional)
|
|
157
|
+
* `icon` (String, Optional): The name of an SVG icon to display next to the navigation item. `docmd` will look for an SVG file named `icon-name.svg` in its bundled assets (e.g., `home` for `home.svg`). Ensure the chosen icon name corresponds to an available SVG. See [Theming > Icons](/theming/icons/) for more details.
|
|
158
|
+
* `external` (Boolean, Optional): If set to `true`, the `path` is treated as an absolute external URL and the link will open in a new tab (`target="_blank"`). Defaults to `false`.
|
|
159
|
+
|
|
160
|
+
## `footer` (String, Optional)
|
|
161
|
+
* **Description:** Custom footer text (Markdown supported).
|
|
162
|
+
|
|
163
|
+
## `favicon` (String, Optional)
|
|
164
|
+
* **Description:** Path to your favicon file, relative to `outputDir` root.
|
|
165
|
+
|
|
166
|
+
This file needs significant detail for each new option, explaining its purpose, type, default value, and how to use it with examples.
|
|
@@ -0,0 +1,86 @@
|
|
|
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
|
+
## Pull Request Process
|
|
62
|
+
|
|
63
|
+
Once you're satisfied with your changes:
|
|
64
|
+
|
|
65
|
+
1. **Commit Your Changes:**
|
|
66
|
+
```bash
|
|
67
|
+
git add .
|
|
68
|
+
git commit -m "Brief description of your changes"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
2. **Push to Your Fork:**
|
|
72
|
+
```bash
|
|
73
|
+
git push origin main # or the branch you created
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
3. **Submit a Pull Request:**
|
|
77
|
+
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.
|
|
78
|
+
|
|
79
|
+
4. **Code Review:**
|
|
80
|
+
Maintainers will review your PR and may suggest changes or improvements. Please be responsive to feedback.
|
|
81
|
+
|
|
82
|
+
## Code of Conduct
|
|
83
|
+
|
|
84
|
+
Please be respectful and considerate when interacting with others in the project. We aim to foster an inclusive and welcoming community.
|
|
85
|
+
|
|
86
|
+
Thank you for helping make `docmd` a great tool for documentation!
|
|
@@ -0,0 +1,129 @@
|
|
|
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 `config.js` (e.g., `outputDir: 'docs'`).
|
|
41
|
+
* Select "Deploy from a branch" → "main" → "/docs"
|
|
42
|
+
|
|
43
|
+
If you set `outputDir: 'docs'`, your `config.js` for `docmd` itself (when building its own docs) would look like:
|
|
44
|
+
|
|
45
|
+
```javascript
|
|
46
|
+
// 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 Pages
|
|
63
|
+
|
|
64
|
+
on:
|
|
65
|
+
# Run on pushes to main branch
|
|
66
|
+
push:
|
|
67
|
+
branches: ["main"]
|
|
68
|
+
# Allows manual workflow trigger from Actions tab
|
|
69
|
+
workflow_dispatch:
|
|
70
|
+
|
|
71
|
+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
|
72
|
+
permissions:
|
|
73
|
+
contents: read
|
|
74
|
+
pages: write
|
|
75
|
+
id-token: write
|
|
76
|
+
|
|
77
|
+
# Allow only one concurrent deployment
|
|
78
|
+
concurrency:
|
|
79
|
+
group: "pages"
|
|
80
|
+
cancel-in-progress: false
|
|
81
|
+
|
|
82
|
+
jobs:
|
|
83
|
+
build:
|
|
84
|
+
runs-on: ubuntu-latest
|
|
85
|
+
steps:
|
|
86
|
+
- name: Checkout
|
|
87
|
+
uses: actions/checkout@v3
|
|
88
|
+
- name: Setup Node.js
|
|
89
|
+
uses: actions/setup-node@v3
|
|
90
|
+
with:
|
|
91
|
+
node-version: '20' # Or the Node.js version docmd supports/requires
|
|
92
|
+
cache: 'npm'
|
|
93
|
+
- name: Install docmd (globally or from devDependencies)
|
|
94
|
+
# If docmd is a dev dependency of the project being documented:
|
|
95
|
+
# run: npm ci && npm run build:docs # Assuming 'build:docs' script runs 'docmd build'
|
|
96
|
+
# If installing docmd globally for this action:
|
|
97
|
+
run: npm install -g docmd # Or your scoped package name e.g. @mgks/docmd
|
|
98
|
+
- name: Build site with docmd
|
|
99
|
+
run: docmd build # Assumes config.js is in the root and correctly points to srcDir/outputDir
|
|
100
|
+
- name: Setup Pages
|
|
101
|
+
uses: actions/configure-pages@v3
|
|
102
|
+
- name: Upload artifact
|
|
103
|
+
uses: actions/upload-pages-artifact@v2
|
|
104
|
+
with:
|
|
105
|
+
# This should be your outputDir path
|
|
106
|
+
path: './site' # or './docs' if you set outputDir: 'docs'
|
|
107
|
+
deploy:
|
|
108
|
+
environment:
|
|
109
|
+
name: github-pages
|
|
110
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
111
|
+
runs-on: ubuntu-latest
|
|
112
|
+
needs: build
|
|
113
|
+
steps:
|
|
114
|
+
- name: Deploy to GitHub Pages
|
|
115
|
+
id: deployment
|
|
116
|
+
uses: actions/deploy-pages@v2
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Then:
|
|
120
|
+
1. **Enable GitHub Pages in your repository settings**, selecting "GitHub Actions" as the source.
|
|
121
|
+
2. **Push the workflow file to your repository**.
|
|
122
|
+
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/`.
|
|
123
|
+
|
|
124
|
+
### Other Hosting Options
|
|
125
|
+
|
|
126
|
+
* **Netlify, Vercel, Cloudflare Pages** - Upload or connect your Git repository and set the build command to your npm script that runs `docmd build`.
|
|
127
|
+
* **Any Web Server** - Simply upload the contents of the `site/` directory to any web server that can serve static files.
|
|
128
|
+
|
|
129
|
+
By following these guidelines, you can easily get your `docmd`-powered documentation online and accessible to your users.
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Basic Usage"
|
|
3
|
+
description: "Learn the basic commands to initialize, build, and preview your docmd site."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Basic Usage
|
|
7
|
+
|
|
8
|
+
Once `docmd` is [installed](/getting-started/installation/), using it involves a few simple commands to manage your documentation project.
|
|
9
|
+
|
|
10
|
+
## 1. Initialize Your Project (`docmd init`)
|
|
11
|
+
|
|
12
|
+
Navigate to the directory where you want to create your documentation project. If the directory doesn't exist, create it first.
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
mkdir my-awesome-docs
|
|
16
|
+
cd my-awesome-docs
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Then, run the `init` command:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
docmd init
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
This command sets up the basic structure for your `docmd` project:
|
|
26
|
+
|
|
27
|
+
* `docs/`: An empty directory where your Markdown source files will live.
|
|
28
|
+
* `docs/index.md`: A sample Markdown file to get you started.
|
|
29
|
+
* `config.js`: A configuration file for your site, pre-filled with sensible defaults.
|
|
30
|
+
|
|
31
|
+
You'll typically edit `config.js` to set your site title and define the navigation structure, and then start adding your `.md` files to the `docs/` directory.
|
|
32
|
+
|
|
33
|
+
## 2. Add and Structure Content
|
|
34
|
+
|
|
35
|
+
Create your Markdown (`.md`) files inside the `docs/` directory. You can organize them into subdirectories as needed. For example:
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
my-awesome-docs/
|
|
39
|
+
├── docs/
|
|
40
|
+
│ ├── index.md
|
|
41
|
+
│ └── api/
|
|
42
|
+
│ ├── introduction.md
|
|
43
|
+
│ └── endpoints.md
|
|
44
|
+
│ └── guides/
|
|
45
|
+
│ ├── setup.md
|
|
46
|
+
│ └── advanced.md
|
|
47
|
+
└── config.js
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Each Markdown file should start with YAML frontmatter to define metadata like the page title. See [Writing Content > Frontmatter](/writing-content/frontmatter/) for details.
|
|
51
|
+
|
|
52
|
+
## 3. Preview Your Site (`docmd dev`)
|
|
53
|
+
|
|
54
|
+
While you're writing content or configuring your site, you'll want to see a live preview. The `dev` command starts a local development server with live reloading.
|
|
55
|
+
|
|
56
|
+
In your project's root directory (e.g., `my-awesome-docs/`), run:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
docmd dev
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
This will:
|
|
63
|
+
1. Perform an initial build of your site.
|
|
64
|
+
2. Start a web server, typically at `http://localhost:3000`.
|
|
65
|
+
3. Watch your `docs/` directory and `config.js` for changes.
|
|
66
|
+
4. Automatically rebuild the site and refresh your browser when changes are detected.
|
|
67
|
+
|
|
68
|
+
Open `http://localhost:3000` in your web browser to see your site. Any changes you save to your Markdown files or `config.js` will be reflected live in the browser.
|
|
69
|
+
|
|
70
|
+
To stop the development server, press `Ctrl+C` in your terminal.
|
|
71
|
+
|
|
72
|
+
## 4. Build Your Static Site (`docmd build`)
|
|
73
|
+
|
|
74
|
+
When you're ready to deploy your documentation or create a production version, use the `build` command:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
docmd build
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
This command:
|
|
81
|
+
1. Reads your `config.js`.
|
|
82
|
+
2. Processes all `.md` files in your `docs/` directory.
|
|
83
|
+
3. Generates the complete static HTML, CSS, and JavaScript assets.
|
|
84
|
+
4. Outputs the entire site into a `site/` directory (by default, configurable in `config.js`).
|
|
85
|
+
|
|
86
|
+
The contents of the `site/` directory are all you need to deploy your documentation. You can upload this folder to any static web hosting provider. See [Deployment](/deployment/) for more information.
|
|
87
|
+
|
|
88
|
+
This covers the fundamental workflow of using `docmd`. Next, you'll want to learn more about [Writing Content](/writing-content/) and [Configuration](/configuration/).
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Getting Started with docmd"
|
|
3
|
+
description: "An overview of how to get up and running with docmd for your documentation needs."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Getting Started Overview
|
|
7
|
+
|
|
8
|
+
Welcome to `docmd`! This section will guide you through installing `docmd`, initializing your first documentation project, and understanding the basic commands to build and preview your site.
|
|
9
|
+
|
|
10
|
+
Whether you're documenting a new open-source project, an internal tool, or just want a simple way to publish Markdown content as a website, `docmd` aims to make the process straightforward and enjoyable.
|
|
11
|
+
|
|
12
|
+
## What You'll Learn:
|
|
13
|
+
|
|
14
|
+
* **[Installation](./installation.md):** How to install `docmd` on your system using npm.
|
|
15
|
+
* **[Basic Usage](./basic-usage.md):**
|
|
16
|
+
* Initializing a new `docmd` project with `docmd init`.
|
|
17
|
+
* Adding and structuring your Markdown content.
|
|
18
|
+
* Building your static site with `docmd build`.
|
|
19
|
+
* Previewing your site with live reloading using `docmd dev`.
|
|
20
|
+
|
|
21
|
+
Ready to begin? Let's start with [Installation](./installation.md).
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Installation"
|
|
3
|
+
description: "Learn how to install docmd on your system globally or as a project dependency."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Installation
|
|
7
|
+
|
|
8
|
+
You can install `docmd` using npm (Node Package Manager), which comes with Node.js. If you don't have Node.js and npm installed, please visit [nodejs.org](https://nodejs.org/) to download and install them first (Node.js version 20.x or higher is recommended for `docmd`).
|
|
9
|
+
|
|
10
|
+
## Global Installation (Recommended for CLI Use)
|
|
11
|
+
|
|
12
|
+
For using `docmd` as a command-line tool across multiple projects, global installation is the most convenient method.
|
|
13
|
+
|
|
14
|
+
Open your terminal or command prompt and run:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install -g @mgks/docmd
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
This command downloads `docmd` and makes the `docmd` executable available in your system's PATH.
|
|
21
|
+
|
|
22
|
+
### Verify Installation
|
|
23
|
+
After installation, you can verify that `docmd` is installed correctly by running:
|
|
24
|
+
```bash
|
|
25
|
+
docmd --version
|
|
26
|
+
```
|
|
27
|
+
This should print the installed version of `docmd`. You can also see available commands with:
|
|
28
|
+
```bash
|
|
29
|
+
docmd --help
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Local Installation (Per Project)
|
|
33
|
+
|
|
34
|
+
Alternatively, you might prefer to install `docmd` as a development dependency for a specific project. This is useful if you want to lock down a specific version of `docmd` for that project or use it within npm scripts.
|
|
35
|
+
|
|
36
|
+
Navigate to your project's root directory in the terminal and run:
|
|
37
|
+
```bash
|
|
38
|
+
npm install --save-dev @mgks/docmd
|
|
39
|
+
```
|
|
40
|
+
*(Or `npm install --save-dev @username/docmd` for a scoped package.)*
|
|
41
|
+
|
|
42
|
+
When installed locally, `docmd` is not directly available as a global command. You can run it using:
|
|
43
|
+
|
|
44
|
+
* **`npx` (Recommended):** `npx` is a tool that comes with npm and allows you to execute package binaries.
|
|
45
|
+
```bash
|
|
46
|
+
npx docmd init
|
|
47
|
+
npx docmd build
|
|
48
|
+
```
|
|
49
|
+
* **NPM Scripts:** Add scripts to your project's `package.json`:
|
|
50
|
+
```json
|
|
51
|
+
// package.json
|
|
52
|
+
{
|
|
53
|
+
"scripts": {
|
|
54
|
+
"docs:init": "docmd init",
|
|
55
|
+
"docs:dev": "docmd dev",
|
|
56
|
+
"docs:build": "docmd build"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
Then, you can run them like:
|
|
61
|
+
```bash
|
|
62
|
+
npm run docs:dev
|
|
63
|
+
npm run docs:build
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Troubleshooting
|
|
67
|
+
|
|
68
|
+
* **Permission Errors (EACCES):** If you encounter permission errors during global installation on macOS or Linux, you might need to run the command with `sudo`:
|
|
69
|
+
```bash
|
|
70
|
+
sudo npm install -g @mgks/docmd
|
|
71
|
+
```
|
|
72
|
+
However, a better long-term solution is often to [configure npm to use a directory you own](https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally).
|
|
73
|
+
* **Command Not Found:** If `docmd` is not found after global installation, ensure that the npm global binaries directory is in your system's PATH.
|
|
74
|
+
|
|
75
|
+
With `docmd` installed, you're ready to move on to [Basic Usage](/getting-started/basic-usage/) to create and manage your documentation site.
|
package/docs/index.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Minimalist Markdown Docs Generator"
|
|
3
|
+
description: "Generate beautiful, lightweight static documentation sites directly from your Markdown files with docmd. Zero clutter, just content."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# docmd
|
|
7
|
+
|
|
8
|
+
**Generate beautiful, lightweight static documentation sites directly from your Markdown files. Zero clutter, just content.**
|
|
9
|
+
|
|
10
|
+
`docmd` is a Node.js-based command-line tool that transforms a directory of Markdown files (`.md`) into a clean, fast, and themeable static website. It prioritizes simplicity for the author, leveraging standard Markdown and intuitive configuration, while producing elegant and functional documentation sites.
|
|
11
|
+
|
|
12
|
+
::: callout tip
|
|
13
|
+
This very documentation site is built using `docmd`!
|
|
14
|
+
:::
|
|
15
|
+
|
|
16
|
+
## Core Philosophy
|
|
17
|
+
|
|
18
|
+
* **Markdown First:** Your content lives in standard `.md` files with simple YAML frontmatter.
|
|
19
|
+
* **Minimal Configuration:** Sensible defaults with straightforward overrides via `config.js`.
|
|
20
|
+
* **Lightweight Build:** Fast generation process using Node.js, no complex framework dependencies for the build itself.
|
|
21
|
+
* **Beautiful Defaults:** Clean, responsive design with light/dark themes and syntax highlighting out-of-the-box.
|
|
22
|
+
* **Static Output:** Deploy the generated `site/` folder anywhere (GitHub Pages, Netlify, Vercel, etc.).
|
|
23
|
+
|
|
24
|
+
## Key Features
|
|
25
|
+
|
|
26
|
+
* 📝 **Standard Markdown & Frontmatter:** Write content naturally, define page metadata (title, description) easily.
|
|
27
|
+
* 🎨 **Themeable:** Built-in light/dark modes, customizable via CSS variables. Uses `highlight.js` for code blocks.
|
|
28
|
+
* 🧩 **Custom Containers:** Add richer components like callouts, cards, and steps using simple `::: name :::` syntax.
|
|
29
|
+
* ⚙️ **Config-Driven Navigation:** Define your site structure and sidebar navigation in `config.js`. Supports nested items.
|
|
30
|
+
* 🚀 **Fast Static Build:** Node.js script quickly processes files into optimized HTML & CSS.
|
|
31
|
+
* 💻 **Simple CLI:** Easy-to-use commands (`docmd build`, `docmd init`, `docmd dev`) with clear feedback.
|
|
32
|
+
* 🌐 **Deploy Anywhere:** Generates a standard static `site/` directory.
|
|
33
|
+
|
|
34
|
+
## Get Started Quickly
|
|
35
|
+
|
|
36
|
+
1. **Install `docmd`:**
|
|
37
|
+
```bash
|
|
38
|
+
npm install -g @mgks/docmd
|
|
39
|
+
```
|
|
40
|
+
2. **Initialize Your Project:**
|
|
41
|
+
```bash
|
|
42
|
+
cd my-project-docs
|
|
43
|
+
docmd init
|
|
44
|
+
```
|
|
45
|
+
3. **Write Your Content:**
|
|
46
|
+
Create `.md` files in the `docs/` directory.
|
|
47
|
+
4. **Preview Live:**
|
|
48
|
+
```bash
|
|
49
|
+
docmd dev
|
|
50
|
+
```
|
|
51
|
+
5. **Build for Production:**
|
|
52
|
+
```bash
|
|
53
|
+
docmd build
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Dive into the [Getting Started](/getting-started/installation/) guide for more details, or explore the sidebar to learn about specific features.
|