md-pipe 0.5.3 → 0.5.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.
Files changed (54) hide show
  1. package/cli-contract.yaml +10 -0
  2. package/dist/cli.d.ts +2 -0
  3. package/dist/cli.js +85 -0
  4. package/dist/cli.js.map +1 -0
  5. package/dist/commands/init.d.ts +6 -0
  6. package/dist/commands/init.js +28 -0
  7. package/dist/commands/init.js.map +1 -0
  8. package/dist/config.d.ts +19 -0
  9. package/dist/config.js +176 -0
  10. package/dist/config.js.map +1 -0
  11. package/dist/generated/commands.d.ts +7 -0
  12. package/dist/generated/commands.js +67 -0
  13. package/dist/generated/commands.js.map +1 -0
  14. package/dist/generated/index.d.ts +6 -0
  15. package/dist/generated/index.js +7 -0
  16. package/dist/generated/index.js.map +1 -0
  17. package/dist/generated/policy-runtime.d.ts +113 -0
  18. package/dist/generated/policy-runtime.js +195 -0
  19. package/dist/generated/policy-runtime.js.map +1 -0
  20. package/dist/generated/policy.d.ts +116 -0
  21. package/dist/generated/policy.js +165 -0
  22. package/dist/generated/policy.js.map +1 -0
  23. package/dist/generated/program.d.ts +21 -0
  24. package/dist/generated/program.js +54 -0
  25. package/dist/generated/program.js.map +1 -0
  26. package/dist/generated/schemas.d.ts +26 -0
  27. package/dist/generated/schemas.js +30 -0
  28. package/dist/generated/schemas.js.map +1 -0
  29. package/dist/generated/types.d.ts +67 -0
  30. package/dist/generated/types.js +3 -0
  31. package/dist/generated/types.js.map +1 -0
  32. package/dist/pipeline/html.d.ts +2 -0
  33. package/dist/pipeline/html.js +86 -0
  34. package/dist/pipeline/html.js.map +1 -0
  35. package/dist/pipeline/index.d.ts +2 -0
  36. package/dist/pipeline/index.js +48 -0
  37. package/dist/pipeline/index.js.map +1 -0
  38. package/dist/pipeline/pdf.d.ts +2 -0
  39. package/dist/pipeline/pdf.js +80 -0
  40. package/dist/pipeline/pdf.js.map +1 -0
  41. package/dist/pipeline/preprocess.d.ts +2 -0
  42. package/dist/pipeline/preprocess.js +134 -0
  43. package/dist/pipeline/preprocess.js.map +1 -0
  44. package/dist/pipeline/render.d.ts +1 -0
  45. package/dist/pipeline/render.js +5 -0
  46. package/dist/pipeline/render.js.map +1 -0
  47. package/dist/pipeline/transform.d.ts +2 -0
  48. package/dist/pipeline/transform.js +75 -0
  49. package/dist/pipeline/transform.js.map +1 -0
  50. package/dist/types.d.ts +104 -0
  51. package/dist/types.js +8 -0
  52. package/dist/types.js.map +1 -0
  53. package/docs/cli-reference.md +2 -0
  54. package/package.json +1 -1
