@udx/md2html 1.2.0 → 1.2.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/README.md +17 -54
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,9 +6,10 @@ A sophisticated tool for converting markdown files into a single, visually polis
|
|
|
6
6
|
|
|
7
7
|
- **Markdown Consolidation**: Intelligently combines and sorts multiple markdown files into a single cohesive document
|
|
8
8
|
- **Magazine-Quality Styling**: Applies high-end editorial styling with precise typography and spacing
|
|
9
|
-
- **Code Block Enhancements**: Syntax highlighting with file type indicators
|
|
9
|
+
- **Code Block Enhancements**: Syntax highlighting with file type indicators
|
|
10
10
|
- **Responsive Images**: Handles high-resolution images with proper sizing and caption support
|
|
11
11
|
- **Watch Mode**: Automatically rebuilds when source files change with intelligent debouncing
|
|
12
|
+
- **Browser Preview**: Live preview server with automatic browser opening
|
|
12
13
|
- **Print Optimization**: Carefully crafted print styling for document printing and PDF generation
|
|
13
14
|
- **Table of Contents**: Auto-generates navigable table of contents from document structure
|
|
14
15
|
- **Customizable**: External CSS, JavaScript, and HTML templates for easy customization
|
|
@@ -36,25 +37,33 @@ npm install --save-dev @udx/md2html
|
|
|
36
37
|
|
|
37
38
|
```bash
|
|
38
39
|
# Convert a single markdown file to HTML
|
|
39
|
-
md2html
|
|
40
|
+
md2html -s path/to/file.md -o output.html
|
|
40
41
|
|
|
41
|
-
# Convert all markdown files in a directory
|
|
42
|
-
md2html
|
|
42
|
+
# Convert all markdown files in a directory
|
|
43
|
+
md2html -s path/to/markdown/dir -o documentation.html
|
|
43
44
|
|
|
44
45
|
# Watch for changes and rebuild automatically
|
|
45
|
-
md2html
|
|
46
|
+
md2html -s path/to/markdown/dir -o documentation.html --watch
|
|
47
|
+
|
|
48
|
+
# Open in browser with live preview
|
|
49
|
+
md2html -s path/to/file.md --preview
|
|
50
|
+
|
|
51
|
+
# Custom port for preview server
|
|
52
|
+
md2html -s path/to/markdown/dir --preview --port 3000
|
|
46
53
|
|
|
47
54
|
# Enable debug output
|
|
48
|
-
md2html
|
|
55
|
+
md2html -s path/to/markdown/dir -o documentation.html --debug
|
|
49
56
|
```
|
|
50
57
|
|
|
51
58
|
## CLI Options
|
|
52
59
|
|
|
53
60
|
| Option | Description |
|
|
54
61
|
|--------|-------------|
|
|
55
|
-
| `-s, --src <
|
|
56
|
-
| `-o, --out <
|
|
62
|
+
| `-s, --src <file>` | Source markdown file or directory (required) |
|
|
63
|
+
| `-o, --out <file>` | Output HTML file path (optional - defaults to ./output.html) |
|
|
57
64
|
| `-w, --watch` | Watch for changes and rebuild automatically |
|
|
65
|
+
| `-p, --preview` | Open generated HTML in browser with live preview server |
|
|
66
|
+
| `--port <number>` | Port for preview server (default: random) |
|
|
58
67
|
| `-d, --debug` | Enable debug logging |
|
|
59
68
|
| `-h, --help` | Display help information |
|
|
60
69
|
| `-v, --version` | Output the version number |
|
|
@@ -101,28 +110,6 @@ Add captions to images with this syntax:
|
|
|
101
110
|
*This is the image caption*
|
|
102
111
|
```
|
|
103
112
|
|
|
104
|
-
### Mermaid Diagrams
|
|
105
|
-
|
|
106
|
-
Create professional diagrams using Mermaid syntax:
|
|
107
|
-
|
|
108
|
-
````markdown
|
|
109
|
-
```mermaid
|
|
110
|
-
flowchart LR
|
|
111
|
-
A[Client] --> B[Load Balancer]
|
|
112
|
-
B --> C[Server1]
|
|
113
|
-
B --> D[Server2]
|
|
114
|
-
```
|
|
115
|
-
````
|
|
116
|
-
|
|
117
|
-
Supported Mermaid diagram types:
|
|
118
|
-
- **Flowcharts**: Process flows and workflows
|
|
119
|
-
- **Sequence Diagrams**: System interactions over time
|
|
120
|
-
- **Gantt Charts**: Project timelines and schedules
|
|
121
|
-
- **Entity Relationship Diagrams**: Database schemas
|
|
122
|
-
- **User Journey**: User experience flows
|
|
123
|
-
- **Git Graphs**: Version control workflows
|
|
124
|
-
|
|
125
|
-
The diagrams are automatically rendered when the HTML document loads, with professional styling that matches the document theme.
|
|
126
113
|
|
|
127
114
|
## Customization
|
|
128
115
|
|
|
@@ -170,17 +157,6 @@ gh repo clone owner/repo
|
|
|
170
157
|
md2html --src ./repo/docs --out documentation.html
|
|
171
158
|
```
|
|
172
159
|
|
|
173
|
-
## Command Line Options
|
|
174
|
-
|
|
175
|
-
```
|
|
176
|
-
Options:
|
|
177
|
-
-V, --version output the version number
|
|
178
|
-
-s, --src <directory> Source directory containing markdown files
|
|
179
|
-
-o, --out <file> Output HTML file path
|
|
180
|
-
-w, --watch Watch for changes and rebuild automatically (default: false)
|
|
181
|
-
-d, --debug Enable debug logging (default: false)
|
|
182
|
-
-h, --help display help for command
|
|
183
|
-
```
|
|
184
160
|
|
|
185
161
|
## Output Example
|
|
186
162
|
|
|
@@ -193,19 +169,6 @@ The generated HTML document includes:
|
|
|
193
169
|
- Print-optimized layout with page breaks
|
|
194
170
|
- Responsive design for various screen sizes
|
|
195
171
|
|
|
196
|
-
## API Usage
|
|
197
|
-
|
|
198
|
-
md2html can also be used programmatically:
|
|
199
|
-
|
|
200
|
-
```javascript
|
|
201
|
-
import { buildHtml, watchMarkdown } from '@udx/md2html';
|
|
202
|
-
|
|
203
|
-
// Build HTML once
|
|
204
|
-
await buildHtml('/path/to/markdown/dir', 'output.html');
|
|
205
|
-
|
|
206
|
-
// Watch for changes
|
|
207
|
-
watchMarkdown('/path/to/markdown/dir', 'output.html');
|
|
208
|
-
```
|
|
209
172
|
|
|
210
173
|
## Best Practices
|
|
211
174
|
|