md-pipe 0.8.2 → 0.8.4

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 CHANGED
@@ -162,6 +162,28 @@ pipeline: .pdf
162
162
  CLI args > frontmatter > project config > tool default
163
163
  ```
164
164
 
165
+ ### Trusted Input
166
+
167
+ md-pipe converts documents you trust. The document (frontmatter and body), the
168
+ project config and every file they name are read and run with your authority,
169
+ the same as a build script in your repository:
170
+
171
+ - frontmatter `output` chooses where the result is written, inside or outside
172
+ the input's directory, when `-o` is not given;
173
+ - `styles`, `scripts` and `template` read any path you can read and embed it in
174
+ the output;
175
+ - project config `transforms` are imported and run as code;
176
+ - `md-pipe.config.yml` is looked up from the current directory up to the root
177
+ when `-c` is not given;
178
+ - relative paths in frontmatter and the project config resolve from the input
179
+ file's directory;
180
+ - the pdf stage loads the page in Chromium with its scripts and the remote
181
+ resources it references.
182
+
183
+ To convert a document someone else wrote, run md-pipe where those reads,
184
+ writes and requests can do no harm, such as a container holding only that
185
+ document, and pass `-o` and `-c` explicitly.
186
+
165
187
  ## Custom HTML Template
166
188
 
167
189
  By default, md-pipe wraps the rendered body in a minimal HTML shell. Use `--template` to provide your own Handlebars template for full control over the HTML structure.
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.8.2
5
+ version: 0.8.4
6
6
  description: >
7
7
  A rendering engine that transforms Markdown manuscripts into HTML/PDF
8
8
  through HTML-comment directives and DOM transformations,
@@ -86,7 +86,15 @@ command_sets:
86
86
  When --pipeline is omitted, the output format is inferred from
87
87
  the -o extension (.html → html, .pdf → pdf), then from
88
88
  frontmatter/config, defaulting to html.
89
- Output is written to a file with -o, or to stdout when omitted.
89
+ Output is written to the file -o names, otherwise to the frontmatter
90
+ or project config output, and to stdout when none of them is set.
91
+ The document, the project config and the files they name are trusted
92
+ input, read and run with the invoking user's authority: frontmatter
93
+ chooses the output path and the styles, scripts and template read from
94
+ any path the user can read; project config transforms run as code; the
95
+ config is looked up from the current directory to the root; the pdf
96
+ stage loads the page in Chromium with its scripts and remote resources.
97
+ Convert only documents and directories you trust.
90
98
  usage:
91
99
  - md-pipe <input> [-o output] [--pipeline [start.]end]
92
100
  - md-pipe report.md -o dist/report.html
@@ -165,11 +173,12 @@ command_sets:
165
173
  type: string
166
174
 
167
175
  - name: paper-size
168
- description: Paper size for the pdf stage. Overrides frontmatter paper.size.
176
+ description: >
177
+ Paper size for the pdf stage. Overrides frontmatter paper.size and
178
+ the project config pdf.paper.size. A4 when none of them names one.
169
179
  schema:
170
180
  type: string
171
181
  enum: [A4, A3, Letter, Legal, Tabloid]
172
- default: A4
173
182
 
174
183
  - name: landscape
175
184
  description: Landscape orientation for the pdf stage.
@@ -203,9 +212,11 @@ command_sets:
203
212
  When enabled, Puppeteer defers to the CSS @page { size: ... }
204
213
  rule for page dimensions, which avoids the 96/72 DPI
205
214
  scaling mismatch between CSS pixels and PDF points.
215
+ When omitted, frontmatter pdf.preferCSSPageSize and then the
216
+ project config pdf.preferCSSPageSize apply; disabled when neither
217
+ sets it.
206
218
  schema:
207
219
  type: boolean
208
- default: false
209
220
  streams:
210
221
  stdin:
211
222
  required: false
@@ -222,10 +233,22 @@ command_sets:
222
233
  risk_level: low
223
234
  writes:
224
235
  - target: output file
225
- description: Writes the rendered result to a file (when -o is specified).
236
+ description: >
237
+ Writes the rendered result to the output path: -o when given,
238
+ otherwise the frontmatter output, otherwise the project config
239
+ output. Writes to stdout when none of them is set. The pdf stage
240
+ also writes a temporary HTML file next to the input (the current
241
+ directory for stdin) and removes it once the PDF is printed.
226
242
  overwrite: true
227
243
  idempotent: true
228
244
  idempotent_note: Produces identical output given the same input and settings.
245
+ network:
246
+ description: >
247
+ The pdf stage loads mermaid from cdn.jsdelivr.net when the document
248
+ contains a mermaid code block, and the browser loads any remote
249
+ resources the document references. The other stages make no
250
+ network requests.
251
+ domains: [cdn.jsdelivr.net]
229
252
  exits:
230
253
  '0':
231
254
  description: Rendering succeeded.
@@ -252,9 +275,10 @@ command_sets:
252
275
  recommended_before_use:
253
276
  - Check that md-pipe.config.yml exists when using themes or custom directives
254
277
  - Verify the optional puppeteer peer dependency is installed and Chromium is available when targeting pdf output
278
+ - Convert only documents and directories you trust; frontmatter chooses the output path and reads files with your authority, and project config transforms run as code
255
279
  rollback:
256
280
  supported: false
257
- notes: Output files can be deleted manually; no side effects beyond file writes.
281
+ notes: Output files can be deleted manually; the side effects are the file writes and the pdf stage's network requests stated in effects.
258
282
  retryable_exit_codes: [1]
259
283
  expected_duration_ms: 5000
260
284
  examples: