@mgks/docmd 0.1.3 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/.github/workflows/deploy-docmd.yml +2 -2
  2. package/README.md +2 -4
  3. package/assets/css/welcome.css +62 -358
  4. package/assets/images/preview-dark-1.webp +0 -0
  5. package/assets/images/preview-dark-2.webp +0 -0
  6. package/assets/images/preview-dark-3.webp +0 -0
  7. package/assets/images/preview-light-1.webp +0 -0
  8. package/assets/images/preview-light-2.webp +0 -0
  9. package/assets/images/preview-light-3.webp +0 -0
  10. package/config.js +35 -4
  11. package/docs/cli-commands.md +1 -2
  12. package/docs/configuration.md +104 -23
  13. package/docs/content/containers/buttons.md +88 -0
  14. package/docs/content/containers/callouts.md +154 -0
  15. package/docs/content/containers/cards.md +93 -0
  16. package/docs/content/containers/index.md +35 -0
  17. package/docs/content/containers/nested-containers.md +329 -0
  18. package/docs/content/containers/steps.md +175 -0
  19. package/docs/content/containers/tabs.md +228 -0
  20. package/docs/content/frontmatter.md +4 -4
  21. package/docs/content/index.md +5 -4
  22. package/docs/content/markdown-syntax.md +4 -4
  23. package/docs/content/no-style-example.md +1 -1
  24. package/docs/contributing.md +7 -0
  25. package/docs/deployment.md +22 -31
  26. package/docs/getting-started/basic-usage.md +3 -2
  27. package/docs/getting-started/index.md +3 -3
  28. package/docs/getting-started/installation.md +1 -1
  29. package/docs/index.md +14 -20
  30. package/docs/plugins/seo.md +2 -0
  31. package/docs/plugins/sitemap.md +1 -1
  32. package/docs/theming/assets-management.md +1 -1
  33. package/docs/theming/available-themes.md +45 -52
  34. package/docs/theming/light-dark-mode.md +12 -3
  35. package/package.json +9 -3
  36. package/src/assets/css/docmd-main.css +935 -573
  37. package/src/assets/css/docmd-theme-retro.css +812 -0
  38. package/src/assets/css/docmd-theme-ruby.css +619 -0
  39. package/src/assets/css/docmd-theme-sky.css +606 -605
  40. package/src/assets/js/docmd-image-lightbox.js +1 -3
  41. package/src/assets/js/docmd-main.js +97 -0
  42. package/src/commands/build.js +1 -1
  43. package/src/commands/dev.js +5 -2
  44. package/src/commands/init.js +21 -1
  45. package/src/core/file-processor.js +626 -363
  46. package/src/core/html-generator.js +20 -30
  47. package/src/plugins/seo.js +4 -0
  48. package/src/templates/layout.ejs +34 -8
  49. package/assets/images/preview-dark-1.png +0 -0
  50. package/assets/images/preview-dark-2.png +0 -0
  51. package/assets/images/preview-dark-3.png +0 -0
  52. package/assets/images/preview-light-1.png +0 -0
  53. package/assets/images/preview-light-2.png +0 -0
  54. package/assets/images/preview-light-3.png +0 -0
  55. package/docs/content/custom-containers.md +0 -129
  56. package/src/assets/js/docmd-theme-toggle.js +0 -59