@@ -0,0 +1,104 @@
1
+ import type { CheerioAPI, Cheerio } from "cheerio";
2
+ import type { AnyNode } from "domhandler";
3
+ export interface ProjectConfig {
4
+ theme?: string;
5
+ themes?: Record<string, ThemeConfig>;
6
+ directives?: Record<string, string>;
7
+ transforms?: string[];
8
+ pipeline?: string;
9
+ output?: string;
10
+ strictDirectives?: boolean;
11
+ pdf?: PdfConfig;
12
+ template?: string;
13
+ styles?: string[];
14
+ scripts?: string[];
15
+ }
16
+ export interface ThemeConfig {
17
+ template?: string;
18
+ styles?: string[];
19
+ scripts?: string[];
20
+ }
21
+ export interface PdfConfig {
22
+ paper?: {
23
+ size?: string;
24
+ margin?: string | Record<string, string>;
25
+ printBackground?: boolean;
26
+ };
27
+ displayHeaderFooter?: boolean;
28
+ scale?: number;
29
+ }
30
+ export interface Frontmatter {
31
+ title?: string;
32
+ theme?: string;
33
+ pipeline?: string;
34
+ output?: string;
35
+ template?: string;
36
+ styles?: string[];
37
+ scripts?: string[];
38
+ directives?: Record<string, string>;
39
+ outputs?: FrontmatterOutput[];
40
+ header?: string;
41
+ landscape?: boolean;
42
+ viewport?: string;
43
+ pdf?: PdfConfig;
44
+ css?: string;
45
+ paper?: {
46
+ size?: string;
47
+ margin?: string | Record<string, string>;
48
+ orientation?: string;
49
+ };
50
+ }
51
+ export interface FrontmatterOutput {
52
+ pipeline: string;
53
+ output: string;
54
+ pdf?: PdfConfig;
55
+ }
56
+ export interface ResolvedConfig {
57
+ theme?: string;
58
+ template?: string;
59
+ title?: string;
60
+ styles: string[];
61
+ scripts: string[];
62
+ directives: Record<string, DirectiveDef>;
63
+ transforms: Map<string, TransformFn>;
64
+ pipeline: {
65
+ start: string;
66
+ end: string;
67
+ };
68
+ output?: string;
69
+ strict: boolean;
70
+ verbose: boolean;
71
+ pdf: {
72
+ paperSize: string;
73
+ landscape: boolean;
74
+ header?: string;
75
+ margin?: string;
76
+ scale?: number;
77
+ viewport?: {
78
+ width: number;
79
+ height: number;
80
+ };
81
+ };
82
+ inputDir?: string;
83
+ }
84
+ export interface DirectiveDef {
85
+ element: string;
86
+ classes: string[];
87
+ id?: string;
88
+ attrs: Record<string, string>;
89
+ transformNames: string[];
90
+ }
91
+ export type TransformFn = (context: TransformContext) => void | Promise<void>;
92
+ export interface TransformContext {
93
+ $: CheerioAPI;
94
+ el: AnyNode;
95
+ config: ResolvedConfig;
96
+ helpers: TransformHelpers;
97
+ }
98
+ export interface TransformHelpers {
99
+ tableToObjects: (table: Cheerio<AnyNode>) => Record<string, string>[];
100
+ escapeHtml: (value: string) => string;
101
+ }
102
+ export type TransformModule = Record<string, TransformFn>;
103
+ export type StageName = "preprocess" | "render" | "transform" | "html" | "pdf";
104
+ export declare const STAGE_ORDER: StageName[];
package/dist/types.js ADDED
@@ -0,0 +1,8 @@
1
+ export const STAGE_ORDER = [
2
+ "preprocess",
3
+ "render",
4
+ "transform",
5
+ "html",
6
+ "pdf",
7
+ ];
8
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AA8GA,MAAM,CAAC,MAAM,WAAW,GAAgB;IACtC,YAAY;IACZ,QAAQ;IACR,WAAW;IACX,MAAM;IACN,KAAK;CACN,CAAC"}
@@ -85,6 +85,8 @@ cat report.md | md-pipe --pipeline .transform | md-pipe --pipeline transform.pdf
85
85
  | `--paper-size` | | No | `"A4"` | Paper size for the pdf stage. Overrides frontmatter paper.size. |
86
86
  | `--landscape` | | No | `false` | Landscape orientation for the pdf stage. |
87
87
  | `--header` | | No | | Page header text for the pdf stage. |
88
+ | `--viewport` | | No | | Viewport size for the pdf stage in WIDTHxHEIGHT format (e.g. 1024x768). Controls Puppeteer's page.setViewport() and the viewport meta tag in the default HTML template. When omitted, the default HTML template uses width=device-width, initial-scale=1 and Puppeteer uses its default (800x600).
89
+ |
88
90
  | `--margin` | | No | | Page margin for the pdf stage. Example: 16mm, 18mm. |
89
91
 
90
92
  #### Streams
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "md-pipe",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
4
4
  "description": "A rendering engine that transforms Markdown to HTML/PDF via directive-driven pipelines",
5
5
  "type": "module",
6
6
  "main": "dist/cli.js",