@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,107 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Light & Dark Mode"
|
|
3
|
+
description: "How to configure and manage light and dark themes in your docmd documentation."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Light & Dark Mode
|
|
7
|
+
|
|
8
|
+
`docmd` provides built-in support for light and dark color schemes to enhance readability and user experience. Users can choose their preferred viewing mode, which improves accessibility and reduces eye strain in different lighting conditions.
|
|
9
|
+
|
|
10
|
+
## Setting the Default Theme
|
|
11
|
+
|
|
12
|
+
You can set the default theme for your site in the `config.js` file:
|
|
13
|
+
|
|
14
|
+
```javascript
|
|
15
|
+
// config.js
|
|
16
|
+
module.exports = {
|
|
17
|
+
// ... other config ...
|
|
18
|
+
theme: {
|
|
19
|
+
name: 'default', // or 'sky'
|
|
20
|
+
defaultMode: 'dark', // Can be 'light' or 'dark'
|
|
21
|
+
enableModeToggle: true, // Enable the toggle button in the UI
|
|
22
|
+
},
|
|
23
|
+
// ...
|
|
24
|
+
};
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
* `defaultMode: 'light'`: The site will initially render with the light color scheme.
|
|
28
|
+
* `defaultMode: 'dark'`: The site will initially render with the dark color scheme.
|
|
29
|
+
* `enableModeToggle: true`: Shows a toggle button in the sidebar for users to switch modes.
|
|
30
|
+
|
|
31
|
+
If `defaultMode` is not specified, it defaults to `'light'`.
|
|
32
|
+
|
|
33
|
+
## How It Works
|
|
34
|
+
|
|
35
|
+
The theme is controlled by a `data-theme` attribute on the `<body>` tag of your HTML pages:
|
|
36
|
+
* `<body data-theme="light">` for light mode.
|
|
37
|
+
* `<body data-theme="dark">` for dark mode.
|
|
38
|
+
|
|
39
|
+
For the `sky` theme, the values would be `sky-light` and `sky-dark`.
|
|
40
|
+
|
|
41
|
+
CSS variables in the theme files define colors, backgrounds, fonts, etc., for both modes:
|
|
42
|
+
|
|
43
|
+
```css
|
|
44
|
+
/* Example from main.css */
|
|
45
|
+
:root {
|
|
46
|
+
--bg-color: #ffffff;
|
|
47
|
+
--text-color: #333333;
|
|
48
|
+
/* ... other light theme variables ... */
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
body[data-theme="dark"] {
|
|
52
|
+
--bg-color: #1a1a1a;
|
|
53
|
+
--text-color: #e0e0e0;
|
|
54
|
+
/* ... other dark theme variables ... */
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
body {
|
|
58
|
+
background-color: var(--bg-color);
|
|
59
|
+
color: var(--text-color);
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## User Preference Toggle
|
|
64
|
+
|
|
65
|
+
When `enableModeToggle` is set to `true`, a toggle button appears in the sidebar that allows users to switch between light and dark modes:
|
|
66
|
+
|
|
67
|
+
```javascript
|
|
68
|
+
// config.js
|
|
69
|
+
theme: {
|
|
70
|
+
defaultMode: 'light',
|
|
71
|
+
enableModeToggle: true, // Shows the toggle button
|
|
72
|
+
},
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
The toggle button uses Lucide icons (`sun` and `moon`) to indicate the current mode and what will happen when clicked.
|
|
76
|
+
|
|
77
|
+
### User Preference Persistence
|
|
78
|
+
|
|
79
|
+
When a user selects a theme, their preference is saved in their browser's `localStorage` so it persists across sessions and page loads. The implementation uses the following logic:
|
|
80
|
+
|
|
81
|
+
1. Check if the user has a saved preference in `localStorage`
|
|
82
|
+
2. If not, use the `defaultMode` from the configuration
|
|
83
|
+
3. When the user clicks the toggle button, update both the display and the stored preference
|
|
84
|
+
|
|
85
|
+
## Syntax Highlighting Themes
|
|
86
|
+
|
|
87
|
+
`docmd` also includes separate stylesheets for code block syntax highlighting that are compatible with light and dark modes:
|
|
88
|
+
|
|
89
|
+
* `highlight-light.css` for light mode
|
|
90
|
+
* `highlight-dark.css` for dark mode
|
|
91
|
+
|
|
92
|
+
The correct syntax highlighting theme is loaded automatically based on the current theme mode. When the user toggles the mode, the appropriate syntax highlighting theme is also switched dynamically.
|
|
93
|
+
|
|
94
|
+
## Customizing Theme Colors
|
|
95
|
+
|
|
96
|
+
You can customize the colors for both light and dark modes by adding custom CSS to your project. See [Custom CSS & JS](/theming/custom-css-js/) for more information.
|
|
97
|
+
|
|
98
|
+
```css
|
|
99
|
+
/* Example of overriding theme colors in your custom CSS */
|
|
100
|
+
:root {
|
|
101
|
+
--link-color: #0077cc; /* Custom link color for light mode */
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
body[data-theme="dark"] {
|
|
105
|
+
--link-color: #4da6ff; /* Custom link color for dark mode */
|
|
106
|
+
}
|
|
107
|
+
```
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Custom Containers"
|
|
3
|
+
description: "Enhance your documentation with special components like callouts, cards, and steps using docmd's custom container syntax."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Custom Containers
|
|
7
|
+
|
|
8
|
+
`docmd` provides a simple syntax for adding richer, pre-styled components to your Markdown content using "custom containers." These are powered by the `markdown-it-container` plugin.
|
|
9
|
+
|
|
10
|
+
The general syntax is:
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
::: containerName [optionalTitleOrType]
|
|
14
|
+
Content for the container goes here.
|
|
15
|
+
It can span **multiple lines** and include other *Markdown* elements.
|
|
16
|
+
:::
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Callouts
|
|
20
|
+
|
|
21
|
+
Callouts are useful for highlighting important information, warnings, tips, or notes.
|
|
22
|
+
|
|
23
|
+
**Syntax:**
|
|
24
|
+
```
|
|
25
|
+
::: callout type
|
|
26
|
+
Content of the callout.
|
|
27
|
+
:::
|
|
28
|
+
```
|
|
29
|
+
* `type`: Can be `info`, `warning`, `tip`, or `danger`.
|
|
30
|
+
|
|
31
|
+
**Examples:**
|
|
32
|
+
|
|
33
|
+
::: callout info
|
|
34
|
+
This is an informational message. It's good for general notes or neutral supplementary details.
|
|
35
|
+
:::
|
|
36
|
+
|
|
37
|
+
::: callout warning
|
|
38
|
+
**Watch out!** This indicates something that requires caution or might lead to unexpected results if ignored.
|
|
39
|
+
:::
|
|
40
|
+
|
|
41
|
+
::: callout tip
|
|
42
|
+
Here's a helpful tip or a best practice suggestion to improve a process or understanding.
|
|
43
|
+
:::
|
|
44
|
+
|
|
45
|
+
::: callout danger
|
|
46
|
+
**Critical!** This highlights a potential risk, a destructive action, or something that must be avoided.
|
|
47
|
+
:::
|
|
48
|
+
|
|
49
|
+
## Cards
|
|
50
|
+
|
|
51
|
+
Cards provide a visually distinct block for grouping related content, often with a title.
|
|
52
|
+
|
|
53
|
+
**Syntax:**
|
|
54
|
+
```
|
|
55
|
+
::: card Optional Card Title
|
|
56
|
+
The main body content of the card.
|
|
57
|
+
Supports **Markdown** formatting.
|
|
58
|
+
- List item 1
|
|
59
|
+
- List item 2
|
|
60
|
+
:::
|
|
61
|
+
```
|
|
62
|
+
* `Optional Card Title`: If provided after `card`, it becomes the title of the card.
|
|
63
|
+
|
|
64
|
+
**Example:**
|
|
65
|
+
|
|
66
|
+
::: card My Feature Overview
|
|
67
|
+
This card describes an amazing feature.
|
|
68
|
+
* It's easy to use.
|
|
69
|
+
* It solves a common problem.
|
|
70
|
+
|
|
71
|
+
Learn more by reading the full guide.
|
|
72
|
+
:::
|
|
73
|
+
|
|
74
|
+
::: card
|
|
75
|
+
This is a card without an explicit title. The content starts directly.
|
|
76
|
+
Ideal for small, self-contained snippets.
|
|
77
|
+
:::
|
|
78
|
+
|
|
79
|
+
## Steps
|
|
80
|
+
|
|
81
|
+
The "steps" container is designed for presenting a sequence of actions or instructions, often in a numbered or ordered fashion.
|
|
82
|
+
|
|
83
|
+
**Syntax:**
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
::: steps
|
|
87
|
+
> 1. **First Step Title:**
|
|
88
|
+
> Description of the first step.
|
|
89
|
+
|
|
90
|
+
> 2. **Second Step Title:**
|
|
91
|
+
> Description of the second step.
|
|
92
|
+
|
|
93
|
+
> *. **Using Asterisk:**
|
|
94
|
+
> Alternative numbering style.
|
|
95
|
+
|
|
96
|
+
> **No Number:**
|
|
97
|
+
> Without a number.
|
|
98
|
+
:::
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**How it works:**
|
|
102
|
+
|
|
103
|
+
The steps container uses blockquotes (`>`) to define individual steps. Start each step with a number or asterisk followed by a period, then the step title in bold. The content after the title becomes the step content.
|
|
104
|
+
|
|
105
|
+
**Example:**
|
|
106
|
+
|
|
107
|
+
::: steps
|
|
108
|
+
> 1. **Install Dependencies:**
|
|
109
|
+
> First, make sure you have Node.js and npm installed. Then, run:
|
|
110
|
+
>
|
|
111
|
+
> ```bash
|
|
112
|
+
> npm install my-package
|
|
113
|
+
> ```
|
|
114
|
+
|
|
115
|
+
> 2. **Configure the Settings:**
|
|
116
|
+
> Open the `config.json` file and update the `apiKey` with your credentials.
|
|
117
|
+
|
|
118
|
+
> 3. **Run the Application:**
|
|
119
|
+
> Start the application using:
|
|
120
|
+
>
|
|
121
|
+
> ```bash
|
|
122
|
+
> npm start
|
|
123
|
+
> ```
|
|
124
|
+
>
|
|
125
|
+
> You should see "Application started successfully!" in your console.
|
|
126
|
+
:::
|
|
127
|
+
:::
|
|
128
|
+
|
|
129
|
+
These custom containers allow you to create more engaging and structured documentation without needing to write custom HTML or CSS for common patterns. Experiment with them to see how they can improve your content's clarity and visual appeal.
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Frontmatter"
|
|
3
|
+
description: "How to use YAML frontmatter to define page metadata in your docmd Markdown files."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Frontmatter
|
|
7
|
+
|
|
8
|
+
Every Markdown (`.md`) file that `docmd` processes **must** begin with YAML frontmatter. Frontmatter is a block of YAML (YAML Ain't Markup Language) enclosed by triple-dashed lines (`---`) at the very beginning of your file. It's used to set metadata for each page.
|
|
9
|
+
|
|
10
|
+
## Basic Structure
|
|
11
|
+
|
|
12
|
+
```yaml
|
|
13
|
+
---
|
|
14
|
+
title: "My Awesome Page Title"
|
|
15
|
+
description: "A concise and informative description for this page, used for SEO and potentially in listings."
|
|
16
|
+
# You can add other custom fields here if needed for your templates or logic
|
|
17
|
+
order: 1 # Example: for custom sorting if you implement such logic
|
|
18
|
+
tags:
|
|
19
|
+
- guide
|
|
20
|
+
- advanced
|
|
21
|
+
---
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Required Fields
|
|
25
|
+
|
|
26
|
+
* **`title`** (String, Required)
|
|
27
|
+
* **Purpose:** This is the primary title of the page.
|
|
28
|
+
* **Usage:**
|
|
29
|
+
* Used for the HTML `<title>` tag (e.g., `Page Title | Site Title`).
|
|
30
|
+
* Often used as the main heading (`<h1>`) on the page by default (though themes can customize this).
|
|
31
|
+
* Used as the display text for links in the navigation sidebar if the path matches.
|
|
32
|
+
* **Example:** `title: "Installation Guide"`
|
|
33
|
+
|
|
34
|
+
## Optional Fields (Recommended)
|
|
35
|
+
|
|
36
|
+
* **`description`** (String, Optional)
|
|
37
|
+
* **Purpose:** A brief summary of the page's content.
|
|
38
|
+
* **Usage:**
|
|
39
|
+
* Used for the HTML `<meta name="description">` tag, which is important for search engine optimization (SEO) and search result snippets.
|
|
40
|
+
* **Example:** `description: "Learn how to install and configure the XYZ widget."`
|
|
41
|
+
|
|
42
|
+
## Custom Fields
|
|
43
|
+
|
|
44
|
+
You can include any other custom fields in your frontmatter. These fields won't be used by `docmd`'s core functionality directly but can be accessed if you decide to customize EJS templates or write plugins in the future.
|
|
45
|
+
|
|
46
|
+
Examples of custom fields you *might* add (these are not built-in features):
|
|
47
|
+
|
|
48
|
+
* `author`: "Jane Doe"
|
|
49
|
+
* `date`: "2023-10-26"
|
|
50
|
+
* `order`: 2 (For custom sorting of pages within a section, if you implement logic for it)
|
|
51
|
+
* `draft`: true (To mark a page as a draft, if you implement logic to exclude drafts from builds)
|
|
52
|
+
* `tags`: ["tag1", "tag2"]
|
|
53
|
+
|
|
54
|
+
## Example Usage
|
|
55
|
+
|
|
56
|
+
Consider a file named `docs/guides/installation.md`:
|
|
57
|
+
|
|
58
|
+
```markdown
|
|
59
|
+
---
|
|
60
|
+
title: "Installation Steps"
|
|
61
|
+
description: "A step-by-step guide to installing our application on various platforms."
|
|
62
|
+
order: 1
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
# Application Installation
|
|
66
|
+
|
|
67
|
+
This guide will walk you through installing our application...
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
In this example:
|
|
71
|
+
* The browser tab will show "Installation Steps | Your Site Title".
|
|
72
|
+
* The `<meta name="description">` will be set.
|
|
73
|
+
* The `order: 1` field is available if you later want to sort "guides" pages by this value.
|
|
74
|
+
|
|
75
|
+
Using frontmatter consistently ensures your pages are well-defined, SEO-friendly, and integrate smoothly with `docmd`'s navigation and theming systems.
|
|
76
|
+
```
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Writing Content with docmd"
|
|
3
|
+
description: "Learn how to write effective documentation using Markdown, frontmatter, and custom components in docmd."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Writing Content
|
|
7
|
+
|
|
8
|
+
`docmd` is designed to let you focus on your content, written in standard Markdown. This section covers the essentials of creating pages, structuring your content, and leveraging `docmd`'s features to enhance your documentation.
|
|
9
|
+
|
|
10
|
+
## Key Aspects:
|
|
11
|
+
|
|
12
|
+
* **[Frontmatter](/writing-content/frontmatter/):** Define page-specific metadata like titles and descriptions using simple YAML at the top of your Markdown files.
|
|
13
|
+
* **[Markdown Syntax](/writing-content/markdown-syntax/):** Utilize standard CommonMark and GitHub Flavored Markdown for formatting your text, code blocks, lists, tables, and more.
|
|
14
|
+
* **[Custom Containers](/writing-content/custom-containers/):** Enhance your pages with special components like callouts, cards, and steps using a simple `::: name :::` syntax.
|
|
15
|
+
* **[Steps Container](/writing-content/steps-test/):** Create sequential guides with the specialized steps container.
|
|
16
|
+
|
|
17
|
+
By understanding these elements, you can create rich, well-structured, and engaging documentation.
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Markdown Syntax Guide"
|
|
3
|
+
description: "Learn how to use Markdown syntax to format your documentation in docmd."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Markdown Syntax
|
|
7
|
+
|
|
8
|
+
`docmd` uses `markdown-it` under the hood, which is a highly extensible and standards-compliant Markdown parser. It supports CommonMark syntax by default, along with some useful extensions like GitHub Flavored Markdown (GFM) tables and strikethrough.
|
|
9
|
+
|
|
10
|
+
## Common Elements
|
|
11
|
+
|
|
12
|
+
You can use all standard Markdown elements:
|
|
13
|
+
|
|
14
|
+
* **Headings:**
|
|
15
|
+
```markdown
|
|
16
|
+
# Heading 1
|
|
17
|
+
## Heading 2
|
|
18
|
+
### Heading 3
|
|
19
|
+
...
|
|
20
|
+
###### Heading 6
|
|
21
|
+
```
|
|
22
|
+
* **Paragraphs:** Just type text. Separate paragraphs with a blank line.
|
|
23
|
+
* **Emphasis:**
|
|
24
|
+
```markdown
|
|
25
|
+
*This text will be italic.*
|
|
26
|
+
_This will also be italic._
|
|
27
|
+
|
|
28
|
+
**This text will be bold.**
|
|
29
|
+
__This will also be bold.__
|
|
30
|
+
|
|
31
|
+
***This text will be bold and italic.***
|
|
32
|
+
```
|
|
33
|
+
* **Lists:**
|
|
34
|
+
* **Unordered:**
|
|
35
|
+
```markdown
|
|
36
|
+
* Item 1
|
|
37
|
+
* Item 2
|
|
38
|
+
* Nested Item 2a
|
|
39
|
+
* Nested Item 2b
|
|
40
|
+
+ Item 3 (using +)
|
|
41
|
+
- Item 4 (using -)
|
|
42
|
+
```
|
|
43
|
+
* **Ordered:**
|
|
44
|
+
```markdown
|
|
45
|
+
1. First item
|
|
46
|
+
2. Second item
|
|
47
|
+
3. Third item
|
|
48
|
+
1. Nested ordered item
|
|
49
|
+
```
|
|
50
|
+
* **Links:**
|
|
51
|
+
```markdown
|
|
52
|
+
[Link Text](https://www.example.com)
|
|
53
|
+
[Link with Title](https://www.example.com "Link Title")
|
|
54
|
+
[Relative Link to another page](../section/other-page.md)
|
|
55
|
+
```
|
|
56
|
+
*Note: For internal links to other documentation pages, use relative paths to the `.md` files. `docmd` will convert these to the correct HTML paths during the build.*
|
|
57
|
+
|
|
58
|
+
* **Images:**
|
|
59
|
+
```markdown
|
|
60
|
+

|
|
61
|
+
```
|
|
62
|
+
*Place images in your `docs/` directory (e.g., `docs/images/`) or a similar assets folder that gets copied to your `site/` output.*
|
|
63
|
+
|
|
64
|
+
* **Blockquotes:**
|
|
65
|
+
```markdown
|
|
66
|
+
> This is a blockquote.
|
|
67
|
+
> It can span multiple lines.
|
|
68
|
+
```
|
|
69
|
+
* **Horizontal Rules:**
|
|
70
|
+
```markdown
|
|
71
|
+
---
|
|
72
|
+
***
|
|
73
|
+
___
|
|
74
|
+
```
|
|
75
|
+
* **Inline Code:**
|
|
76
|
+
```markdown
|
|
77
|
+
Use `backticks` for inline code like `variableName`.
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Code Blocks & Syntax Highlighting
|
|
81
|
+
|
|
82
|
+
`docmd` uses `highlight.js` for automatic syntax highlighting of fenced code blocks. Specify the language after the opening triple backticks:
|
|
83
|
+
|
|
84
|
+
```javascript
|
|
85
|
+
function greet(name) {
|
|
86
|
+
console.log(`Hello, ${name}!`);
|
|
87
|
+
}
|
|
88
|
+
greet('docmd user');
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
def hello():
|
|
93
|
+
print("Hello from Python!")
|
|
94
|
+
|
|
95
|
+
hello()
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
```html
|
|
99
|
+
<div>
|
|
100
|
+
<p>This is some HTML.</p>
|
|
101
|
+
</div>
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
```css
|
|
105
|
+
body {
|
|
106
|
+
font-family: sans-serif;
|
|
107
|
+
color: #333;
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
npm install -g docmd
|
|
113
|
+
docmd init my-docs
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
If you don't specify a language, `highlight.js` will attempt to auto-detect it, or it will be rendered as plain preformatted text.
|
|
117
|
+
|
|
118
|
+
## Tables (GFM Style)
|
|
119
|
+
|
|
120
|
+
You can create tables using GitHub Flavored Markdown syntax:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
| Header 1 | Header 2 | Header 3 |
|
|
124
|
+
| :------- | :------: | -------: |
|
|
125
|
+
| Align L | Center | Align R |
|
|
126
|
+
| Cell 1 | Cell 2 | Cell 3 |
|
|
127
|
+
| Cell 4 | Cell 5 | Cell 6 |
|
|
128
|
+
```
|
|
129
|
+
Renders as:
|
|
130
|
+
|
|
131
|
+
| Header 1 | Header 2 | Header 3 |
|
|
132
|
+
| :------- | :------: | -------: |
|
|
133
|
+
| Align L | Center | Align R |
|
|
134
|
+
| Cell 1 | Cell 2 | Cell 3 |
|
|
135
|
+
| Cell 4 | Cell 5 | Cell 6 |
|
|
136
|
+
|
|
137
|
+
## Strikethrough (GFM Style)
|
|
138
|
+
|
|
139
|
+
Wrap text with two tildes (`~~`) for strikethrough:
|
|
140
|
+
```bash
|
|
141
|
+
This is ~~strikethrough~~ text.
|
|
142
|
+
```
|
|
143
|
+
Renders as: This is ~~strikethrough~~ text.
|
|
144
|
+
|
|
145
|
+
## HTML
|
|
146
|
+
|
|
147
|
+
Because `markdown-it` is configured with `html: true`, you can embed raw HTML directly in your Markdown files. However, use this sparingly, as it can make your content less portable and harder to maintain.
|
|
148
|
+
|
|
149
|
+
```html
|
|
150
|
+
<div style="color: blue;">
|
|
151
|
+
This is a blue div rendered directly from HTML.
|
|
152
|
+
</div>
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
For most formatting needs, standard Markdown and `docmd`'s [Custom Containers](./custom-containers.md) should suffice.
|
|
156
|
+
|
|
157
|
+
# Advanced Markdown Capabilities
|
|
158
|
+
|
|
159
|
+
Beyond the basic syntax, `docmd` supports a variety of advanced Markdown features to help you create richer documentation.
|
|
160
|
+
|
|
161
|
+
## Example Callout
|
|
162
|
+
|
|
163
|
+
::: callout info
|
|
164
|
+
This is a real callout example to test container rendering. Callouts are great for highlighting important information.
|
|
165
|
+
:::
|
|
166
|
+
|
|
167
|
+
::: callout warning
|
|
168
|
+
**Warning!** Be careful when using advanced features, ensure they are properly documented.
|
|
169
|
+
:::
|
|
170
|
+
|
|
171
|
+
## GFM (GitHub Flavored Markdown)
|
|
172
|
+
|
|
173
|
+
docmd supports GitHub Flavored Markdown extensions including:
|
|
174
|
+
|
|
175
|
+
- **Task Lists** - Create interactive checklists:
|
|
176
|
+
```markdown
|
|
177
|
+
- [x] Completed task
|
|
178
|
+
- [ ] Incomplete task
|
|
179
|
+
- [ ] Another item
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Renders as:
|
|
183
|
+
- [x] Completed task
|
|
184
|
+
- [ ] Incomplete task
|
|
185
|
+
- [ ] Another item
|
|
186
|
+
|
|
187
|
+
- **Autolinked References** - URL and email addresses are automatically linked:
|
|
188
|
+
```markdown
|
|
189
|
+
Visit https://docmd.mgks.dev for more information.
|
|
190
|
+
Contact support@example.com for help.
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
- **Emoji** - Use emoji shortcodes:
|
|
194
|
+
```markdown
|
|
195
|
+
I :heart: documentation! :rocket: :smile:
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Renders emoji symbols like: I ❤️ documentation! 🚀 😄
|
|
199
|
+
|
|
200
|
+
## Footnotes
|
|
201
|
+
|
|
202
|
+
You can add footnotes to your content for references or additional information[^1].
|
|
203
|
+
|
|
204
|
+
```markdown
|
|
205
|
+
Here's a statement that needs citation[^1].
|
|
206
|
+
|
|
207
|
+
[^1]: This is the footnote content.
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Multiple footnotes can be used throughout your document[^2], and the definitions can be collected at the bottom.
|
|
211
|
+
|
|
212
|
+
[^1]: This is the first footnote reference.
|
|
213
|
+
[^2]: This is the second footnote with more information.
|
|
214
|
+
|
|
215
|
+
## Definition Lists
|
|
216
|
+
|
|
217
|
+
Some Markdown parsers support definition lists:
|
|
218
|
+
|
|
219
|
+
```markdown
|
|
220
|
+
Term
|
|
221
|
+
: Definition for the term.
|
|
222
|
+
: Another definition for the same term.
|
|
223
|
+
|
|
224
|
+
Another Term
|
|
225
|
+
: Definition of another term.
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Term
|
|
229
|
+
: Definition for the term.
|
|
230
|
+
: Another definition for the same term.
|
|
231
|
+
|
|
232
|
+
Another Term
|
|
233
|
+
: Definition of another term.
|
|
234
|
+
|
|
235
|
+
## Abbreviations
|
|
236
|
+
|
|
237
|
+
You can define abbreviations in your Markdown (depending on plugin support):
|
|
238
|
+
|
|
239
|
+
```markdown
|
|
240
|
+
*[HTML]: Hyper Text Markup Language
|
|
241
|
+
*[W3C]: World Wide Web Consortium
|
|
242
|
+
|
|
243
|
+
HTML is defined by the W3C standards.
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
*[HTML]: Hyper Text Markup Language
|
|
247
|
+
*[W3C]: World Wide Web Consortium
|
|
248
|
+
|
|
249
|
+
HTML is defined by the W3C standards.
|
|
250
|
+
|
|
251
|
+
## Math Expressions
|
|
252
|
+
|
|
253
|
+
If enabled with the appropriate plugins, you can include mathematical expressions using LaTeX syntax:
|
|
254
|
+
|
|
255
|
+
```markdown
|
|
256
|
+
Inline math: $E=mc^2$
|
|
257
|
+
|
|
258
|
+
Block math:
|
|
259
|
+
$$
|
|
260
|
+
\frac{d}{dx}e^x = e^x
|
|
261
|
+
$$
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
## Container Extensions
|
|
265
|
+
|
|
266
|
+
Beyond standard Markdown, docmd provides custom containers for enhanced formatting.
|
|
267
|
+
These are detailed in the [Custom Containers](./custom-containers.md) guide, and include:
|
|
268
|
+
|
|
269
|
+
::: callout info
|
|
270
|
+
Use containers for callouts, cards, and steps to structure your documentation.
|
|
271
|
+
:::
|
|
272
|
+
|
|
273
|
+
## Conclusion
|
|
274
|
+
|
|
275
|
+
Markdown provides a powerful yet simple way to write and format documentation. With docmd's extensions and customizations, you can create rich, beautiful documentation that's easy to maintain.
|
|
276
|
+
|
|
277
|
+
For more examples and practical applications, check the rest of the documentation or browse the source of this page by viewing its Markdown file.
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mgks/docmd",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Generate beautiful, lightweight static documentation sites directly from your Markdown files. Zero clutter, just content.",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"docmd": "./bin/docmd.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"start": "node ./bin/docmd.js dev",
|
|
11
|
+
"build": "node ./bin/docmd.js build",
|
|
12
|
+
"lint": "eslint .",
|
|
13
|
+
"format": "prettier --write .",
|
|
14
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
15
|
+
},
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=22.0.0"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/mgks/docmd.git"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"markdown",
|
|
25
|
+
"static-site-generator",
|
|
26
|
+
"documentation",
|
|
27
|
+
"ssg",
|
|
28
|
+
"docs",
|
|
29
|
+
"generator"
|
|
30
|
+
],
|
|
31
|
+
"author": "Ghazi <hello@mgks.dev>",
|
|
32
|
+
"license": "MIT",
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/mgks/docmd/issues"
|
|
35
|
+
},
|
|
36
|
+
"homepage": "https://github.com/mgks/docmd#readme",
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"chokidar": "^3.6.0",
|
|
39
|
+
"commander": "^12.0.0",
|
|
40
|
+
"ejs": "^3.1.9",
|
|
41
|
+
"express": "^4.19.2",
|
|
42
|
+
"fs-extra": "^11.2.0",
|
|
43
|
+
"gray-matter": "^4.0.3",
|
|
44
|
+
"highlight.js": "^11.11.1",
|
|
45
|
+
"lucide-static": "^0.508.0",
|
|
46
|
+
"markdown-it": "^14.1.0",
|
|
47
|
+
"markdown-it-container": "^4.0.0",
|
|
48
|
+
"ws": "^8.17.0"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"eslint": "^8.57.0",
|
|
52
|
+
"eslint-config-prettier": "^9.1.0",
|
|
53
|
+
"eslint-plugin-node": "^11.1.0",
|
|
54
|
+
"prettier": "^3.2.5"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}.hljs{color:#abb2bf;background:#282c34}.hljs-comment,.hljs-quote{color:#5c6370;font-style:italic}.hljs-doctag,.hljs-formula,.hljs-keyword{color:#c678dd}.hljs-deletion,.hljs-name,.hljs-section,.hljs-selector-tag,.hljs-subst{color:#e06c75}.hljs-literal{color:#56b6c2}.hljs-addition,.hljs-attribute,.hljs-meta .hljs-string,.hljs-regexp,.hljs-string{color:#98c379}.hljs-attr,.hljs-number,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-pseudo,.hljs-template-variable,.hljs-type,.hljs-variable{color:#d19a66}.hljs-bullet,.hljs-link,.hljs-meta,.hljs-selector-id,.hljs-symbol,.hljs-title{color:#61aeee}.hljs-built_in,.hljs-class .hljs-title,.hljs-title.class_{color:#e6c07b}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:700}.hljs-link{text-decoration:underline}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}.hljs{color:#383a42;background:#fafafa}.hljs-comment,.hljs-quote{color:#a0a1a7;font-style:italic}.hljs-doctag,.hljs-formula,.hljs-keyword{color:#a626a4}.hljs-deletion,.hljs-name,.hljs-section,.hljs-selector-tag,.hljs-subst{color:#e45649}.hljs-literal{color:#0184bb}.hljs-addition,.hljs-attribute,.hljs-meta .hljs-string,.hljs-regexp,.hljs-string{color:#50a14f}.hljs-attr,.hljs-number,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-pseudo,.hljs-template-variable,.hljs-type,.hljs-variable{color:#986801}.hljs-bullet,.hljs-link,.hljs-meta,.hljs-selector-id,.hljs-symbol,.hljs-title{color:#4078f2}.hljs-built_in,.hljs-class .hljs-title,.hljs-title.class_{color:#c18401}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:700}.hljs-link{text-decoration:underline}
|