md-pipe 0.3.0 → 0.4.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 +44 -0
- package/cli-contract.yaml +325 -0
- package/dist/config.js +6 -0
- package/dist/config.js.map +1 -1
- package/dist/generated/commands.js +2 -0
- package/dist/generated/commands.js.map +1 -1
- package/dist/generated/policy.d.ts +10 -0
- package/dist/generated/policy.js +11 -0
- package/dist/generated/policy.js.map +1 -1
- package/dist/generated/program.d.ts +1 -0
- package/dist/generated/program.js +1 -0
- package/dist/generated/program.js.map +1 -1
- package/dist/generated/types.d.ts +1 -0
- package/dist/pipeline/html.js +32 -4
- package/dist/pipeline/html.js.map +1 -1
- package/dist/types.d.ts +5 -0
- package/dist/types.js.map +1 -1
- package/docs/cli-reference.md +402 -0
- package/docs/styling-guide.md +463 -0
- package/package.json +4 -1
package/dist/types.d.ts
CHANGED
|
@@ -9,10 +9,12 @@ export interface ProjectConfig {
|
|
|
9
9
|
output?: string;
|
|
10
10
|
strictDirectives?: boolean;
|
|
11
11
|
pdf?: PdfConfig;
|
|
12
|
+
template?: string;
|
|
12
13
|
styles?: string[];
|
|
13
14
|
scripts?: string[];
|
|
14
15
|
}
|
|
15
16
|
export interface ThemeConfig {
|
|
17
|
+
template?: string;
|
|
16
18
|
styles?: string[];
|
|
17
19
|
scripts?: string[];
|
|
18
20
|
}
|
|
@@ -30,6 +32,7 @@ export interface Frontmatter {
|
|
|
30
32
|
theme?: string;
|
|
31
33
|
pipeline?: string;
|
|
32
34
|
output?: string;
|
|
35
|
+
template?: string;
|
|
33
36
|
styles?: string[];
|
|
34
37
|
scripts?: string[];
|
|
35
38
|
directives?: Record<string, string>;
|
|
@@ -51,6 +54,8 @@ export interface FrontmatterOutput {
|
|
|
51
54
|
}
|
|
52
55
|
export interface ResolvedConfig {
|
|
53
56
|
theme?: string;
|
|
57
|
+
template?: string;
|
|
58
|
+
title?: string;
|
|
54
59
|
styles: string[];
|
|
55
60
|
scripts: string[];
|
|
56
61
|
directives: Record<string, DirectiveDef>;
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AA4GA,MAAM,CAAC,MAAM,WAAW,GAAgB;IACtC,YAAY;IACZ,QAAQ;IACR,WAAW;IACX,MAAM;IACN,KAAK;CACN,CAAC"}
|
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
# md-pipe
|
|
2
|
+
|
|
3
|
+
A rendering engine that transforms Markdown manuscripts into HTML/PDF through HTML-comment directives and DOM transformations, without polluting the Markdown source.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
**Version:** 0.3.0
|
|
7
|
+
|
|
8
|
+
## Table of Contents
|
|
9
|
+
|
|
10
|
+
- [md-pipe](#md-pipe)
|
|
11
|
+
- [render](#md-pipe-render)
|
|
12
|
+
- [init](#md-pipe-init)
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## md-pipe
|
|
17
|
+
|
|
18
|
+
Extended Markdown rendering toolchain.
|
|
19
|
+
|
|
20
|
+
Converts HTML-comment directives into class/id/attribute-bearing HTML nodes, embeds CSS, and produces HTML or PDF output. Pipeline stages: preprocess → render → transform → html → pdf. Use --pipeline to select which stage range to execute. Config precedence: CLI args > frontmatter > project config > tool default.
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Global Options
|
|
24
|
+
|
|
25
|
+
| Option | Aliases | Required | Default | Description |
|
|
26
|
+
|---|---|---|---|---|
|
|
27
|
+
| `--config` | -c | No | | Path to the project config file. Auto-detects md-pipe.config.yml when omitted. |
|
|
28
|
+
| `--verbose` | -v | No | `false` | Enable verbose logging. |
|
|
29
|
+
| `--strict` | | No | `false` | Treat undefined directives as errors. Overrides the config strictDirectives setting. Recommended for CI usage.
|
|
30
|
+
|
|
|
31
|
+
|
|
32
|
+
### Environment Variables
|
|
33
|
+
|
|
34
|
+
| Variable | Description |
|
|
35
|
+
|---|---|
|
|
36
|
+
| `PUPPETEER_EXECUTABLE_PATH` | Explicitly specify the Chromium executable path. When unset, auto-detects from Puppeteer cache and common install locations.
|
|
37
|
+
|
|
|
38
|
+
|
|
39
|
+
### render
|
|
40
|
+
|
|
41
|
+
Render a Markdown file through the pipeline.
|
|
42
|
+
|
|
43
|
+
Execute the rendering pipeline on an input file or stdin. Stages: preprocess → render → transform → html → pdf. Use --pipeline to specify the execution range in [start.]end format; omitting start begins from the .md source. When --pipeline is omitted, the output format is inferred from the -o extension (.html → html, .pdf → pdf), then from frontmatter/config, defaulting to html. Output is written to a file with -o, or to stdout when omitted.
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
**Usage:**
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
md-pipe <input> [-o output] [--pipeline [start.]end]
|
|
50
|
+
```
|
|
51
|
+
```
|
|
52
|
+
md-pipe report.md -o dist/report.html
|
|
53
|
+
```
|
|
54
|
+
```
|
|
55
|
+
md-pipe report.md --pipeline .pdf -o dist/report.pdf
|
|
56
|
+
```
|
|
57
|
+
```
|
|
58
|
+
md-pipe report.rendered.html --pipeline render.html -o report.html
|
|
59
|
+
```
|
|
60
|
+
```
|
|
61
|
+
cat report.md | md-pipe --pipeline .transform | md-pipe --pipeline transform.pdf -o report.pdf
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
#### Arguments
|
|
65
|
+
|
|
66
|
+
| Name | Required | Description |
|
|
67
|
+
|---|---|---|
|
|
68
|
+
| `input` | No | Input Markdown file. Reads from stdin when omitted. |
|
|
69
|
+
|
|
70
|
+
#### Options
|
|
71
|
+
|
|
72
|
+
| Option | Aliases | Required | Default | Description |
|
|
73
|
+
|---|---|---|---|---|
|
|
74
|
+
| `--output` | -o | No | | Output file path. Writes to stdout when omitted. |
|
|
75
|
+
| `--pipeline` | -p | No | | Pipeline range in [start.]end format. Omitting start begins from the .md source. Examples: .html (source→html), .pdf (source→pdf), .render (source→render), render.html, transform.pdf, html.pdf. When omitted, inferred from -o extension (.html → html, .pdf → pdf). When -o is also omitted, follows frontmatter / config (default: html).
|
|
76
|
+
|
|
|
77
|
+
| `--theme` | -t | No | | Theme name. Applies a preset defined in the project config themes section. Overrides frontmatter theme setting.
|
|
78
|
+
|
|
|
79
|
+
| `--template` | | No | | Path to a Handlebars template file for the html stage. The template receives {{{body}}}, {{{styles}}}, {{{scripts}}}, and {{title}} as variables. When omitted, a built-in minimal HTML shell is used.
|
|
80
|
+
|
|
|
81
|
+
| `--styles` | | No | | Additional CSS file paths. Multiple values allowed. Appended after theme assets in load order.
|
|
82
|
+
|
|
|
83
|
+
| `--scripts` | | No | | Additional JavaScript file paths. Multiple values allowed. Appended after theme assets in load order.
|
|
84
|
+
|
|
|
85
|
+
| `--paper-size` | | No | `"A4"` | Paper size for the pdf stage. Overrides frontmatter paper.size. |
|
|
86
|
+
| `--landscape` | | No | `false` | Landscape orientation for the pdf stage. |
|
|
87
|
+
| `--header` | | No | | Page header text for the pdf stage. |
|
|
88
|
+
| `--margin` | | No | | Page margin for the pdf stage. Example: 16mm, 18mm. |
|
|
89
|
+
|
|
90
|
+
#### Streams
|
|
91
|
+
|
|
92
|
+
**stdin:**
|
|
93
|
+
|
|
94
|
+
- Format: `text`
|
|
95
|
+
- Encoding: `utf-8`
|
|
96
|
+
- Required: No
|
|
97
|
+
- Framing: `raw`
|
|
98
|
+
|
|
99
|
+
**stdout:**
|
|
100
|
+
|
|
101
|
+
- Format: `text`
|
|
102
|
+
- Encoding: `utf-8`
|
|
103
|
+
- Framing: `raw`
|
|
104
|
+
|
|
105
|
+
#### Exit Codes
|
|
106
|
+
|
|
107
|
+
**Exit 0:** Rendering succeeded.
|
|
108
|
+
|
|
109
|
+
**Exit 1:** Rendering error (Chromium launch failure, PDF generation failure, etc.).
|
|
110
|
+
|
|
111
|
+
- **stderr:** format=`text`
|
|
112
|
+
|
|
113
|
+
| Property | Type | Required | Description |
|
|
114
|
+
|---|---|---|---|
|
|
115
|
+
| `message` | `string` | Yes | Error message. |
|
|
116
|
+
| `file` | `string` | No | File path where the error occurred. |
|
|
117
|
+
| `line` | `integer` | No | Line number where the error occurred. |
|
|
118
|
+
| `detail` | `string` | No | Detailed error information. |
|
|
119
|
+
|
|
120
|
+
<details>
|
|
121
|
+
<summary>JSON Schema</summary>
|
|
122
|
+
|
|
123
|
+
```json
|
|
124
|
+
{
|
|
125
|
+
"type": "object",
|
|
126
|
+
"required": [
|
|
127
|
+
"message"
|
|
128
|
+
],
|
|
129
|
+
"properties": {
|
|
130
|
+
"message": {
|
|
131
|
+
"type": "string",
|
|
132
|
+
"description": "Error message."
|
|
133
|
+
},
|
|
134
|
+
"file": {
|
|
135
|
+
"type": "string",
|
|
136
|
+
"description": "File path where the error occurred."
|
|
137
|
+
},
|
|
138
|
+
"line": {
|
|
139
|
+
"type": "integer",
|
|
140
|
+
"description": "Line number where the error occurred."
|
|
141
|
+
},
|
|
142
|
+
"detail": {
|
|
143
|
+
"type": "string",
|
|
144
|
+
"description": "Detailed error information."
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
</details>
|
|
151
|
+
|
|
152
|
+
**Exit 2:** Input error (file not found, syntax error, invalid pipeline specification, undefined directive in strict mode, etc.).
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
- **stderr:** format=`text`
|
|
156
|
+
|
|
157
|
+
| Property | Type | Required | Description |
|
|
158
|
+
|---|---|---|---|
|
|
159
|
+
| `message` | `string` | Yes | Error message. |
|
|
160
|
+
| `file` | `string` | No | File path where the error occurred. |
|
|
161
|
+
| `line` | `integer` | No | Line number where the error occurred. |
|
|
162
|
+
| `detail` | `string` | No | Detailed error information. |
|
|
163
|
+
|
|
164
|
+
<details>
|
|
165
|
+
<summary>JSON Schema</summary>
|
|
166
|
+
|
|
167
|
+
```json
|
|
168
|
+
{
|
|
169
|
+
"type": "object",
|
|
170
|
+
"required": [
|
|
171
|
+
"message"
|
|
172
|
+
],
|
|
173
|
+
"properties": {
|
|
174
|
+
"message": {
|
|
175
|
+
"type": "string",
|
|
176
|
+
"description": "Error message."
|
|
177
|
+
},
|
|
178
|
+
"file": {
|
|
179
|
+
"type": "string",
|
|
180
|
+
"description": "File path where the error occurred."
|
|
181
|
+
},
|
|
182
|
+
"line": {
|
|
183
|
+
"type": "integer",
|
|
184
|
+
"description": "Line number where the error occurred."
|
|
185
|
+
},
|
|
186
|
+
"detail": {
|
|
187
|
+
"type": "string",
|
|
188
|
+
"description": "Detailed error information."
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
</details>
|
|
195
|
+
|
|
196
|
+
#### Extensions
|
|
197
|
+
|
|
198
|
+
```yaml
|
|
199
|
+
x-agent:
|
|
200
|
+
recommended_before_use:
|
|
201
|
+
- Check that md-pipe.config.yml exists when using themes or custom directives
|
|
202
|
+
- Verify Chromium is available when targeting pdf output
|
|
203
|
+
rollback:
|
|
204
|
+
supported: false
|
|
205
|
+
notes: Output files can be deleted manually; no side effects beyond file writes.
|
|
206
|
+
retryable_exit_codes:
|
|
207
|
+
- 1
|
|
208
|
+
expected_duration_ms: 5000
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
### init
|
|
214
|
+
|
|
215
|
+
Initialize a md-pipe project.
|
|
216
|
+
|
|
217
|
+
Creates a md-pipe.config.yml template in the current directory.
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
**Usage:**
|
|
221
|
+
|
|
222
|
+
```
|
|
223
|
+
md-pipe init
|
|
224
|
+
```
|
|
225
|
+
```
|
|
226
|
+
md-pipe init --theme business-report
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
#### Options
|
|
230
|
+
|
|
231
|
+
| Option | Aliases | Required | Default | Description |
|
|
232
|
+
|---|---|---|---|---|
|
|
233
|
+
| `--theme` | -t | No | `"default"` | Initial theme name to scaffold. |
|
|
234
|
+
| `--force` | -f | No | `false` | Overwrite existing config file. |
|
|
235
|
+
|
|
236
|
+
#### Exit Codes
|
|
237
|
+
|
|
238
|
+
**Exit 0:** Initialization succeeded.
|
|
239
|
+
|
|
240
|
+
- **stdout:** format=`text`
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
<details>
|
|
244
|
+
<summary>JSON Schema</summary>
|
|
245
|
+
|
|
246
|
+
```json
|
|
247
|
+
{
|
|
248
|
+
"type": "string",
|
|
249
|
+
"description": "List of generated files."
|
|
250
|
+
}
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
</details>
|
|
254
|
+
|
|
255
|
+
**Exit 1:** Initialization error (file write failure, etc.).
|
|
256
|
+
|
|
257
|
+
- **stderr:** format=`text`
|
|
258
|
+
|
|
259
|
+
| Property | Type | Required | Description |
|
|
260
|
+
|---|---|---|---|
|
|
261
|
+
| `message` | `string` | Yes | Error message. |
|
|
262
|
+
| `file` | `string` | No | File path where the error occurred. |
|
|
263
|
+
| `line` | `integer` | No | Line number where the error occurred. |
|
|
264
|
+
| `detail` | `string` | No | Detailed error information. |
|
|
265
|
+
|
|
266
|
+
<details>
|
|
267
|
+
<summary>JSON Schema</summary>
|
|
268
|
+
|
|
269
|
+
```json
|
|
270
|
+
{
|
|
271
|
+
"type": "object",
|
|
272
|
+
"required": [
|
|
273
|
+
"message"
|
|
274
|
+
],
|
|
275
|
+
"properties": {
|
|
276
|
+
"message": {
|
|
277
|
+
"type": "string",
|
|
278
|
+
"description": "Error message."
|
|
279
|
+
},
|
|
280
|
+
"file": {
|
|
281
|
+
"type": "string",
|
|
282
|
+
"description": "File path where the error occurred."
|
|
283
|
+
},
|
|
284
|
+
"line": {
|
|
285
|
+
"type": "integer",
|
|
286
|
+
"description": "Line number where the error occurred."
|
|
287
|
+
},
|
|
288
|
+
"detail": {
|
|
289
|
+
"type": "string",
|
|
290
|
+
"description": "Detailed error information."
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
</details>
|
|
297
|
+
|
|
298
|
+
**Exit 3:** Config file already exists (without --force).
|
|
299
|
+
|
|
300
|
+
- **stderr:** format=`text`
|
|
301
|
+
|
|
302
|
+
| Property | Type | Required | Description |
|
|
303
|
+
|---|---|---|---|
|
|
304
|
+
| `message` | `string` | Yes | Error message. |
|
|
305
|
+
| `file` | `string` | No | File path where the error occurred. |
|
|
306
|
+
| `line` | `integer` | No | Line number where the error occurred. |
|
|
307
|
+
| `detail` | `string` | No | Detailed error information. |
|
|
308
|
+
|
|
309
|
+
<details>
|
|
310
|
+
<summary>JSON Schema</summary>
|
|
311
|
+
|
|
312
|
+
```json
|
|
313
|
+
{
|
|
314
|
+
"type": "object",
|
|
315
|
+
"required": [
|
|
316
|
+
"message"
|
|
317
|
+
],
|
|
318
|
+
"properties": {
|
|
319
|
+
"message": {
|
|
320
|
+
"type": "string",
|
|
321
|
+
"description": "Error message."
|
|
322
|
+
},
|
|
323
|
+
"file": {
|
|
324
|
+
"type": "string",
|
|
325
|
+
"description": "File path where the error occurred."
|
|
326
|
+
},
|
|
327
|
+
"line": {
|
|
328
|
+
"type": "integer",
|
|
329
|
+
"description": "Line number where the error occurred."
|
|
330
|
+
},
|
|
331
|
+
"detail": {
|
|
332
|
+
"type": "string",
|
|
333
|
+
"description": "Detailed error information."
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
</details>
|
|
340
|
+
|
|
341
|
+
#### Extensions
|
|
342
|
+
|
|
343
|
+
```yaml
|
|
344
|
+
x-agent:
|
|
345
|
+
recommended_before_use:
|
|
346
|
+
- Check whether md-pipe.config.yml already exists
|
|
347
|
+
human_review:
|
|
348
|
+
required: false
|
|
349
|
+
reason: Safe scaffolding operation; --force requires attention.
|
|
350
|
+
rollback:
|
|
351
|
+
supported: true
|
|
352
|
+
notes: Delete the generated md-pipe.config.yml.
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
---
|
|
356
|
+
|
|
357
|
+
---
|
|
358
|
+
|
|
359
|
+
## Schemas
|
|
360
|
+
|
|
361
|
+
### ErrorMessage
|
|
362
|
+
|
|
363
|
+
Type: `object`
|
|
364
|
+
|
|
365
|
+
| Property | Type | Required | Description |
|
|
366
|
+
|---|---|---|---|
|
|
367
|
+
| `message` | `string` | Yes | Error message. |
|
|
368
|
+
| `file` | `string` | No | File path where the error occurred. |
|
|
369
|
+
| `line` | `integer` | No | Line number where the error occurred. |
|
|
370
|
+
| `detail` | `string` | No | Detailed error information. |
|
|
371
|
+
|
|
372
|
+
<details>
|
|
373
|
+
<summary>JSON Schema</summary>
|
|
374
|
+
|
|
375
|
+
```json
|
|
376
|
+
{
|
|
377
|
+
"type": "object",
|
|
378
|
+
"required": [
|
|
379
|
+
"message"
|
|
380
|
+
],
|
|
381
|
+
"properties": {
|
|
382
|
+
"message": {
|
|
383
|
+
"type": "string",
|
|
384
|
+
"description": "Error message."
|
|
385
|
+
},
|
|
386
|
+
"file": {
|
|
387
|
+
"type": "string",
|
|
388
|
+
"description": "File path where the error occurred."
|
|
389
|
+
},
|
|
390
|
+
"line": {
|
|
391
|
+
"type": "integer",
|
|
392
|
+
"description": "Line number where the error occurred."
|
|
393
|
+
},
|
|
394
|
+
"detail": {
|
|
395
|
+
"type": "string",
|
|
396
|
+
"description": "Detailed error information."
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
</details>
|