md-pipe 0.7.4 → 0.7.6
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 +34 -4
- package/cli-contract.yaml +27 -4
- package/dist/md-pipe.bundle.mjs +156 -119
- package/dist/md-pipe.bundle.mjs.map +4 -4
- package/docs/cli-reference.md +51 -4
- package/package.json +15 -9
- package/dist/cli.js +0 -87
package/README.md
CHANGED
|
@@ -11,10 +11,40 @@ 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
|
+
Where Chromium cannot create a sandbox — a container running as root is the
|
|
39
|
+
usual case — the flags it needs come from the environment too:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
export MD_PIPE_CHROMIUM_ARGS=--no-sandbox
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
See [docs/cli-reference.md](docs/cli-reference.md) for how the browser is
|
|
46
|
+
located and what else the environment can say.
|
|
47
|
+
|
|
18
48
|
## Quick Start
|
|
19
49
|
|
|
20
50
|
```bash
|
|
@@ -209,11 +239,11 @@ md-pipe extract render init # Specific commands only
|
|
|
209
239
|
|
|
210
240
|
## Transform Plugins
|
|
211
241
|
|
|
212
|
-
Custom DOM transforms are TypeScript modules
|
|
242
|
+
Custom DOM transforms are TypeScript modules, loaded through tsx. Each exported
|
|
243
|
+
function receives `$` (the Cheerio instance for the document), `el` (the node the
|
|
244
|
+
directive produced), `config` (the resolved configuration), and `helpers`:
|
|
213
245
|
|
|
214
246
|
```typescript
|
|
215
|
-
import type { TransformFn } from "md-pipe";
|
|
216
|
-
|
|
217
247
|
export default {
|
|
218
248
|
feature_cards({ $, el, helpers }) {
|
|
219
249
|
const table = $(el).find("table").first();
|
|
@@ -226,7 +256,7 @@ export default {
|
|
|
226
256
|
).join("");
|
|
227
257
|
$(el).replaceWith(`<section class="feature-cards">${html}</section>`);
|
|
228
258
|
}
|
|
229
|
-
}
|
|
259
|
+
};
|
|
230
260
|
```
|
|
231
261
|
|
|
232
262
|
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.7.
|
|
5
|
+
version: 0.7.6
|
|
6
6
|
description: >
|
|
7
7
|
A rendering engine that transforms Markdown manuscripts into HTML/PDF
|
|
8
8
|
through HTML-comment directives and DOM transformations,
|
|
@@ -36,6 +36,14 @@ command_sets:
|
|
|
36
36
|
Explicitly specify the Chromium executable path.
|
|
37
37
|
When unset, auto-detects from Puppeteer cache and common install locations.
|
|
38
38
|
|
|
39
|
+
MD_PIPE_CHROMIUM_ARGS:
|
|
40
|
+
required: false
|
|
41
|
+
description: >
|
|
42
|
+
Extra command-line flags for the Chromium process the pdf stage starts,
|
|
43
|
+
separated by spaces; a flag containing a space cannot be expressed.
|
|
44
|
+
Set --no-sandbox where Chromium cannot create a sandbox, such as a
|
|
45
|
+
container running as root.
|
|
46
|
+
|
|
39
47
|
global_options:
|
|
40
48
|
- name: config
|
|
41
49
|
aliases: [c]
|
|
@@ -222,7 +230,10 @@ command_sets:
|
|
|
222
230
|
'0':
|
|
223
231
|
description: Rendering succeeded.
|
|
224
232
|
'1':
|
|
225
|
-
description:
|
|
233
|
+
description: >
|
|
234
|
+
Rendering error (Chromium launch failure, PDF generation failure, etc.).
|
|
235
|
+
Every failure md-pipe does not attribute to the invocation lands here,
|
|
236
|
+
including failures reported by its dependencies, whatever their wording.
|
|
226
237
|
stderr:
|
|
227
238
|
format: text
|
|
228
239
|
schema:
|
|
@@ -230,7 +241,9 @@ command_sets:
|
|
|
230
241
|
'2':
|
|
231
242
|
description: >
|
|
232
243
|
Input error (file not found, syntax error, invalid pipeline specification,
|
|
233
|
-
undefined directive in strict mode, etc.).
|
|
244
|
+
missing required option, undefined directive in strict mode, etc.).
|
|
245
|
+
Reserved for faults md-pipe raises against the invocation or the files it
|
|
246
|
+
names, which retrying unchanged cannot clear.
|
|
234
247
|
stderr:
|
|
235
248
|
format: text
|
|
236
249
|
schema:
|
|
@@ -238,7 +251,7 @@ command_sets:
|
|
|
238
251
|
x-agent:
|
|
239
252
|
recommended_before_use:
|
|
240
253
|
- Check that md-pipe.config.yml exists when using themes or custom directives
|
|
241
|
-
- Verify Chromium is available when targeting pdf output
|
|
254
|
+
- Verify the optional puppeteer peer dependency is installed and Chromium is available when targeting pdf output
|
|
242
255
|
rollback:
|
|
243
256
|
supported: false
|
|
244
257
|
notes: Output files can be deleted manually; no side effects beyond file writes.
|
|
@@ -302,6 +315,16 @@ command_sets:
|
|
|
302
315
|
format: text
|
|
303
316
|
schema:
|
|
304
317
|
$ref: '#/components/schemas/ErrorMessage'
|
|
318
|
+
'2':
|
|
319
|
+
description: >
|
|
320
|
+
Input error (unknown option, missing option argument, excess
|
|
321
|
+
argument, etc.).
|
|
322
|
+
Reserved for faults md-pipe raises against the invocation, which
|
|
323
|
+
retrying unchanged cannot clear.
|
|
324
|
+
stderr:
|
|
325
|
+
format: text
|
|
326
|
+
schema:
|
|
327
|
+
$ref: '#/components/schemas/ErrorMessage'
|
|
305
328
|
'3':
|
|
306
329
|
description: Config file already exists (without --force).
|
|
307
330
|
stderr:
|