@@ -23,10 +23,16 @@ module.exports = {
23
23
  srcDir: 'docs',
24
24
  outputDir: 'site',
25
25
 
26
+ sidebar: {
27
+ collapsible: true,
28
+ defaultCollapsed: false,
29
+ },
30
+
26
31
  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
32
+ name: 'sky',
33
+ defaultMode: 'light',
34
+ enableModeToggle: true,
35
+ positionMode: 'bottom', // 'top' or 'bottom'
30
36
  customCss: [ // Array of paths to your custom CSS files
31
37
  // '/css/override-styles.css', // Paths are relative to the outputDir root
32
38
  ],
@@ -37,20 +43,40 @@ module.exports = {
37
43
  // '/js/extra-functionality.js', // Loaded at the end of the body
38
44
  ],
39
45
 
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
- // }],
46
+ autoTitleFromH1: true,
47
47
 
48
- // Example: Enable Google Analytics (Universal Analytics)
49
- // ['analytics-google-ua', { trackingId: 'UA-XXXXXXXXX-Y' }],
48
+ sponsor: {
49
+ enabled: true,
50
+ title: 'Sponsor the Project',
51
+ link: 'https://github.com/sponsors/mgks',
52
+ },
50
53
 
51
- // Example: Enable Google Analytics 4
52
- // ['analytics-google-v4', { measurementId: 'G-XXXXXXXXXX' }],
53
- ],
54
+ plugins: {
55
+ // SEO Plugin Configuration
56
+ seo: {
57
+ defaultDescription: 'A fantastic site about interesting things.',
58
+ openGraph: {
59
+ defaultImage: '/assets/images/og-social-default.png'
60
+ },
61
+ twitter: {
62
+ cardType: 'summary_large_image',
63
+ siteUsername: '@MyProject'
64
+ }
65
+ },
66
+
67
+ // Google Analytics 4
68
+ analytics: {
69
+ googleV4: {
70
+ measurementId: 'G-XXXXXXXXXX'
71
+ }
72
+ },
73
+
74
+ // Sitemap generation
75
+ sitemap: {
76
+ defaultChangefreq: 'weekly',
77
+ defaultPriority: 0.8
78
+ }
79
+ },
54
80
 
