mduck 1.0.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/README.md +176 -0
- package/bin/mduck.js +260455 -0
- package/package.json +43 -0
- package/src/template.html +28 -0
package/README.md
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
# CLI Markdown to PDF and HTML - mduck
|
|
2
|
+
|
|
3
|
+
Convert Markdown files to styled HTML and PDF.
|
|
4
|
+
|
|
5
|
+
## Open source notice
|
|
6
|
+
|
|
7
|
+
This project is part of the [Open Collective](https://opencollective.com/simplyhexagonal) project [Simply Hexagonal](https://simplyhexagonal.org)
|
|
8
|
+
and is open to updates by its users, we ensure that PRs are relevant to the community.
|
|
9
|
+
In other words, if you find a bug or want a new feature, please help us by becoming one of the
|
|
10
|
+
[contributors](#contributors-) โ๏ธ ! See the [contributing section](#contributing).
|
|
11
|
+
|
|
12
|
+
## Like this module? โค
|
|
13
|
+
|
|
14
|
+
Please consider:
|
|
15
|
+
|
|
16
|
+
- [Buying me a coffee](https://www.buymeacoffee.com/jeanlescure) โ
|
|
17
|
+
- Supporting me on [Patreon](https://www.patreon.com/jeanlescure) ๐
|
|
18
|
+
- Starring this repo on [Github](https://github.com/simplyhexagonal/mduck) ๐
|
|
19
|
+
|
|
20
|
+
## AI and Compliance Notice
|
|
21
|
+
|
|
22
|
+
The [โฉ๏ธ OpenKai](https://openkai.org/) quality framework for AI-assisted production was used in the creation of this project, making it ISO 42001 compliant by ensuring human oversight and governance.
|
|
23
|
+
|
|
24
|
+
30% Human ยท 70% AI ยท 100% epic
|
|
25
|
+
|
|
26
|
+
## Run Without Installing
|
|
27
|
+
|
|
28
|
+
### `bunx`
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
bunx mduck convert ./notes.md
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
bunx mduck convert ./notes.md ./dist/
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
bunx mduck convert ./notes.md ./dist/notes.html --template ./my-template.html
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### `npx`
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npx mduck convert ./notes.md
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
npx mduck convert ./notes.md ./dist/
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npx mduck convert ./notes.md ./dist/notes.html --template ./my-template.html
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Install Globally
|
|
57
|
+
|
|
58
|
+
### With Bun
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
bun add -g mduck
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### With npm
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
npm install -g mduck
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Then run:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
mduck --help
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Commands
|
|
77
|
+
|
|
78
|
+
### `convert`
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
mduck convert <input-file> [output-file] [--template <template-path>]
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
- `<input-file>` is required.
|
|
85
|
+
- `[output-file]` is optional.
|
|
86
|
+
- If output is omitted, output HTML uses input path with `.html` extension.
|
|
87
|
+
- If output is an existing directory, output file uses input basename + `.html`.
|
|
88
|
+
- PDF is always generated next to the resolved HTML output, with `.pdf` extension.
|
|
89
|
+
- `--template` (or `-t`) accepts absolute or relative path to an HTML template file.
|
|
90
|
+
|
|
91
|
+
Examples:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
mduck convert ./docs/readme.md
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
mduck convert ./docs/readme.md ./output/
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
mduck convert ./docs/readme.md ./output/custom.html
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
mduck convert ./docs/readme.md ./output/ --template ./custom.template.html
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### `eject-template`
|
|
110
|
+
|
|
111
|
+
Write the built-in default template to disk so you can customize it.
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
mduck eject-template [output-template-html-path]
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
- No path: writes `./mduck.template.html`
|
|
118
|
+
- File path: writes exactly there
|
|
119
|
+
- Directory path: writes `mduck.template.html` in that directory
|
|
120
|
+
|
|
121
|
+
Examples:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
mduck eject-template
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
mduck eject-template ./templates/
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
mduck eject-template ./templates/my-template.html
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Troubleshooting
|
|
136
|
+
|
|
137
|
+
### Puppeteer error: browser not found
|
|
138
|
+
|
|
139
|
+
If you see an error saying Chromium/Chrome cannot be found, install Puppeteer's browser binary:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
npx puppeteer browsers install chrome
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
If you use Bun:
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
bunx puppeteer browsers install chrome
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Contributing
|
|
152
|
+
|
|
153
|
+
Yes, thank you! This plugin is community-driven, most of its features are from different authors.
|
|
154
|
+
Please update the docs and tests and add your name to the `package.json` file.
|
|
155
|
+
|
|
156
|
+
## Contributors โจ
|
|
157
|
+
|
|
158
|
+
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
|
|
159
|
+
|
|
160
|
+
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
|
161
|
+
<!-- prettier-ignore-start -->
|
|
162
|
+
<!-- markdownlint-disable -->
|
|
163
|
+
<table>
|
|
164
|
+
<tr>
|
|
165
|
+
<td align="center"><a href="https://jeanlescure.cr"><img src="https://avatars.githubusercontent.com/u/3330339?v=4" width="100px;" alt="Jean M. Lescure"/><br /><sub><b>Jean M. Lescure</b></sub></a><br /><a href="#maintenance-jeanlescure" title="Maintenance">๐ง</a> <a href="https://github.com/simplyhexagonal/mduck/commits?author=jeanlescure" title="Code">๐ป</a> <a href="https://github.com/simplyhexagonal/mduck/commits?author=jeanlescure" title="Documentation">๐</a> <a href="https://github.com/simplyhexagonal/mduck/commits?author=jeanlescure" title="Tests">โ ๏ธ</a></td>
|
|
166
|
+
</tr>
|
|
167
|
+
</table>
|
|
168
|
+
|
|
169
|
+
<!-- markdownlint-enable -->
|
|
170
|
+
<!-- prettier-ignore-end -->
|
|
171
|
+
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
|
172
|
+
|
|
173
|
+
## License
|
|
174
|
+
|
|
175
|
+
Copyright (c) 2026 [mduck Contributors](https://github.com/simplyhexagonal/mduck/#contributors-).<br/>
|
|
176
|
+
Licensed under the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0).
|