@mgks/docmd 0.1.0 → 0.1.1
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/workflows/publish.yml +1 -1
- package/README.md +2 -2
- package/bin/docmd.js +6 -2
- package/config.js +31 -31
- package/docs/cli-commands.md +13 -0
- package/docs/content/images.md +205 -0
- package/docs/content/index.md +17 -0
- package/docs/theming/custom-css-js.md +31 -0
- package/package.json +3 -1
- package/src/assets/css/{main.css → docmd-main.css} +252 -9
- package/src/assets/css/{theme-sky.css → docmd-theme-sky.css} +153 -1
- package/src/assets/js/docmd-image-lightbox.js +72 -0
- package/src/assets/js/{theme-toggle.js → docmd-theme-toggle.js} +4 -4
- package/src/commands/build.js +109 -8
- package/src/commands/dev.js +3 -3
- package/src/commands/init.js +82 -12
- package/src/core/file-processor.js +40 -0
- package/src/core/html-generator.js +7 -3
- package/src/templates/layout.ejs +4 -62
- package/src/templates/toc.ejs +53 -20
- package/docs/writing-content/index.md +0 -17
- package/src/assets/css/toc.css +0 -76
- /package/docs/{writing-content → content}/custom-containers.md +0 -0
- /package/docs/{writing-content → content}/frontmatter.md +0 -0
- /package/docs/{writing-content → content}/markdown-syntax.md +0 -0
- /package/src/assets/css/{highlight-dark.css → docmd-highlight-dark.css} +0 -0
- /package/src/assets/css/{highlight-light.css → docmd-highlight-light.css} +0 -0
- /package/src/assets/images/{logo-dark.png → docmd-logo-dark.png} +0 -0
- /package/src/assets/images/{logo-light.png → docmd-logo-light.png} +0 -0
|
@@ -2,7 +2,7 @@ name: Publish Package to NPM and GitHub Packages
|
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
release:
|
|
5
|
-
types: [created] # Triggers when a new GitHub Release is published
|
|
5
|
+
types: [created, published] # Triggers when a new GitHub Release is created or published
|
|
6
6
|
workflow_dispatch: # Allows manual triggering for testing
|
|
7
7
|
|
|
8
8
|
jobs:
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img src="https://github.com/mgks/docmd/blob/main/src/assets/images/docmd-logo.png" alt="docmd logo" width="
|
|
2
|
+
<img src="https://github.com/mgks/docmd/blob/main/src/assets/images/docmd-logo.png" alt="docmd logo" width="70" />
|
|
3
3
|
<br />
|
|
4
|
-
<img src="https://github.com/mgks/docmd/blob/main/src/assets/images/logo-light.png" alt="docmd dark logo" width="
|
|
4
|
+
<img src="https://github.com/mgks/docmd/blob/main/src/assets/images/docmd-logo-light.png" alt="docmd dark logo" width="180" />
|
|
5
5
|
</p>
|
|
6
6
|
|
|
7
7
|
<p align="center">
|
package/bin/docmd.js
CHANGED
|
@@ -30,10 +30,13 @@ program
|
|
|
30
30
|
.command('build')
|
|
31
31
|
.description('Build the static site from Markdown files and config.js')
|
|
32
32
|
.option('-c, --config <path>', 'Path to config.js file', 'config.js')
|
|
33
|
+
.option('-p, --preserve', 'Preserve existing asset files instead of updating them', false)
|
|
33
34
|
.action(async (options) => {
|
|
34
35
|
try {
|
|
35
36
|
console.log('🚀 Starting build process...');
|
|
36
|
-
await buildSite(options.config
|
|
37
|
+
await buildSite(options.config, {
|
|
38
|
+
preserve: options.preserve
|
|
39
|
+
});
|
|
37
40
|
console.log('✅ Build complete! Site generated in `site/` directory.');
|
|
38
41
|
} catch (error) {
|
|
39
42
|
console.error('❌ Build failed:', error.message);
|
|
@@ -46,9 +49,10 @@ program
|
|
|
46
49
|
.command('dev')
|
|
47
50
|
.description('Start a live preview development server')
|
|
48
51
|
.option('-c, --config <path>', 'Path to config.js file', 'config.js')
|
|
52
|
+
.option('-p, --preserve', 'Preserve existing asset files instead of updating them', false)
|
|
49
53
|
.action(async (options) => {
|
|
50
54
|
try {
|
|
51
|
-
await startDevServer(options.config);
|
|
55
|
+
await startDevServer(options.config, { preserve: options.preserve });
|
|
52
56
|
} catch (error) {
|
|
53
57
|
console.error('❌ Dev server failed:', error.message);
|
|
54
58
|
console.error(error.stack);
|
package/config.js
CHANGED
|
@@ -8,11 +8,10 @@ module.exports = {
|
|
|
8
8
|
|
|
9
9
|
// Logo Configuration
|
|
10
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
|
|
11
|
+
light: '/assets/images/docmd-logo-light.png', // Path relative to outputDir root
|
|
12
|
+
dark: '/assets/images/docmd-logo-dark.png', // Path relative to outputDir root
|
|
13
13
|
alt: 'docmd Logo', // Alt text for the logo
|
|
14
14
|
href: '/', // Link for the logo, defaults to site root
|
|
15
|
-
// height: '30px', // Optional: control via CSS is often better
|
|
16
15
|
},
|
|
17
16
|
|
|
18
17
|
// Directory Configuration
|
|
@@ -25,14 +24,14 @@ module.exports = {
|
|
|
25
24
|
defaultMode: 'light', // Initial color mode: 'light' or 'dark'
|
|
26
25
|
enableModeToggle: true, // Show UI button to toggle light/dark modes
|
|
27
26
|
customCss: [ // Array of paths to custom CSS files
|
|
28
|
-
'/assets/css/
|
|
27
|
+
// '/assets/css/custom.css', // Custom TOC styles
|
|
29
28
|
],
|
|
30
29
|
// options: { /* Future: theme-specific options */ }
|
|
31
30
|
},
|
|
32
31
|
|
|
33
32
|
// Custom JavaScript Files
|
|
34
33
|
customJs: [ // Array of paths to custom JS files, loaded at end of body
|
|
35
|
-
|
|
34
|
+
'/assets/js/docmd-image-lightbox.js', // Image lightbox functionality
|
|
36
35
|
],
|
|
37
36
|
|
|
38
37
|
// Plugins Configuration (Object format)
|
|
@@ -78,53 +77,54 @@ module.exports = {
|
|
|
78
77
|
// Navigation Structure (Sidebar)
|
|
79
78
|
// Icons are kebab-case names from Lucide Icons (https://lucide.dev/)
|
|
80
79
|
navigation: [
|
|
81
|
-
{ title: '
|
|
82
|
-
{ title: 'Home', path: '/', icon: 'home' }, // Corresponds to docs/index.md
|
|
80
|
+
{ title: 'Home', path: '/', icon: 'home' },
|
|
83
81
|
{
|
|
84
82
|
title: 'Getting Started',
|
|
85
|
-
icon: 'rocket',
|
|
86
|
-
path: '/getting-started/',
|
|
83
|
+
icon: 'rocket',
|
|
84
|
+
path: '/getting-started/',
|
|
87
85
|
children: [
|
|
88
|
-
{ title: 'Installation', path: '/getting-started/installation', icon: 'download' },
|
|
89
|
-
{ title: 'Basic Usage', path: '/getting-started/basic-usage', icon: 'play' },
|
|
86
|
+
{ title: 'Installation', path: '/getting-started/installation', icon: 'download' },
|
|
87
|
+
{ title: 'Basic Usage', path: '/getting-started/basic-usage', icon: 'play' },
|
|
90
88
|
],
|
|
91
89
|
},
|
|
92
90
|
{
|
|
93
|
-
title: '
|
|
94
|
-
icon: '
|
|
95
|
-
path: '/
|
|
91
|
+
title: 'Content',
|
|
92
|
+
icon: 'layout-template',
|
|
93
|
+
path: '/content/',
|
|
96
94
|
children: [
|
|
97
|
-
{ title: 'Frontmatter', path: '/
|
|
98
|
-
{ title: 'Markdown Syntax', path: '/
|
|
99
|
-
{ title: '
|
|
95
|
+
{ title: 'Frontmatter', path: '/content/frontmatter', icon: 'file-text' },
|
|
96
|
+
{ title: 'Markdown Syntax', path: '/content/markdown-syntax', icon: 'code-2' },
|
|
97
|
+
{ title: 'Images', path: '/content/images', icon: 'image' },
|
|
98
|
+
{ title: 'Custom Containers', path: '/content/custom-containers', icon: 'box' },
|
|
100
99
|
],
|
|
101
100
|
},
|
|
102
|
-
{ title: 'Configuration', path: '/configuration', icon: 'settings' },
|
|
101
|
+
{ title: 'Configuration', path: '/configuration', icon: 'settings' },
|
|
103
102
|
{
|
|
104
103
|
title: 'Theming',
|
|
105
|
-
icon: 'palette',
|
|
104
|
+
icon: 'palette',
|
|
106
105
|
path: '/theming/',
|
|
107
106
|
children: [
|
|
108
|
-
{ title: 'Available Themes', path: '/theming/available-themes', icon: 'layout-grid' },
|
|
109
|
-
{ title: 'Light & Dark Mode', path: '/theming/light-dark-mode', icon: 'sun-moon' },
|
|
110
|
-
{ title: 'Custom CSS & JS', path: '/theming/custom-css-js', icon: 'file-code' },
|
|
111
|
-
{ title: 'Icons', path: '/theming/icons', icon: '
|
|
107
|
+
{ title: 'Available Themes', path: '/theming/available-themes', icon: 'layout-grid' },
|
|
108
|
+
{ title: 'Light & Dark Mode', path: '/theming/light-dark-mode', icon: 'sun-moon' },
|
|
109
|
+
{ title: 'Custom CSS & JS', path: '/theming/custom-css-js', icon: 'file-code' },
|
|
110
|
+
{ title: 'Icons', path: '/theming/icons', icon: 'pencil-ruler' },
|
|
112
111
|
],
|
|
113
112
|
},
|
|
114
113
|
{
|
|
115
114
|
title: 'Plugins',
|
|
116
|
-
icon: 'puzzle',
|
|
115
|
+
icon: 'puzzle',
|
|
117
116
|
path: '/plugins/',
|
|
118
117
|
children: [
|
|
119
|
-
{ title: 'SEO & Meta Tags', path: '/plugins/seo', icon: 'search' },
|
|
120
|
-
{ title: 'Analytics', path: '/plugins/analytics', icon: 'bar-chart' },
|
|
121
|
-
{ title: 'Sitemap', path: '/plugins/sitemap', icon: 'map' },
|
|
118
|
+
{ title: 'SEO & Meta Tags', path: '/plugins/seo', icon: 'search' },
|
|
119
|
+
{ title: 'Analytics', path: '/plugins/analytics', icon: 'bar-chart' },
|
|
120
|
+
{ title: 'Sitemap', path: '/plugins/sitemap', icon: 'map' },
|
|
122
121
|
],
|
|
123
122
|
},
|
|
124
|
-
{ title: 'CLI Commands', path: '/cli-commands', icon: 'terminal' },
|
|
125
|
-
{ title: 'Deployment', path: '/deployment', icon: 'upload-cloud' },
|
|
126
|
-
{ title: 'Contributing', path: '/contributing', icon: 'users-2' },
|
|
127
|
-
|
|
123
|
+
{ title: 'CLI Commands', path: '/cli-commands', icon: 'terminal' },
|
|
124
|
+
{ title: 'Deployment', path: '/deployment', icon: 'upload-cloud' },
|
|
125
|
+
{ title: 'Contributing', path: '/contributing', icon: 'users-2' },
|
|
126
|
+
|
|
127
|
+
{ title: 'GitHub', path: 'https://github.com/mgks/docmd', icon: 'github', external: true }
|
|
128
128
|
],
|
|
129
129
|
|
|
130
130
|
// Footer Configuration
|
package/docs/cli-commands.md
CHANGED
|
@@ -41,6 +41,8 @@ The `build` command reads your Markdown files from the source directory (specifi
|
|
|
41
41
|
|
|
42
42
|
The output `site/` directory contains all the HTML, CSS, JavaScript, and other assets needed to deploy your documentation.
|
|
43
43
|
|
|
44
|
+
By default, the build process will update all assets to ensure you have the latest versions from the docmd package. This ensures your site benefits from the latest improvements and fixes.
|
|
45
|
+
|
|
44
46
|
**Options:**
|
|
45
47
|
|
|
46
48
|
* `-c, --config <path>`
|
|
@@ -48,6 +50,11 @@ The output `site/` directory contains all the HTML, CSS, JavaScript, and other a
|
|
|
48
50
|
* **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
51
|
* **Example:** `docmd build --config my.docmd.config.js`
|
|
50
52
|
|
|
53
|
+
* `-p, --preserve`
|
|
54
|
+
* **Default:** `false`
|
|
55
|
+
* **Description:** Preserves existing asset files instead of updating them. Use this flag if you've customized any of the default assets and want to keep your modifications.
|
|
56
|
+
* **Example:** `docmd build --preserve`
|
|
57
|
+
|
|
51
58
|
## `docmd dev`
|
|
52
59
|
|
|
53
60
|
Starts a local development server with live reloading.
|
|
@@ -72,6 +79,12 @@ This provides a fast feedback loop, allowing you to see your changes almost inst
|
|
|
72
79
|
* **Default:** `config.js`
|
|
73
80
|
* **Description:** Specifies the path to the configuration file.
|
|
74
81
|
* **Example:** `docmd dev --config my.docmd.config.js`
|
|
82
|
+
|
|
83
|
+
* `-p, --preserve`
|
|
84
|
+
* **Default:** `false`
|
|
85
|
+
* **Description:** Preserves existing asset files instead of updating them. Use this flag if you've customized any of the default assets and want to keep your modifications.
|
|
86
|
+
* **Example:** `docmd dev --preserve`
|
|
87
|
+
|
|
75
88
|
* `-p, --port <port_number>` (Future Option)
|
|
76
89
|
* **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
90
|
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Images"
|
|
3
|
+
description: "Learn how to add and customize images in your docmd documentation"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Images in docmd
|
|
7
|
+
|
|
8
|
+
Adding images to your documentation enhances visual understanding and makes your content more engaging. This guide covers everything you need to know about using images in docmd.
|
|
9
|
+
|
|
10
|
+
## Basic Image Syntax
|
|
11
|
+
|
|
12
|
+
The standard Markdown syntax for images works in docmd:
|
|
13
|
+
|
|
14
|
+
```markdown
|
|
15
|
+

|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Where:
|
|
19
|
+
- `Alt text` is the alternative text displayed if the image cannot be loaded
|
|
20
|
+
- `/path/to/image.jpg` is the path to your image file
|
|
21
|
+
- `"Optional title"` is a tooltip shown when hovering over the image (optional)
|
|
22
|
+
|
|
23
|
+
## Image Organization
|
|
24
|
+
|
|
25
|
+
We recommend organizing your images in a dedicated directory structure:
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
docs/
|
|
29
|
+
└── images/
|
|
30
|
+
├── getting-started/
|
|
31
|
+
│ └── installation.png
|
|
32
|
+
├── features/
|
|
33
|
+
│ └── example.jpg
|
|
34
|
+
└── logo.svg
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Referencing Images
|
|
38
|
+
|
|
39
|
+
### Relative Paths
|
|
40
|
+
|
|
41
|
+
Use relative paths to reference images within your documentation:
|
|
42
|
+
|
|
43
|
+
```markdown
|
|
44
|
+

|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Absolute Paths
|
|
48
|
+
|
|
49
|
+
For images stored in your site's assets directory:
|
|
50
|
+
|
|
51
|
+
```markdown
|
|
52
|
+

|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Image Styling
|
|
56
|
+
|
|
57
|
+
docmd provides several ways to style your images using attribute syntax:
|
|
58
|
+
|
|
59
|
+
### Image Alignment
|
|
60
|
+
|
|
61
|
+
You can align images using special class names:
|
|
62
|
+
|
|
63
|
+
```markdown
|
|
64
|
+
{.align-left}
|
|
65
|
+
{.align-center}
|
|
66
|
+
{.align-right}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Image Size
|
|
70
|
+
|
|
71
|
+
Control image dimensions with size classes:
|
|
72
|
+
|
|
73
|
+
```markdown
|
|
74
|
+
{.size-small}
|
|
75
|
+
{.size-medium}
|
|
76
|
+
{.size-large}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Or specify custom dimensions:
|
|
80
|
+
|
|
81
|
+
```markdown
|
|
82
|
+
{width=300 height=200}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Image Borders and Shadows
|
|
86
|
+
|
|
87
|
+
Add borders or shadows to your images:
|
|
88
|
+
|
|
89
|
+
```markdown
|
|
90
|
+
{.with-border}
|
|
91
|
+
{.with-shadow}
|
|
92
|
+
{.with-border .with-shadow}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Note: Make sure there's a space between multiple classes in the attribute syntax.
|
|
96
|
+
|
|
97
|
+
### Responsive Images
|
|
98
|
+
|
|
99
|
+
All images in docmd are responsive by default, automatically scaling to fit their container.
|
|
100
|
+
|
|
101
|
+
## Image Captions
|
|
102
|
+
|
|
103
|
+
Add captions to your images using the figure syntax:
|
|
104
|
+
|
|
105
|
+
```markdown
|
|
106
|
+
<figure>
|
|
107
|
+
<img src="/path/to/image.jpg" alt="Description of image">
|
|
108
|
+
<figcaption>This is the caption for the image</figcaption>
|
|
109
|
+
</figure>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Image Galleries and Lightbox
|
|
113
|
+
|
|
114
|
+
docmd includes built-in lightbox functionality for image galleries. When users click on an image in a gallery, it opens in a full-screen lightbox view.
|
|
115
|
+
|
|
116
|
+
### Basic Gallery
|
|
117
|
+
|
|
118
|
+
Create simple image galleries by grouping images in a grid layout:
|
|
119
|
+
|
|
120
|
+
```markdown
|
|
121
|
+
<div class="image-gallery">
|
|
122
|
+
<img src="/path/to/image1.jpg" alt="Image 1">
|
|
123
|
+
<img src="/path/to/image2.jpg" alt="Image 2">
|
|
124
|
+
<img src="/path/to/image3.jpg" alt="Image 3">
|
|
125
|
+
</div>
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Gallery with Captions
|
|
129
|
+
|
|
130
|
+
For galleries with captions, use figure elements inside the gallery:
|
|
131
|
+
|
|
132
|
+
```markdown
|
|
133
|
+
<div class="image-gallery">
|
|
134
|
+
<figure>
|
|
135
|
+
<img src="/path/to/image1.jpg" alt="Image 1">
|
|
136
|
+
<figcaption>Caption for Image 1</figcaption>
|
|
137
|
+
</figure>
|
|
138
|
+
<figure>
|
|
139
|
+
<img src="/path/to/image2.jpg" alt="Image 2">
|
|
140
|
+
<figcaption>Caption for Image 2</figcaption>
|
|
141
|
+
</figure>
|
|
142
|
+
</div>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Zoom Effect
|
|
146
|
+
|
|
147
|
+
Add a zoom effect to gallery images when hovering:
|
|
148
|
+
|
|
149
|
+
```markdown
|
|
150
|
+
<div class="image-gallery zoom">
|
|
151
|
+
<img src="/path/to/image1.jpg" alt="Image 1">
|
|
152
|
+
<img src="/path/to/image2.jpg" alt="Image 2">
|
|
153
|
+
</div>
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Individual Lightbox Images
|
|
157
|
+
|
|
158
|
+
You can also enable lightbox functionality for individual images:
|
|
159
|
+
|
|
160
|
+
```markdown
|
|
161
|
+
{.lightbox}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Image Optimization Best Practices
|
|
165
|
+
|
|
166
|
+
For optimal performance:
|
|
167
|
+
|
|
168
|
+
1. **Use appropriate formats**:
|
|
169
|
+
- JPEG for photographs
|
|
170
|
+
- PNG for images with transparency
|
|
171
|
+
- SVG for icons and logos
|
|
172
|
+
- WebP for better compression (with fallbacks)
|
|
173
|
+
|
|
174
|
+
2. **Optimize file sizes**:
|
|
175
|
+
- Compress images before adding them to your documentation
|
|
176
|
+
- Consider using tools like ImageOptim, TinyPNG, or Squoosh
|
|
177
|
+
|
|
178
|
+
3. **Provide responsive images**:
|
|
179
|
+
- Use the HTML `<picture>` element for advanced responsive image scenarios
|
|
180
|
+
|
|
181
|
+
4. **Specify dimensions**:
|
|
182
|
+
- Always include width and height attributes to prevent layout shifts
|
|
183
|
+
|
|
184
|
+
## Examples
|
|
185
|
+
|
|
186
|
+
### Basic Image
|
|
187
|
+
|
|
188
|
+

|
|
189
|
+
|
|
190
|
+
### Image with Border and Shadow
|
|
191
|
+
|
|
192
|
+
{.with-border .with-shadow}
|
|
193
|
+
|
|
194
|
+
### Responsive Image Gallery
|
|
195
|
+
|
|
196
|
+
<div class="image-gallery">
|
|
197
|
+
<figure>
|
|
198
|
+
<img src="/assets/images/docmd-preview.png" alt="Feature 1">
|
|
199
|
+
<figcaption>Feature One</figcaption>
|
|
200
|
+
</figure>
|
|
201
|
+
<figure>
|
|
202
|
+
<img src="/assets/images/docmd-preview.png" alt="Feature 2">
|
|
203
|
+
<figcaption>Feature Two</figcaption>
|
|
204
|
+
</figure>
|
|
205
|
+
</div>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Content"
|
|
3
|
+
description: "Learn how to write and format content in docmd"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Content in docmd
|
|
7
|
+
|
|
8
|
+
docmd uses Markdown files to create beautiful documentation. This section covers everything you need to know about writing content:
|
|
9
|
+
|
|
10
|
+
## Available Guides
|
|
11
|
+
|
|
12
|
+
- [**Frontmatter**](/content/frontmatter) - Learn how to add metadata to your pages
|
|
13
|
+
- [**Markdown Syntax**](/content/markdown-syntax) - Basic and advanced Markdown features
|
|
14
|
+
- [**Images**](/content/images) - How to add and style images in your documentation
|
|
15
|
+
- [**Custom Containers**](/content/custom-containers) - Special content blocks like callouts and cards
|
|
16
|
+
|
|
17
|
+
Choose a topic from the sidebar to get started.
|
|
@@ -35,6 +35,37 @@ module.exports = {
|
|
|
35
35
|
2. Place them in a folder within your project (e.g., `my-project/static-assets/css/`).
|
|
36
36
|
3. Ensure that this folder (or its contents) is copied to the correct location in your `site/` directory during `docmd`'s asset copying process. If `docmd` copies a top-level `assets/` folder from your source, place them there.
|
|
37
37
|
|
|
38
|
+
## Managing Custom Assets
|
|
39
|
+
|
|
40
|
+
By default, `docmd` will always update assets to the latest version when you run `build` or `dev` commands. This ensures your site benefits from the latest improvements and fixes.
|
|
41
|
+
|
|
42
|
+
### Customizing Default Assets
|
|
43
|
+
|
|
44
|
+
If you want to customize default assets (like theme CSS files or scripts):
|
|
45
|
+
|
|
46
|
+
1. First, build your site normally to generate all assets:
|
|
47
|
+
```bash
|
|
48
|
+
docmd build
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
2. Modify the generated files in the `site/assets` directory as needed.
|
|
52
|
+
|
|
53
|
+
3. When rebuilding, use the `--preserve` flag to keep your customized files:
|
|
54
|
+
```bash
|
|
55
|
+
docmd build --preserve
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
This approach allows you to:
|
|
59
|
+
- Always get the latest assets when you want them (default behavior)
|
|
60
|
+
- Preserve your customizations when needed (with `--preserve`)
|
|
61
|
+
- Easily see which files are being preserved during the build process
|
|
62
|
+
|
|
63
|
+
The `--preserve` flag works with both `build` and `dev` commands:
|
|
64
|
+
```bash
|
|
65
|
+
# Preserve custom assets during development
|
|
66
|
+
docmd dev --preserve
|
|
67
|
+
```
|
|
68
|
+
|
|
38
69
|
**Use Cases for Custom CSS:**
|
|
39
70
|
* **Overriding CSS Variables:** The `default` theme uses CSS variables extensively. You can redefine these in your custom CSS.
|
|
40
71
|
```css
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mgks/docmd",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
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
|
"bin": {
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"homepage": "https://github.com/mgks/docmd#readme",
|
|
37
37
|
"dependencies": {
|
|
38
|
+
"@mgks/docmd": "^0.1.0",
|
|
38
39
|
"chokidar": "^3.6.0",
|
|
39
40
|
"commander": "^12.0.0",
|
|
40
41
|
"ejs": "^3.1.9",
|
|
@@ -44,6 +45,7 @@
|
|
|
44
45
|
"highlight.js": "^11.11.1",
|
|
45
46
|
"lucide-static": "^0.508.0",
|
|
46
47
|
"markdown-it": "^14.1.0",
|
|
48
|
+
"markdown-it-attrs": "^4.3.1",
|
|
47
49
|
"markdown-it-container": "^4.0.0",
|
|
48
50
|
"ws": "^8.17.0"
|
|
49
51
|
},
|