@mgks/docmd 0.2.6 → 0.2.8
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/.github/CODE_OF_CONDUCT.md +48 -0
- package/.github/CONTRIBUTING.md +129 -0
- package/.github/ISSUE_TEMPLATE/bug_report.yml +58 -0
- package/.github/ISSUE_TEMPLATE/feature_request.yml +27 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +16 -0
- package/.github/SECURITY.md +18 -0
- package/.github/workflows/publish.yml +20 -55
- package/README.md +119 -67
- package/config.js +14 -0
- package/docs/comparison.md +51 -0
- package/docs/content/containers/changelogs.md +128 -0
- package/docs/content/containers/collapsible.md +89 -0
- package/docs/recipes/custom-fonts.md +43 -0
- package/docs/recipes/favicon.md +38 -0
- package/docs/recipes/index.md +12 -0
- package/docs/recipes/landing-page.md +46 -0
- package/package.json +1 -2
- package/src/assets/css/docmd-main.css +1262 -4
- package/src/assets/js/docmd-main.js +17 -1
- package/src/core/config-loader.js +9 -3
- package/src/core/config-validator.js +79 -0
- package/src/core/file-processor.js +49 -769
- package/src/core/markdown/containers.js +94 -0
- package/src/core/markdown/renderers.js +90 -0
- package/src/core/markdown/rules.js +355 -0
- package/src/core/markdown/setup.js +108 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Comparison between docmd, Docusaurus, MkDocs, Mintlify and more"
|
|
3
|
+
description: "A detailed comparison of docmd against Docusaurus, MkDocs, Mintlify, and Docsify."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Comparing Documentation Tools
|
|
7
|
+
|
|
8
|
+
Choosing the right tool depends on your specific needs. `docmd` was built to fill the gap between "too simple" (basic parsers) and "too heavy" (full application frameworks).
|
|
9
|
+
|
|
10
|
+
## Feature Matrix
|
|
11
|
+
|
|
12
|
+
| Feature | docmd | Docusaurus | MkDocs (Material) | Mintlify | Docsify |
|
|
13
|
+
| :--- | :--- | :--- | :--- | :--- | :--- |
|
|
14
|
+
| **Core Tech** | Node.js (Native) | React.js | Python | Proprietary | JS (Runtime) |
|
|
15
|
+
| **Output** | Static HTML | React SPA (Hydrated) | Static HTML | Hosted / Next.js | None (Runtime SPA) |
|
|
16
|
+
| **Setup Time** | ~2 minutes | ~15 minutes | ~10 mins (Python env) | Instant (SaaS) | Instant |
|
|
17
|
+
| **Client JS Size** | **Tiny (< 15kb)** | Heavy (React Bundle) | Minimal | Medium | Medium |
|
|
18
|
+
| **Customization** | Standard CSS/JS | React Components | Python/Jinja2 | JSON Config | Vue/Plugins |
|
|
19
|
+
| **SEO** | **Excellent** | Excellent | Excellent | Excellent | **Poor** |
|
|
20
|
+
| **Hosting** | **Anywhere** | Anywhere | Anywhere | **Vendor Locked** | Anywhere |
|
|
21
|
+
| **Cost** | **100% Free OSS** | 100% Free OSS | 100% Free OSS | Freemium | 100% Free OSS |
|
|
22
|
+
|
|
23
|
+
## Detailed Breakdown
|
|
24
|
+
|
|
25
|
+
### vs. Docusaurus
|
|
26
|
+
**Docusaurus** is the gold standard for large-scale React projects (like Meta's own docs).
|
|
27
|
+
* **Choose Docusaurus if:** You need to embed complex React components inside your markdown, need versioning *today*, or are building a massive site with thousands of pages.
|
|
28
|
+
* **Choose docmd if:** You want a fast, lightweight site that is just HTML/CSS. You don't want to maintain a React dependency tree just to display documentation.
|
|
29
|
+
|
|
30
|
+
### vs. MkDocs (Material)
|
|
31
|
+
**MkDocs** is widely loved but requires a Python environment.
|
|
32
|
+
* **Choose MkDocs if:** You are already in the Python ecosystem or need its mature plugin ecosystem immediately.
|
|
33
|
+
* **Choose docmd if:** You are a JavaScript/Node.js developer. You want to run `npm install` and go, without dealing with `pip`, `requirements.txt`, or Python version conflicts.
|
|
34
|
+
|
|
35
|
+
### vs. Mintlify
|
|
36
|
+
**Mintlify** is a modern, hosted documentation platform focused on design.
|
|
37
|
+
* **Choose Mintlify if:** You have a budget and don't want to touch *any* code or configuration. You just want to upload markdown and pay someone to host and style it.
|
|
38
|
+
* **Choose docmd if:** You want full control over your HTML/CSS and want to host your docs for **free** on GitHub Pages, Vercel, or Netlify without branding watermarks or custom domain fees.
|
|
39
|
+
|
|
40
|
+
### vs. Docsify
|
|
41
|
+
**Docsify** is a "magical" generator that parses Markdown on the fly in the browser.
|
|
42
|
+
* **Choose Docsify if:** You absolutely cannot run a build step (e.g., you are hosting on a legacy server that only serves static files and you can't run CI/CD).
|
|
43
|
+
* **Choose docmd if:** You care about **SEO** and **Performance**. Docsify requires the user's browser to download the Markdown parser and the content before rendering anything, which is bad for search engines and users on slow connections. `docmd` builds real HTML files that load instantly.
|
|
44
|
+
|
|
45
|
+
## The docmd Philosophy
|
|
46
|
+
|
|
47
|
+
We believe documentation tools shouldn't be heavy. `docmd` generates **zero-clutter** websites. We don't ship a heavy JavaScript framework to the client just to render text. This results in:
|
|
48
|
+
|
|
49
|
+
1. **Better SEO:** Search engines love clean, semantic HTML.
|
|
50
|
+
2. **Faster Load Times:** No "hydration" delay or runtime parsing.
|
|
51
|
+
3. **Easier Maintenance:** Standard web technologies (CSS/JS), no framework knowledge required.
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Container: Changelogs"
|
|
3
|
+
description: "Create a beautiful, timeline-style version history for your project."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Changelog Container
|
|
7
|
+
|
|
8
|
+
The `changelog` container allows you to present version history and release notes in a clean, timeline layout. It separates metadata (dates/versions) from the narrative content, making it easy for users to scan updates.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
The changelog container uses a specific syntax where entries are separated by `==` markers.
|
|
13
|
+
|
|
14
|
+
::: callout info
|
|
15
|
+
Container blocks (like `::: changelog`) should be preceded by a blank line.
|
|
16
|
+
:::
|
|
17
|
+
|
|
18
|
+
**Syntax:**
|
|
19
|
+
```markdown
|
|
20
|
+
::: changelog
|
|
21
|
+
|
|
22
|
+
== Version/Date String
|
|
23
|
+
Content for this version.
|
|
24
|
+
Supports **Markdown**, lists, and other containers.
|
|
25
|
+
|
|
26
|
+
== Next Version/Date String
|
|
27
|
+
Content for the next version.
|
|
28
|
+
|
|
29
|
+
:::
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**`==`**: This marker denotes the start of a new entry. Everything after `==` on the same line is treated as the "Date" or "Version" badge on the left side of the timeline.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Examples
|
|
37
|
+
|
|
38
|
+
### Basic Version History
|
|
39
|
+
|
|
40
|
+
**Code:**
|
|
41
|
+
```markdown
|
|
42
|
+
::: changelog
|
|
43
|
+
|
|
44
|
+
== v2.0.0 (2025-01-15)
|
|
45
|
+
### Major Update 🚀
|
|
46
|
+
We completely rewrote the core engine for better performance.
|
|
47
|
+
|
|
48
|
+
* Added new plugin system
|
|
49
|
+
* Improved build speed by 50%
|
|
50
|
+
|
|
51
|
+
== v1.1.0 (2024-12-01)
|
|
52
|
+
### Feature Drop
|
|
53
|
+
Added support for custom themes and dark mode.
|
|
54
|
+
|
|
55
|
+
== v1.0.0 (2024-11-10)
|
|
56
|
+
Initial public release.
|
|
57
|
+
:::
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**Rendered Preview:**
|
|
61
|
+
|
|
62
|
+
::: changelog
|
|
63
|
+
|
|
64
|
+
== v2.0.0 (2025-01-15)
|
|
65
|
+
### Major Update 🚀
|
|
66
|
+
We completely rewrote the core engine for better performance.
|
|
67
|
+
|
|
68
|
+
* Added new plugin system
|
|
69
|
+
* Improved build speed by 50%
|
|
70
|
+
|
|
71
|
+
== v1.1.0 (2024-12-01)
|
|
72
|
+
### Feature Drop
|
|
73
|
+
Added support for custom themes and dark mode.
|
|
74
|
+
|
|
75
|
+
== v1.0.0 (2024-11-10)
|
|
76
|
+
Initial public release.
|
|
77
|
+
:::
|
|
78
|
+
|
|
79
|
+
### Changelog with Nested Elements
|
|
80
|
+
|
|
81
|
+
You can put anything inside a changelog entry, including callouts and code blocks.
|
|
82
|
+
|
|
83
|
+
**Code:**
|
|
84
|
+
````markdown
|
|
85
|
+
::: changelog
|
|
86
|
+
|
|
87
|
+
== v3.0.0-beta
|
|
88
|
+
### The Future is Here
|
|
89
|
+
|
|
90
|
+
::: callout warning Breaking Changes
|
|
91
|
+
This release changes the config format. Please update your `docmd.config.js`.
|
|
92
|
+
:::
|
|
93
|
+
|
|
94
|
+
**New Config Example:**
|
|
95
|
+
```javascript
|
|
96
|
+
module.exports = {
|
|
97
|
+
version: 3,
|
|
98
|
+
// ...
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
== v2.5.0
|
|
103
|
+
Maintenance release with bug fixes.
|
|
104
|
+
:::
|
|
105
|
+
````
|
|
106
|
+
|
|
107
|
+
**Rendered Preview:**
|
|
108
|
+
|
|
109
|
+
::: changelog
|
|
110
|
+
|
|
111
|
+
== v3.0.0-beta
|
|
112
|
+
### The Future is Here
|
|
113
|
+
|
|
114
|
+
::: callout warning Breaking Changes
|
|
115
|
+
This release changes the config format. Please update your `docmd.config.js`.
|
|
116
|
+
:::
|
|
117
|
+
|
|
118
|
+
**New Config Example:**
|
|
119
|
+
```javascript
|
|
120
|
+
module.exports = {
|
|
121
|
+
version: 3,
|
|
122
|
+
// ...
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
== v2.5.0
|
|
127
|
+
Maintenance release with bug fixes.
|
|
128
|
+
:::
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Container: Collapsible"
|
|
3
|
+
description: "Create accordion-style toggleable sections for FAQs, spoilers, or advanced details."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Collapsible Container
|
|
7
|
+
|
|
8
|
+
The `collapsible` container creates an accordion-style block that can be toggled open or closed. This is perfect for FAQs, "spoiler" content, or hiding complex details that aren't immediately necessary.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
The syntax allows you to define the title and the default state (open or closed).
|
|
13
|
+
|
|
14
|
+
**Syntax:**
|
|
15
|
+
```markdown
|
|
16
|
+
::: collapsible [open] Title Text Here
|
|
17
|
+
The hidden content goes here.
|
|
18
|
+
:::
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
- **`open`**: (Optional) If included, the section will be expanded by default on page load.
|
|
22
|
+
- **`Title Text Here`**: The text displayed on the clickable bar. If omitted, it defaults to "Click to expand".
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Examples
|
|
27
|
+
|
|
28
|
+
### Basic Collapsible (Closed by Default)
|
|
29
|
+
|
|
30
|
+
Use this for content that should be hidden initially, like lengthy code examples or optional details.
|
|
31
|
+
|
|
32
|
+
**Code:**
|
|
33
|
+
```markdown
|
|
34
|
+
::: collapsible View Advanced Configuration
|
|
35
|
+
Here are the advanced settings for power users:
|
|
36
|
+
* `memory_limit`: Set the max heap size.
|
|
37
|
+
* `threads`: Number of worker threads.
|
|
38
|
+
:::
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**Rendered Preview:**
|
|
42
|
+
|
|
43
|
+
::: collapsible View Advanced Configuration
|
|
44
|
+
Here are the advanced settings for power users:
|
|
45
|
+
* `memory_limit`: Set the max heap size.
|
|
46
|
+
* `threads`: Number of worker threads.
|
|
47
|
+
:::
|
|
48
|
+
|
|
49
|
+
### Default Open
|
|
50
|
+
|
|
51
|
+
Use the `open` keyword if you want the content visible but capable of being tucked away.
|
|
52
|
+
|
|
53
|
+
**Code:**
|
|
54
|
+
```markdown
|
|
55
|
+
::: collapsible open Important Notice
|
|
56
|
+
This content is visible immediately but can be collapsed if it takes up too much space.
|
|
57
|
+
:::
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**Rendered Preview:**
|
|
61
|
+
|
|
62
|
+
::: collapsible open Important Notice
|
|
63
|
+
This content is visible immediately but can be collapsed if it takes up too much space.
|
|
64
|
+
:::
|
|
65
|
+
|
|
66
|
+
### FAQ Pattern
|
|
67
|
+
|
|
68
|
+
Collapsibles are ideal for Frequently Asked Questions.
|
|
69
|
+
|
|
70
|
+
**Code:**
|
|
71
|
+
```markdown
|
|
72
|
+
::: collapsible Is docmd free to use?
|
|
73
|
+
**Yes!** docmd is 100% open-source and free under the MIT license.
|
|
74
|
+
:::
|
|
75
|
+
|
|
76
|
+
::: collapsible Can I host it on GitHub Pages?
|
|
77
|
+
Absolutely. The `build` command generates static HTML files that work perfectly on GitHub Pages, Netlify, or Vercel.
|
|
78
|
+
:::
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**Rendered Preview:**
|
|
82
|
+
|
|
83
|
+
::: collapsible Is docmd free to use?
|
|
84
|
+
**Yes!** docmd is 100% open-source and free under the MIT license.
|
|
85
|
+
:::
|
|
86
|
+
|
|
87
|
+
::: collapsible Can I host it on GitHub Pages?
|
|
88
|
+
Absolutely. The `build` command generates static HTML files that work perfectly on GitHub Pages, Netlify, or Vercel.
|
|
89
|
+
:::
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Recipe: Custom Fonts"
|
|
3
|
+
description: "How to add Google Fonts or custom typefaces to your documentation."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Adding Custom Fonts
|
|
7
|
+
|
|
8
|
+
You can easily change the typography of your `docmd` site using CSS variables and a custom stylesheet.
|
|
9
|
+
|
|
10
|
+
## 1. Select a Font
|
|
11
|
+
Go to [Google Fonts](https://fonts.google.com) and select the font you want (e.g., "Poppins"). Copy the `@import` URL.
|
|
12
|
+
|
|
13
|
+
## 2. Create a Custom CSS File
|
|
14
|
+
Create a file in your project at `assets/css/typography.css`.
|
|
15
|
+
|
|
16
|
+
```css
|
|
17
|
+
/* assets/css/typography.css */
|
|
18
|
+
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap');
|
|
19
|
+
|
|
20
|
+
:root {
|
|
21
|
+
/* Override the default sans-serif font variable */
|
|
22
|
+
--font-family-sans: 'Poppins', system-ui, -apple-system, sans-serif;
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## 3. Register in Config
|
|
27
|
+
Add the file to your `docmd.config.js`:
|
|
28
|
+
|
|
29
|
+
```javascript
|
|
30
|
+
module.exports = {
|
|
31
|
+
// ...
|
|
32
|
+
theme: {
|
|
33
|
+
name: 'default',
|
|
34
|
+
customCss: [
|
|
35
|
+
'/assets/css/typography.css' // Points to your new file
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
// ...
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## 4. Restart
|
|
43
|
+
Run `docmd dev`. Your site will now use Poppins!
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Recipe: Custom Favicon"
|
|
3
|
+
description: "How to add a custom favicon to your documentation site."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Adding a Custom Favicon
|
|
7
|
+
|
|
8
|
+
A favicon is the small icon that appears in the browser tab next to your page title. `docmd` makes it easy to add your own.
|
|
9
|
+
|
|
10
|
+
## 1. Prepare your image
|
|
11
|
+
You can use `.ico`, `.png`, or `.svg` files. For the best compatibility, an `.ico` file is recommended.
|
|
12
|
+
|
|
13
|
+
## 2. Add to Assets
|
|
14
|
+
Place your image file in your project's assets directory.
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# Example structure
|
|
18
|
+
my-project/
|
|
19
|
+
├── assets/
|
|
20
|
+
│ └── my-icon.ico <-- Your file here
|
|
21
|
+
├── docs/
|
|
22
|
+
└── docmd.config.js
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## 3. Update Configuration
|
|
26
|
+
Open `docmd.config.js` and update the `favicon` property with the path relative to the output root.
|
|
27
|
+
|
|
28
|
+
```javascript
|
|
29
|
+
module.exports = {
|
|
30
|
+
// ...
|
|
31
|
+
// Points to site/assets/my-icon.ico
|
|
32
|
+
favicon: '/assets/my-icon.ico',
|
|
33
|
+
// ...
|
|
34
|
+
};
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## 4. Build
|
|
38
|
+
Run `docmd build` (or `docmd dev`). `docmd` will automatically copy your asset file to the site build and link it in the `<head>` of every page.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Recipes to cook best of docmd"
|
|
3
|
+
description: "Step-by-step guides for common docmd customizations."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Recipes
|
|
7
|
+
|
|
8
|
+
Common patterns and "how-to" guides for getting the most out of `docmd`.
|
|
9
|
+
|
|
10
|
+
* [**Custom Fonts**](./custom-fonts) - Give your docs a unique personality by loading Google Fonts or local font files.
|
|
11
|
+
* [**Landing Pages**](./landing-page) - How to create a beautiful, full-width marketing page using the `noStyle` feature.
|
|
12
|
+
* [**Custom Favicon**](./favicon) - Simple steps to adding your brand's icon.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Recipe: Marketing Landing Page"
|
|
3
|
+
description: "How to build a custom landing page using noStyle."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Creating a Landing Page
|
|
7
|
+
|
|
8
|
+
Sometimes you want your `index.html` (the home page) to look completely different from your documentation—like a product marketing page. `docmd` makes this easy with **No-Style Pages**.
|
|
9
|
+
|
|
10
|
+
## The Concept
|
|
11
|
+
By adding `noStyle: true` to your frontmatter, `docmd` strips away the sidebar, header, and default CSS, giving you a blank canvas while still keeping helpful meta tags.
|
|
12
|
+
|
|
13
|
+
## Implementation
|
|
14
|
+
|
|
15
|
+
Create or edit `docs/index.md`:
|
|
16
|
+
|
|
17
|
+
```html
|
|
18
|
+
---
|
|
19
|
+
title: "My Product"
|
|
20
|
+
description: " The best product ever."
|
|
21
|
+
noStyle: true
|
|
22
|
+
components:
|
|
23
|
+
meta: true # Keep SEO tags
|
|
24
|
+
favicon: true # Keep favicon
|
|
25
|
+
scripts: false # Disable default docmd scripts
|
|
26
|
+
customHead: |
|
|
27
|
+
<style>
|
|
28
|
+
body { font-family: sans-serif; margin: 0; }
|
|
29
|
+
.hero { background: #111; color: #fff; padding: 100px 20px; text-align: center; }
|
|
30
|
+
.btn { background: #3b82f6; color: white; padding: 10px 20px; text-decoration: none; border-radius: 5px; }
|
|
31
|
+
</style>
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
<div class="hero">
|
|
35
|
+
<h1>Welcome to My Product</h1>
|
|
36
|
+
<p>The ultimate solution for X, Y, and Z.</p>
|
|
37
|
+
<br>
|
|
38
|
+
<a href="/getting-started/" class="btn">Read the Docs →</a>
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
<div class="features">
|
|
42
|
+
<!-- Your custom HTML features grid here -->
|
|
43
|
+
</div>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
This page will be built as `index.html` but will look exactly like your custom HTML, serving as a perfect entry point to your documentation.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mgks/docmd",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
4
4
|
"description": "Generate beautiful, lightweight static documentation sites directly from your Markdown files. Zero clutter, just content.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -42,7 +42,6 @@
|
|
|
42
42
|
},
|
|
43
43
|
"homepage": "https://github.com/mgks/docmd#readme",
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@mgks/docmd": "^0.2.5",
|
|
46
45
|
"chalk": "^4.1.2",
|
|
47
46
|
"chokidar": "^4.0.3",
|
|
48
47
|
"commander": "^14.0.0",
|