md-pipe 0.7.3 → 0.7.5
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 +26 -4
- package/cli-contract.yaml +19 -4
- package/dist/md-pipe.bundle.mjs +146 -121
- package/dist/md-pipe.bundle.mjs.map +4 -4
- package/docs/cli-reference.md +57 -12
- package/package.json +16 -11
- package/dist/cli.js +0 -87
package/README.md
CHANGED
|
@@ -11,10 +11,32 @@ A rendering engine that transforms Markdown manuscripts into HTML/PDF through HT
|
|
|
11
11
|
|
|
12
12
|
## Install
|
|
13
13
|
|
|
14
|
+
Requires Node.js 22.12.0 or newer.
|
|
15
|
+
|
|
14
16
|
```bash
|
|
15
17
|
npm install -g md-pipe
|
|
16
18
|
```
|
|
17
19
|
|
|
20
|
+
### PDF Output
|
|
21
|
+
|
|
22
|
+
PDF rendering is driven by Puppeteer, which is an optional peer dependency: HTML
|
|
23
|
+
output needs nothing extra, and installing md-pipe never downloads a browser.
|
|
24
|
+
Install Puppeteer alongside md-pipe to enable the `pdf` stage:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm install -g puppeteer
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
That download can be skipped when a Chromium is already on the machine. Install
|
|
31
|
+
Puppeteer without its bundled browser and point md-pipe at the existing one:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
PUPPETEER_SKIP_DOWNLOAD=1 npm install -g puppeteer
|
|
35
|
+
export PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
See [docs/cli-reference.md](docs/cli-reference.md) for how the browser is located.
|
|
39
|
+
|
|
18
40
|
## Quick Start
|
|
19
41
|
|
|
20
42
|
```bash
|
|
@@ -209,11 +231,11 @@ md-pipe extract render init # Specific commands only
|
|
|
209
231
|
|
|
210
232
|
## Transform Plugins
|
|
211
233
|
|
|
212
|
-
Custom DOM transforms are TypeScript modules
|
|
234
|
+
Custom DOM transforms are TypeScript modules, loaded through tsx. Each exported
|
|
235
|
+
function receives `$` (the Cheerio instance for the document), `el` (the node the
|
|
236
|
+
directive produced), `config` (the resolved configuration), and `helpers`:
|
|
213
237
|
|
|
214
238
|
```typescript
|
|
215
|
-
import type { TransformFn } from "md-pipe";
|
|
216
|
-
|
|
217
239
|
export default {
|
|
218
240
|
feature_cards({ $, el, helpers }) {
|
|
219
241
|
const table = $(el).find("table").first();
|
|
@@ -226,7 +248,7 @@ export default {
|
|
|
226
248
|
).join("");
|
|
227
249
|
$(el).replaceWith(`<section class="feature-cards">${html}</section>`);
|
|
228
250
|
}
|
|
229
|
-
}
|
|
251
|
+
};
|
|
230
252
|
```
|
|
231
253
|
|
|
232
254
|
Register in config:
|
package/cli-contract.yaml
CHANGED
|
@@ -2,7 +2,7 @@ cli_contracts: 0.1.0
|
|
|
2
2
|
|
|
3
3
|
info:
|
|
4
4
|
title: md-pipe
|
|
5
|
-
version: 0.
|
|
5
|
+
version: 0.7.5
|
|
6
6
|
description: >
|
|
7
7
|
A rendering engine that transforms Markdown manuscripts into HTML/PDF
|
|
8
8
|
through HTML-comment directives and DOM transformations,
|
|
@@ -222,7 +222,10 @@ command_sets:
|
|
|
222
222
|
'0':
|
|
223
223
|
description: Rendering succeeded.
|
|
224
224
|
'1':
|
|
225
|
-
description:
|
|
225
|
+
description: >
|
|
226
|
+
Rendering error (Chromium launch failure, PDF generation failure, etc.).
|
|
227
|
+
Every failure md-pipe does not attribute to the invocation lands here,
|
|
228
|
+
including failures reported by its dependencies, whatever their wording.
|
|
226
229
|
stderr:
|
|
227
230
|
format: text
|
|
228
231
|
schema:
|
|
@@ -230,7 +233,9 @@ command_sets:
|
|
|
230
233
|
'2':
|
|
231
234
|
description: >
|
|
232
235
|
Input error (file not found, syntax error, invalid pipeline specification,
|
|
233
|
-
undefined directive in strict mode, etc.).
|
|
236
|
+
missing required option, undefined directive in strict mode, etc.).
|
|
237
|
+
Reserved for faults md-pipe raises against the invocation or the files it
|
|
238
|
+
names, which retrying unchanged cannot clear.
|
|
234
239
|
stderr:
|
|
235
240
|
format: text
|
|
236
241
|
schema:
|
|
@@ -238,7 +243,7 @@ command_sets:
|
|
|
238
243
|
x-agent:
|
|
239
244
|
recommended_before_use:
|
|
240
245
|
- Check that md-pipe.config.yml exists when using themes or custom directives
|
|
241
|
-
- Verify Chromium is available when targeting pdf output
|
|
246
|
+
- Verify the optional puppeteer peer dependency is installed and Chromium is available when targeting pdf output
|
|
242
247
|
rollback:
|
|
243
248
|
supported: false
|
|
244
249
|
notes: Output files can be deleted manually; no side effects beyond file writes.
|
|
@@ -302,6 +307,16 @@ command_sets:
|
|
|
302
307
|
format: text
|
|
303
308
|
schema:
|
|
304
309
|
$ref: '#/components/schemas/ErrorMessage'
|
|
310
|
+
'2':
|
|
311
|
+
description: >
|
|
312
|
+
Input error (unknown option, missing option argument, excess
|
|
313
|
+
argument, etc.).
|
|
314
|
+
Reserved for faults md-pipe raises against the invocation, which
|
|
315
|
+
retrying unchanged cannot clear.
|
|
316
|
+
stderr:
|
|
317
|
+
format: text
|
|
318
|
+
schema:
|
|
319
|
+
$ref: '#/components/schemas/ErrorMessage'
|
|
305
320
|
'3':
|
|
306
321
|
description: Config file already exists (without --force).
|
|
307
322
|
stderr:
|