55
81
  navigation: [
56
82
  { title: 'Home', path: '/', icon: 'home' }, // Icon names correspond to SVGs
@@ -98,6 +124,37 @@ module.exports = {
98
124
  * **Default:** `'site'`
99
125
  * **Description:** Directory where the static site will be generated.
100
126
 
127
+ ### `autoTitleFromH1`
128
+ * **Type:** `Boolean`
129
+ * **Default:** `true`
130
+ * **Description:** If `true`, `docmd` will automatically use the content of the first H1 tag (`# Title`) as the page title if no `title` is specified in the frontmatter. If set to `false` and a page has no `title` in its frontmatter, the page header will be hidden.
131
+ * **Example:**
132
+ ```javascript
133
+ // With autoTitleFromH1: true (default)
134
+ // Markdown file with: # My Page Title
135
+ // Will automatically set the page title to "My Page Title"
136
+
137
+ // With autoTitleFromH1: false
138
+ // You must explicitly set title in frontmatter:
139
+ // ---
140
+ // title: "My Page Title"
141
+ // ---
142
+ ```
143
+
144
+ ## `sidebar` (Object)
145
+
146
+ Configures the behavior of the sidebar.
147
+
148
+ ### `sidebar.collapsible`
149
+ * **Type:** `Boolean`
150
+ * **Default:** `false`
151
+ * **Description:** If `true`, a toggle button is added to the header, allowing users to show or hide the sidebar. The user's preference is saved in `localStorage`.
152
+
153
+ ### `sidebar.defaultCollapsed`
154
+ * **Type:** `Boolean`
155
+ * **Default:** `false`
156
+ * **Description:** If `sidebar.collapsible` is `true`, this option sets the default state of the sidebar to collapsed. A user's saved preference will override this.
157
+
101
158
  ## `theme` (Object)
102
159
 
103
160
  Configures the visual theme of your site.
@@ -119,6 +176,13 @@ Configures the visual theme of your site.
119
176
  * **Default:** `true` (assuming it's now a core feature)
120
177
  * **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
178
 
179
+ ### `theme.positionMode`
180
+ * **Type:** `String`
181
+ * **Default:** `'bottom'`
182
+ * **Values:** `'top'` or `'bottom'`
183
+ * **Description:** Sets the position of the light/dark mode toggle button. `'top'` places it in the page header (top right), while `'bottom'` places it at the bottom of the sidebar.
184
+ * **Example:** `positionMode: 'top'` - Useful for sites where you want the theme toggle to be more prominent and easily accessible.
185
+
122
186
  ### `theme.customCss`
123
187
  * **Type:** `Array` of `String`
124
188
  * **Default:** `[]` (empty array)
@@ -137,15 +201,15 @@ Configures the visual theme of your site.
137
201
  * **Paths:** Should be relative to the `outputDir` root (e.g., `'/js/my-analytics-alternative.js'`).
138
202
  * **Example:** `customJs: ['/assets/js/interactive-component.js']`
139
203
 
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).
204
+ ## `plugins` (Object)
205
+ * **Type:** `Object`
206
+ * **Default:** `{}`
207
+ * **Description:** An object to configure and enable plugins. `docmd` ships with core plugins like SEO, Analytics, and Sitemap that you can configure here.
208
+ * **Format:** Each key in the object represents a plugin name, and its value is an object containing the plugin's configuration options.
145
209
  * **Built-in Plugin Examples:**
146
- * `['seo', { defaultDescription: '...', openGraph: { ... }, ... }]`
147
- * `['analytics-google-ua', { trackingId: 'UA-...' }]`
148
- * `['analytics-google-v4', { measurementId: 'G-...' }]`
210
+ * `seo: { defaultDescription: '...', openGraph: { ... }, ... }`
211
+ * `analytics: { googleV4: { measurementId: 'G-XXXXXXXXXX' } }`
212
+ * `sitemap: { defaultChangefreq: 'weekly', defaultPriority: 0.8 }`
149
213
  * **See Also:** [Plugins](/plugins/)
150
214
 
151
215
  ## `navigation` (Array of Objects)
@@ -160,6 +224,23 @@ Configures the visual theme of your site.
160
224
  ## `footer` (String, Optional)
161
225
  * **Description:** Custom footer text (Markdown supported).
162
226
 
227
+ ## `sponsor` (Object, Optional)
228
+ * **Type:** `Object`
229
+ * **Description:** Configures a sponsor ribbon that appears in the bottom-right corner of every page.
230
+ * **Properties:**
231
+ * `enabled` (Boolean, Optional): Whether to show the sponsor ribbon. Defaults to `true` if the sponsor object is provided.
232
+ * `title` (String, Optional): Text to display on the ribbon. Defaults to `'Sponsor the Project'`.
233
+ * `link` (String, Required if enabled): URL for the sponsor link. Should open in a new tab.
234
+ * **Example:**
235
+ ```javascript
236
+ sponsor: {
237
+ enabled: true,
238
+ title: 'Sponsor the Project',
239
+ link: 'https://github.com/sponsors/mgks'
240
+ }
241
+ ```
242
+ * **Note:** The ribbon is positioned fixed in the bottom-right corner and includes a heart icon with a subtle animation.
243
+
163
244
  ## `favicon` (String, Optional)
164
245
  * **Description:** Path to your favicon file, relative to `outputDir` root.
165
246
 
@@ -0,0 +1,88 @@
1
+ ---
2
+ title: "Container: Buttons"
3
+ description: "How to create stylish, clickable buttons within your documentation for calls to action."
4
+ ---
5
+
6
+ # Buttons
7
+
8
+ The `button` container allows you to easily create a stylish, clickable button. It's perfect for calls to action, such as linking to a download page, an external resource, or another section of your documentation.
9
+
10
+ ## Usage
11
+
12
+ The button container is a self-contained component. You provide its text, URL, and an optional color as arguments.
13
+
14
+ ::: callout info Important Notes
15
+ - Container blocks (like `::: button`) should be preceded by a blank line to ensure proper parsing by the markdown processor.
16
+ :::
17
+
18
+ **Syntax:**
19
+ ```markdown
20
+ ::: button Button_Text /path/to/link [color:#hexcode]
21
+ ::: button Button_Text external:/external-url [color:#hexcode]
22
+ ```
23
+
24
+ - **`Button_Text`**: The text to display on the button. Use underscores (`_`) for spaces.
25
+ - **`/path/to/link`**: The URL the button should link to. For internal links, use relative paths.
26
+ - **`external:/external-url`**: For external links that should open in a new tab, prefix the URL with `external:`.
27
+ - **`[color:#hexcode]`**: (Optional) A custom background color for the button. If omitted, it will use the theme's default link color.
28
+
29
+ ---
30
+
31
+ ## Examples
32
+
33
+ ### Standard Internal Button
34
+
35
+ This button will use the default theme color and link to a section on the current page.
36
+
37
+ **Code:**
38
+ ```markdown
39
+ ::: button View_Examples #examples
40
+ ```
41
+
42
+ **Rendered Preview:**
43
+ ::: button View_Examples #examples
44
+
45
+ ### External Link Button
46
+
47
+ External links open in a new tab for better user experience.
48
+
49
+ **Code:**
50
+ ```markdown
51
+ ::: button GitHub_Repository external:https://github.com/mgks/docmd
52
+ ```
53
+
54
+ **Rendered Preview:**
55
+ ::: button GitHub_Repository external:https://github.com/mgks/docmd
56
+
57
+ ### Button with Custom Color
58
+
59
+ You can easily override the color for emphasis.
60
+
61
+ **Code:**
62
+ ```markdown
63
+ ::: button Getting_Started #getting-started color:#28a745
64
+ ```
65
+
66
+ **Rendered Preview:**
67
+ ::: button Getting_Started #getting-started color:#28a745
68
+
69
+ ### Buttons Inside Other Containers
70
+
71
+ Buttons are flexible and can be placed inside other containers, like cards or callouts, to create powerful components. This nesting is now reliable.
72
+
73
+ **Code:**
74
+
75
+ ```markdown
76
+ ::: card Feature Announcement
77
+ Our latest feature is now available! Read the full documentation to learn more about how it works.
78
+ ::: button Read_More /path/to/feature/docs/
79
+ :::
80
+ ```
81
+
82
+ **Rendered Preview:**
83
+
84
+ ::: card Feature Announcement
85
+ Our latest feature is now available! Read the full documentation to learn more about how it works.
86
+
87
+ ::: button Learn_More #customization
88
+ :::
@@ -0,0 +1,154 @@
1
+ ---
2
+ title: "Container: Callouts"
3
+ description: "How to use callouts to highlight important information, warnings, tips, or notes in your documentation."
4
+ ---
5
+
6
+ # Callouts
7
+
8
+ Callouts are perfect for drawing the user's attention to a specific piece of information. They are visually distinct from the regular text and are ideal for tips, warnings, and important notes.
9
+
10
+ ## Usage
11
+
12
+ The basic syntax uses the `callout` container name, followed by the callout type.
13
+
14
+ ::: callout info
15
+ Container blocks (like `::: callout`) should be preceded by a blank line to ensure proper parsing by the markdown processor.
16
+ :::
17
+
18
+ **Syntax:**
19
+ ```markdown
20
+ ::: callout type
21
+ The main content of the callout.
22
+ :::
23
+ ```
24
+
25
+ **With Custom Title:**
26
+ ```markdown
27
+ ::: callout type Custom Title Here
28
+ The main content of the callout.
29
+ :::
30
+ ```
31
+
32
+ **Parameters:**
33
+ * `type`: The type determines the color and styling of the callout. Available types are: `info`, `tip`, `warning`, `danger`, `success`.
34
+ * `Custom Title Here` (optional): Any text following the type becomes the callout title.
35
+
36
+ ::: callout info Auto Emojis
37
+ Some themes (like Sky) automatically add emojis to callout titles: ℹ️ for info, ⚠️ for warning, 💡 for tip, 🚨 for danger, and ✅ for success.
38
+ :::
39
+
40
+ ---
41
+
42
+ ## Examples
43
+
44
+ ### Info
45
+
46
+ Use the `info` type for general notes or neutral supplementary details.
47
+
48
+ **Code:**
49
+ ```markdown
50
+ ::: callout info
51
+ This is an informational message. It's great for providing context or background information that is helpful but not critical.
52
+ :::
53
+ ```
54
+
55
+ **Rendered Preview:**
56
+ ::: callout info
57
+ This is an informational message. It's great for providing context or background information that is helpful but not critical.
58
+ :::
59
+
60
+ **With Custom Title:**
61
+ ```markdown
62
+ ::: callout info Quick Reference
63
+ This callout has a custom title that appears prominently at the top.
64
+ :::
65
+ ```
66
+
67
+ **Rendered Preview:**
68
+ ::: callout info Quick Reference
69
+ This callout has a custom title that appears prominently at the top.
70
+ :::
71
+
72
+ ### Tip
73
+
74
+ Use the `tip` type for helpful tips, best practices, or suggestions.
75
+
76
+ **Code:**
77
+ ```markdown
78
+ ::: callout tip
79
+ Here's a helpful tip to improve your workflow. Using this shortcut can save you a lot of time!
80
+ :::
81
+ ```
82
+
83
+ **Rendered Preview:**
84
+ ::: callout tip
85
+ Here's a helpful tip to improve your workflow. Using this shortcut can save you a lot of time!
86
+ :::
87
+
88
+ **With Custom Title:**
89
+ ```markdown
90
+ ::: callout tip Pro Tip
91
+ Custom titles help organize your callouts and make them more scannable for readers.
92
+ :::
93
+ ```
94
+
95
+ **Rendered Preview:**
96
+ ::: callout tip Pro Tip
97
+ Custom titles help organize your callouts and make them more scannable for readers.
98
+ :::
99
+
100
+ ### Warning
101
+
102
+ Use the `warning` type to indicate something that requires caution or might lead to unexpected results.
103
+
104
+ **Code:**
105
+ ```markdown
106
+ ::: callout warning
107
+ **Heads up!** Changing this setting can have unintended side effects. Please make sure you understand the consequences before proceeding.
108
+ :::
109
+ ```
110
+
111
+ **Rendered Preview:**
112
+ ::: callout warning
113
+ **Heads up!** Changing this setting can have unintended side effects. Please make sure you understand the consequences before proceeding.
114
+ :::
115
+
116
+ ### Danger
117
+
118
+ Use the `danger` type for critical information, destructive actions, or security warnings.
119
+
120
+ **Code:**
121
+ ```markdown
122
+ ::: callout danger
123
+ **Critical!** This action is irreversible and will result in permanent data loss. Do not proceed unless you have a backup.
124
+ :::
125
+ ```
126
+
127
+ **Rendered Preview:**
128
+ ::: callout danger
129
+ **Critical!** This action is irreversible and will result in permanent data loss. Do not proceed unless you have a backup.
130
+ :::
131
+
132
+ ## All Callout Types with Titles
133
+
134
+ Here's a quick reference showing all available callout types with custom titles:
135
+
136
+ ::: callout info Documentation Note
137
+ Use info callouts for neutral supplementary information.
138
+ :::
139
+
140
+ ::: callout tip Best Practice
141
+ Use tip callouts for helpful suggestions and best practices.
142
+ :::
143
+
144
+ ::: callout warning Important
145
+ Use warning callouts for actions that require caution.
146
+ :::
147
+
148
+ ::: callout danger Critical Alert
149
+ Use danger callouts for destructive actions or critical warnings.
150
+ :::
151
+
152
+ ::: callout success Task Complete
153
+ Use success callouts to indicate completed tasks or positive outcomes.
154
+ :::
@@ -0,0 +1,93 @@
1
+ ---
2
+ title: "Container: Cards"
3
+ description: "How to use cards to group related content into visually distinct blocks with an optional title."
4
+ ---
5
+
6
+ # Cards
7
+
8
+ Cards provide a visually distinct block for grouping related content. They are a versatile component that can be used for feature overviews, summaries, or linking to other sections.
9
+
10
+ ## Usage
11
+
12
+ The `card` container can be used with or without a title.
13
+
14
+ ::: callout info
15
+ Container blocks (like `::: card`) should be preceded by a blank line to ensure proper parsing by the markdown processor.
16
+ :::
17
+
18
+ **Syntax:**
19
+ ```markdown
20
+ ::: card Optional Card Title
21
+ The main body content of the card.
22
+ Supports **Markdown** formatting.
23
+ :::
24
+ ```
25
+ - `Optional Card Title`: If you provide text after `card`, it becomes the title of the card.
26
+
27
+ ---
28
+
29
+ ## Examples
30
+
31
+ ### Card with a Title
32
+
33
+ This is the most common use case, where the card has a clear heading.
34
+
35
+ **Code:**
36
+ ```markdown
37
+ ::: card My Feature Overview
38
+ This card describes an amazing feature.
39
+ * It's easy to use.
40
+ * It solves a common problem.
41
+
42
+ Learn more by reading the full guide.
43
+ :::
44
+ ```
45
+
46
+ **Rendered Preview:**
47
+ ::: card My Feature Overview
48
+ This card describes an amazing feature.
49
+ * It's easy to use.
50
+ * It solves a common problem.
51
+
52
+ Learn more by reading the full guide.
53
+ :::
54
+
55
+ ### Card without a Title
56
+
57
+ If you omit the title, the content starts directly. This is ideal for small, self-contained snippets or quotes.
58
+
59
+ **Code:**
60
+ ```markdown
61
+ ::: card
62
+ This is a card without an explicit title. The content starts directly, which is great for simple, focused information.
63
+ :::
64
+ ```
65
+
66
+ **Rendered Preview:**
67
+ ::: card
68
+ This is a card without an explicit title. The content starts directly, which is great for simple, focused information.
69
+ :::
70
+
71
+ ### Nesting Content in Cards
72
+
73
+ Cards are great for composition. You can easily place other elements, like buttons, inside a card to create a call to action.
74
+
75
+ **Code:**
76
+ ```markdown
77
+ ::: card Download the App
78
+ Get the latest version for your platform and start building today.
79
+
80
+ ::: button Learn_More #customization
81
+ ::: button View_GitHub external:https://github.com/mgks/docmd color:#5865f2
82
+ :::
83
+ ```
84
+
85
+ **Rendered Preview:**
86
+
87
+ ::: card Download the App
88
+ Get the latest version for your platform and start building today.
89
+
90
+ ::: button Learn_More #customization
91
+ ::: button View_GitHub external:https://github.com/mgks/docmd color:#5865f2
92
+
93
+ :::
@@ -0,0 +1,35 @@
1
+ ---
2
+ title: "Custom Containers"
3
+ description: "Enhance your documentation with special components like callouts, cards, steps, and tabs using docmd's custom container syntax."
4
+ ---
5
+
6
+ `docmd` provides a simple syntax for adding richer, pre-styled components to your Markdown content. These are powered by the `markdown-it-container` plugin.
7
+
8
+ The general syntax for simple containers like `callout` and `card` is:
9
+
10
+ ```markdown
11
+ ::: containerName [optionalTitleOrType]
12
+ Content for the container goes here.
13
+ :::
14
+ ```
15
+
16
+ For more complex components like `steps` and `tabs`, we use a more robust and intuitive syntax that relies on standard Markdown, preventing common nesting issues.
17
+
18
+ ## Advanced Nested Container System
19
+
20
+ With docmd v0.2.0, all containers support **seamless nesting** - you can nest any container within any other container to create complex, interactive documentation layouts.
21
+
22
+ **New in v0.2.0:** [Learn about nested containers →](./nested-containers)
23
+
24
+ ## Available Containers
25
+
26
+ Select a container type from the list below or from the sidebar to see detailed usage instructions and examples.
27
+
28
+ - [**Callouts**](./callouts/) - For highlighting important information like notes, tips, and warnings.
29
+ - [**Cards**](./cards/) - For grouping related content into visually distinct blocks.
30
+ - [**Steps**](./steps/) - For presenting a sequence of instructions in a numbered format.
31
+ - [**Tabs**](./tabs/) - For organizing content in a switchable, tabbed interface.
32
+ - [**Buttons**](./buttons/) - For creating stylish, clickable calls to action.
33
+ - [**Nested Containers**](./nested-containers/) - For creating complex, interactive layouts with container nesting.
34
+
35
+ These custom containers allow you to create more engaging and structured documentation without needing to write custom HTML or CSS.