md-to-pdf-engine 1.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Juan Ignacio Aldama
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,91 @@
1
+ # md-to-pdf-engine
2
+
3
+ Professional PDF generation from Markdown with customizable templates, syntax highlighting, and cover pages.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install -g md-to-pdf-engine
9
+ ```
10
+
11
+ ## CLI Usage
12
+
13
+ ```bash
14
+ # Basic — generates PDF in the same directory
15
+ md-to-pdf document.md
16
+
17
+ # With template and cover page
18
+ md-to-pdf document.md --template profesional-moderna --cover
19
+
20
+ # Custom output path and page size
21
+ md-to-pdf document.md --output report.pdf --size Letter --orientation landscape
22
+
23
+ # List available templates
24
+ md-to-pdf --list-templates
25
+ ```
26
+
27
+ ### Options
28
+
29
+ | Option | Description | Default |
30
+ |--------|-------------|---------|
31
+ | `--template <id>` | Template to use | `corporativa-clasica` |
32
+ | `--output <path>` | Output PDF path | Same name with `.pdf` |
33
+ | `--size <size>` | `A4` \| `Letter` \| `Legal` | `A4` |
34
+ | `--orientation <o>` | `portrait` \| `landscape` | `portrait` |
35
+ | `--cover` | Include cover page (first H1) | off |
36
+ | `--no-page-numbers` | Disable page numbering | on |
37
+
38
+ ### Templates
39
+
40
+ | ID | Name | Best for |
41
+ |----|------|----------|
42
+ | `corporativa-clasica` | Corporativa Clasica | Formal reports, proposals |
43
+ | `moderna-minimalista` | Moderna Minimalista | Clean presentations |
44
+ | `tecnica-documentacion` | Tecnica/Documentacion | Technical manuals, code docs |
45
+ | `moderna-azul` | Moderna Azul | Modern blue-themed documents |
46
+ | `profesional-moderna` | Profesional Moderna | Contemporary professional style |
47
+
48
+ ## API Usage
49
+
50
+ ```typescript
51
+ import { generatePDFFromMarkdown, getTemplateById } from "md-to-pdf-engine";
52
+ import type { PDFOptions } from "md-to-pdf-engine";
53
+ import { readFileSync, writeFileSync } from "fs";
54
+
55
+ const markdown = readFileSync("document.md", "utf-8");
56
+ const template = getTemplateById("tecnica-documentacion")!;
57
+
58
+ const options: PDFOptions = {
59
+ pageSize: "A4",
60
+ orientation: "portrait",
61
+ margins: template.margins,
62
+ includeCoverPage: true,
63
+ includePageNumbers: true,
64
+ pageNumberFormat: "Page X of Y",
65
+ };
66
+
67
+ const pdfBuffer = await generatePDFFromMarkdown(markdown, template, options);
68
+ writeFileSync("output.pdf", pdfBuffer);
69
+ ```
70
+
71
+ ## Features
72
+
73
+ - 5 built-in templates with customizable colors, fonts, and margins
74
+ - Syntax highlighting for code blocks (highlight.js)
75
+ - Cover page support (first H1 becomes cover)
76
+ - Page numbering with multiple formats
77
+ - Logo support (per-page or first-page only)
78
+ - GFM (GitHub Flavored Markdown) support
79
+ - Tables with styled headers and alternating rows
80
+ - Smart page breaks (avoids cutting content mid-element)
81
+ - A4, Letter, and Legal page sizes
82
+ - Portrait and landscape orientation
83
+
84
+ ## Requirements
85
+
86
+ - Node.js >= 18
87
+ - Puppeteer (included as dependency — downloads Chromium automatically)
88
+
89
+ ## License
90
+
91
+ MIT - Juan Ignacio Aldama
package/dist/cli.d.mts ADDED
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node
package/dist/cli.d.ts ADDED
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node