@masumdev/markforge 0.2.3 → 0.2.5
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 +204 -213
- package/dist/{App-DKCNXX3Z.mjs → App-GNRUPFM7.mjs} +900 -324
- package/dist/chunk-IYGPJIK5.mjs +165 -0
- package/dist/cli.mjs +9 -6
- package/dist/index.d.mts +310 -63
- package/dist/index.d.ts +310 -63
- package/dist/index.js +1146 -435
- package/dist/index.mjs +1134 -436
- package/dist/{loadConfig-T4ZV6YY2.mjs → loadConfig-PD6ENMAM.mjs} +1 -1
- package/package.json +1 -1
- package/schema.json +221 -28
- package/dist/chunk-ASXSHC6H.mjs +0 -120
package/README.md
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
# @masumdev/markforge
|
|
4
4
|
|
|
5
|
-
**
|
|
6
|
-
Convert Markdown into pixel-perfect **DOCX**, **PDF**, and **HTML** with syntax highlighting, Mermaid diagrams, callout boxes, and
|
|
5
|
+
**Enterprise Markdown & MDX Multi-Format Publishing Engine & CLI.**
|
|
6
|
+
Convert Markdown into pixel-perfect **DOCX**, **PDF**, and **HTML** with native typography, syntax highlighting, Mermaid diagrams, callout boxes, customizable `ThemeProps`, and an interactive Ink terminal UI.
|
|
7
7
|
|
|
8
8
|
[](https://www.npmjs.com/package/@masumdev/markforge)
|
|
9
9
|
[](https://opensource.org/licenses/MIT)
|
|
@@ -18,291 +18,282 @@ Convert Markdown into pixel-perfect **DOCX**, **PDF**, and **HTML** with syntax
|
|
|
18
18
|
|
|
19
19
|
| Feature | Description |
|
|
20
20
|
| :--- | :--- |
|
|
21
|
-
| 📄 **Multi-Format Output** | Generate `.docx`, `.pdf`, and `.html` from a single Markdown source |
|
|
22
|
-
| 🎨 **
|
|
23
|
-
|
|
|
24
|
-
|
|
|
25
|
-
|
|
|
26
|
-
|
|
|
27
|
-
|
|
|
28
|
-
|
|
|
29
|
-
| 💧 **Watermark
|
|
30
|
-
| ⚙️ **Type-Safe Config** | `markforge.config.ts
|
|
31
|
-
| 🚀 **Programmatic API** |
|
|
32
|
-
| 🖥️ **Ink Terminal UI** |
|
|
21
|
+
| 📄 **Multi-Format Output** | Generate `.docx`, `.pdf`, and `.html` from a single Markdown source simultaneously |
|
|
22
|
+
| 🎨 **Theme.CORPORATE & ThemeProps** | Flagship cyan corporate design system + full custom colors & fonts via `ThemeProps` |
|
|
23
|
+
| 📐 **Per-Zone Header & Footer** | Granular color, font size, font family, bold & italic controls per `left`, `center`, `right` slot |
|
|
24
|
+
| 📊 **Mermaid Diagrams** | Full Mermaid.js diagram engine — flowcharts, sequence, state, class, gantt |
|
|
25
|
+
| 📢 **Callout / Alert Boxes** | GitHub-style `> [!NOTE]`, `> [!TIP]`, `> [!IMPORTANT]`, `> [!WARNING]`, `> [!CAUTION]` |
|
|
26
|
+
| 🌈 **Syntax Highlighting** | Tokenized multi-language code blocks (`dracula`, `github-dark`, `monokai`, `nord`, etc.) |
|
|
27
|
+
| 🖼️ **Image Inlining Engine** | Resolves local files, remote URLs, Base64 data URIs, and SVGs into embedded assets |
|
|
28
|
+
| 📑 **Auto Table of Contents** | Anchored TOC generated from heading structure (`#` to `####`) |
|
|
29
|
+
| 💧 **Non-Intrusive Watermark** | Background-layer watermark with custom text, color, opacity, rotation, and position |
|
|
30
|
+
| ⚙️ **Type-Safe Config** | `markforge.config.ts` with Enums, `.markforgerc.json`, or YAML with JSON Schema |
|
|
31
|
+
| 🚀 **Programmatic API** | High-level `compileMarkdown()` and low-level AST document builders for Node.js & Bun |
|
|
32
|
+
| 🖥️ **Ink Terminal UI** | Interactive TUI with live spinners, progress tracking, and compilation metrics |
|
|
33
33
|
|
|
34
34
|
---
|
|
35
35
|
|
|
36
36
|
## 📦 Installation
|
|
37
37
|
|
|
38
38
|
```bash
|
|
39
|
-
# Global CLI
|
|
39
|
+
# Global CLI Installation
|
|
40
40
|
npm install -g @masumdev/markforge
|
|
41
|
+
# or with bun:
|
|
41
42
|
bun add -g @masumdev/markforge
|
|
42
43
|
|
|
43
|
-
#
|
|
44
|
+
# Project Local Dependency
|
|
44
45
|
npm install -D @masumdev/markforge
|
|
46
|
+
# or with bun:
|
|
45
47
|
bun add -d @masumdev/markforge
|
|
46
48
|
```
|
|
47
49
|
|
|
48
50
|
---
|
|
49
51
|
|
|
50
|
-
##
|
|
52
|
+
## 💻 CLI Usage
|
|
51
53
|
|
|
52
54
|
```bash
|
|
53
|
-
#
|
|
55
|
+
# Basic conversion to DOCX and PDF (defaults)
|
|
54
56
|
markforge document.md
|
|
55
57
|
|
|
56
|
-
# Specify output
|
|
58
|
+
# Specify target formats and output folder
|
|
57
59
|
markforge document.md --to docx,pdf,html -o ./dist
|
|
58
60
|
|
|
59
|
-
# Use
|
|
60
|
-
markforge
|
|
61
|
+
# Use custom CSS styling and force Table of Contents
|
|
62
|
+
markforge specification.md --css ./styles/custom.css --toc
|
|
61
63
|
|
|
62
|
-
#
|
|
63
|
-
markforge
|
|
64
|
+
# Watch mode for live re-compilation
|
|
65
|
+
markforge report.md --watch
|
|
64
66
|
|
|
65
|
-
#
|
|
66
|
-
markforge document.md --
|
|
67
|
+
# Launch local preview server and open in browser
|
|
68
|
+
markforge document.md --serve --port 4000 --open
|
|
67
69
|
```
|
|
68
70
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
## 🖊️ Markdown Source Features
|
|
72
|
-
|
|
73
|
-
### Callout / Alert Boxes
|
|
71
|
+
### CLI Flags Reference
|
|
74
72
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
73
|
+
| Flag | Alias | Description | Default |
|
|
74
|
+
| :--- | :---: | :--- | :--- |
|
|
75
|
+
| `<file>` | | Markdown input file path | **Required** |
|
|
76
|
+
| `--to <formats...>` | `-t` | Output formats: `docx`, `pdf`, `html`, `png` | `docx,pdf` |
|
|
77
|
+
| `--output <dir>` | `-o` | Output directory | Same as input file |
|
|
78
|
+
| `--config <file>` | `-c` | Explicit configuration file path | Auto-discovered |
|
|
79
|
+
| `--theme <name>` | | Visual theme preset (`corporate`, `default`) | `corporate` |
|
|
80
|
+
| `--css <files...>` | | Custom CSS stylesheets to inject | `undefined` |
|
|
81
|
+
| `--orientation <type>` | | Page orientation (`portrait`, `landscape`) | `portrait` |
|
|
82
|
+
| `--paper-size <size>` | | Standard paper size (`A4`, `Letter`, `Legal`, `A3`, `A5`) | `A4` |
|
|
83
|
+
| `--toc` | | Force Table of Contents generation | `false` |
|
|
84
|
+
| `--watermark <text>` | | Document watermark text | `undefined` |
|
|
85
|
+
| `--syntax-theme <theme>`| | Code syntax highlighting theme | `github-dark` |
|
|
86
|
+
| `--watch` | `-w` | Watch input file and re-compile on change | `false` |
|
|
87
|
+
| `--serve` | | Start local HTTP preview server | `false` |
|
|
88
|
+
| `--port <number>` | `-p` | Local preview server port | `4000` |
|
|
89
|
+
| `--open` | | Automatically open browser on preview | `false` |
|
|
90
|
+
| `--version` | `-V` | Output version number | |
|
|
91
|
+
| `--help` | `-h` | Display CLI help menu | |
|
|
80
92
|
|
|
81
|
-
|
|
82
|
-
> This is a tip — rendered with green styling.
|
|
93
|
+
---
|
|
83
94
|
|
|
84
|
-
|
|
85
|
-
> Critical information — rendered with purple styling.
|
|
95
|
+
## ⚙️ Configuration (`markforge.config.ts`)
|
|
86
96
|
|
|
87
|
-
|
|
88
|
-
> A warning — rendered with amber/yellow styling.
|
|
97
|
+
MarkForge supports type-safe configuration with full TypeScript Enums:
|
|
89
98
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
99
|
+
```typescript
|
|
100
|
+
import {
|
|
101
|
+
defineConfig,
|
|
102
|
+
OutputFormat,
|
|
103
|
+
Theme,
|
|
104
|
+
Orientation,
|
|
105
|
+
PaperSizeEnum,
|
|
106
|
+
SyntaxTheme,
|
|
107
|
+
WatermarkPosition,
|
|
108
|
+
} from "@masumdev/markforge";
|
|
93
109
|
|
|
94
|
-
|
|
110
|
+
export default defineConfig({
|
|
111
|
+
// Target output formats
|
|
112
|
+
to: [OutputFormat.DOCX, OutputFormat.PDF, OutputFormat.HTML],
|
|
95
113
|
|
|
96
|
-
|
|
114
|
+
// Output destination directory
|
|
115
|
+
outputDir: ".temp/output-docs",
|
|
97
116
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
flowchart LR
|
|
101
|
-
A[Markdown Source] --> B[AST Parser]
|
|
102
|
-
B --> C[DOCX Builder]
|
|
103
|
-
B --> D[PDF Builder]
|
|
104
|
-
B --> E[HTML Builder]
|
|
105
|
-
```
|
|
106
|
-
````
|
|
117
|
+
// Visual document theme (Theme.CORPORATE preset or a custom ThemeProps object)
|
|
118
|
+
theme: Theme.CORPORATE,
|
|
107
119
|
|
|
108
|
-
|
|
120
|
+
// Page orientation & standard physical paper size
|
|
121
|
+
orientation: Orientation.PORTRAIT,
|
|
122
|
+
paperSize: PaperSizeEnum.A4,
|
|
109
123
|
|
|
110
|
-
|
|
124
|
+
// Document page margins
|
|
125
|
+
margins: {
|
|
126
|
+
top: "3cm",
|
|
127
|
+
bottom: "2.5cm",
|
|
128
|
+
left: "2.5cm",
|
|
129
|
+
right: "2.5cm",
|
|
130
|
+
},
|
|
111
131
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
132
|
+
// Running headers with dynamic tokens & per-zone slot styling
|
|
133
|
+
header: {
|
|
134
|
+
left: {
|
|
135
|
+
text: "{company} - {title}",
|
|
136
|
+
color: "#0D998D",
|
|
137
|
+
fontSize: 9,
|
|
138
|
+
fontFamily: "Inter, Segoe UI, sans-serif",
|
|
139
|
+
bold: true,
|
|
140
|
+
},
|
|
141
|
+
center: "Internal Technical Guide",
|
|
142
|
+
right: {
|
|
143
|
+
text: "v{version}",
|
|
144
|
+
color: "#94A3B8",
|
|
145
|
+
fontSize: 8.5,
|
|
146
|
+
italic: true,
|
|
147
|
+
},
|
|
148
|
+
divider: true,
|
|
149
|
+
dividerColor: "#CBD5E1",
|
|
150
|
+
},
|
|
115
151
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
152
|
+
// Running footers with dynamic page numbering & per-zone slot styling
|
|
153
|
+
footer: {
|
|
154
|
+
left: {
|
|
155
|
+
text: "Author: {author}",
|
|
156
|
+
color: "#64748B",
|
|
157
|
+
fontSize: 8.5,
|
|
158
|
+
},
|
|
159
|
+
center: {
|
|
160
|
+
text: "{date}",
|
|
161
|
+
color: "#94A3B8",
|
|
162
|
+
fontSize: 8.5,
|
|
163
|
+
italic: true,
|
|
164
|
+
},
|
|
165
|
+
right: {
|
|
166
|
+
text: "Page {page} of {pages}",
|
|
167
|
+
color: "#0D998D",
|
|
168
|
+
fontSize: 9,
|
|
169
|
+
bold: true,
|
|
170
|
+
},
|
|
171
|
+
divider: true,
|
|
172
|
+
dividerColor: "#CBD5E1",
|
|
173
|
+
},
|
|
119
174
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
- **DOCX**: GitHub Light palette (deep colors on white background)
|
|
175
|
+
// Automatic Table of Contents
|
|
176
|
+
toc: true,
|
|
123
177
|
|
|
124
|
-
|
|
178
|
+
// Watermark configuration (placed at lowest background layer)
|
|
179
|
+
watermark: {
|
|
180
|
+
text: "CONFIDENTIAL DRAFT",
|
|
181
|
+
color: "#E11D48",
|
|
182
|
+
opacity: 0.1,
|
|
183
|
+
fontSize: 52,
|
|
184
|
+
rotate: -45,
|
|
185
|
+
position: WatermarkPosition.DIAGONAL,
|
|
186
|
+
},
|
|
125
187
|
|
|
126
|
-
|
|
188
|
+
// Syntax highlighting theme
|
|
189
|
+
syntaxTheme: SyntaxTheme.DRACULA,
|
|
127
190
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
---
|
|
191
|
+
// Asset embedding & bundling flags
|
|
192
|
+
embedImages: true,
|
|
193
|
+
bundleHtml: true,
|
|
132
194
|
|
|
133
|
-
|
|
195
|
+
// Global document metadata
|
|
196
|
+
metadata: {
|
|
197
|
+
title: "Unified Platform Architecture & Document Suite",
|
|
198
|
+
subtitle: "Enterprise Specification & Feature Validation Guide",
|
|
199
|
+
author: "Masum RPG",
|
|
200
|
+
company: "Masum Dev Technologies",
|
|
201
|
+
version: "1.0.0",
|
|
202
|
+
date: "2026-08-29",
|
|
203
|
+
lang: "en",
|
|
204
|
+
},
|
|
205
|
+
});
|
|
134
206
|
```
|
|
135
207
|
|
|
136
208
|
---
|
|
137
209
|
|
|
138
|
-
##
|
|
139
|
-
|
|
140
|
-
```markdown
|
|
141
|
-
---
|
|
142
|
-
title: "Enterprise Architecture Specification"
|
|
143
|
-
subtitle: "Cloud & Edge Infrastructure — Q3 2026"
|
|
144
|
-
author: "Ma'sum"
|
|
145
|
-
version: "2.4.0"
|
|
146
|
-
date: "2026-08-27"
|
|
147
|
-
theme: "default" # default | academic | github | corporate | minimal | dracula
|
|
148
|
-
toc: true # auto-generate Table of Contents
|
|
149
|
-
orientation: "portrait" # portrait | landscape
|
|
150
|
-
paperSize: "A4" # A4 | letter | legal
|
|
151
|
-
watermark:
|
|
152
|
-
enabled: false # no watermark by default
|
|
153
|
-
text: "CONFIDENTIAL"
|
|
154
|
-
opacity: 0.08
|
|
155
|
-
position: "diagonal" # diagonal | center | top-left | top-right | bottom-left | bottom-right
|
|
156
|
-
header:
|
|
157
|
-
left: "My Company"
|
|
158
|
-
center: "{title}"
|
|
159
|
-
right: "Version {version}"
|
|
160
|
-
footer:
|
|
161
|
-
left: "Confidential"
|
|
162
|
-
right: "Page {page} of {pages}"
|
|
163
|
-
---
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
---
|
|
210
|
+
## 🎨 Custom Theme Customization (`ThemeProps`)
|
|
167
211
|
|
|
168
|
-
|
|
212
|
+
You can completely rebrand all document styling by passing a `ThemeProps` object:
|
|
169
213
|
|
|
170
214
|
```typescript
|
|
171
215
|
import { defineConfig } from "@masumdev/markforge";
|
|
172
216
|
|
|
173
217
|
export default defineConfig({
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
center: "{title}",
|
|
188
|
-
right: "v{version}",
|
|
189
|
-
},
|
|
190
|
-
footer: {
|
|
191
|
-
left: "Confidential",
|
|
192
|
-
right: "Page {page} of {pages}",
|
|
193
|
-
},
|
|
194
|
-
toc: true,
|
|
195
|
-
embedImages: true,
|
|
196
|
-
watermark: {
|
|
197
|
-
enabled: false, // disabled by default — enable to add branding
|
|
198
|
-
text: "DRAFT",
|
|
199
|
-
opacity: 0.07,
|
|
200
|
-
position: "diagonal",
|
|
218
|
+
theme: {
|
|
219
|
+
primaryColor: "#0D998D",
|
|
220
|
+
primaryDark: "#008073",
|
|
221
|
+
primaryLight: "#D9F1F0",
|
|
222
|
+
backgroundColor: "#0F172A",
|
|
223
|
+
textColor: "#E2E8F0",
|
|
224
|
+
textMuted: "#94A3B8",
|
|
225
|
+
borderColor: "#334155",
|
|
226
|
+
cardBackground: "#1E293B",
|
|
227
|
+
codeBackground: "#020617",
|
|
228
|
+
codeText: "#E2E8F0",
|
|
229
|
+
fontFamily: "'Inter', sans-serif",
|
|
230
|
+
fontMono: "'Fira Code', monospace",
|
|
201
231
|
},
|
|
202
232
|
});
|
|
203
233
|
```
|
|
204
234
|
|
|
205
235
|
---
|
|
206
236
|
|
|
207
|
-
##
|
|
237
|
+
## 🚀 Programmatic API
|
|
238
|
+
|
|
239
|
+
### High-Level API (`compileMarkdown` / `markforge`)
|
|
208
240
|
|
|
209
241
|
```typescript
|
|
210
|
-
import {
|
|
242
|
+
import { compileMarkdown, OutputFormat } from "@masumdev/markforge";
|
|
211
243
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
to: ["docx", "pdf", "html"],
|
|
244
|
+
const result = await compileMarkdown("./specification.md", {
|
|
245
|
+
to: [OutputFormat.DOCX, OutputFormat.PDF, OutputFormat.HTML],
|
|
215
246
|
outputDir: "./dist",
|
|
216
|
-
|
|
247
|
+
toc: true,
|
|
217
248
|
metadata: {
|
|
218
|
-
title: "
|
|
219
|
-
author: "
|
|
220
|
-
version: "
|
|
249
|
+
title: "API Reference Manual",
|
|
250
|
+
author: "Masum Dev",
|
|
251
|
+
version: "1.0.0",
|
|
221
252
|
},
|
|
222
253
|
});
|
|
223
254
|
|
|
224
|
-
console.log(`✓
|
|
225
|
-
|
|
255
|
+
console.log(`✓ Compiled ${result.files.length} documents in ${result.durationMs}ms:`);
|
|
226
256
|
for (const file of result.files) {
|
|
227
|
-
console.log(` [${file.format.toUpperCase()}] ${file.filePath}
|
|
257
|
+
console.log(` [${file.format.toUpperCase()}] ${file.filePath} (${file.sizeBytes} bytes)`);
|
|
228
258
|
}
|
|
229
259
|
```
|
|
230
260
|
|
|
231
|
-
|
|
232
|
-
import { compileMarkdown, buildPdfDocument, buildDocxDocument, buildHtmlDocument } from "@masumdev/markforge";
|
|
261
|
+
### Low-Level API (AST & Individual Document Builders)
|
|
233
262
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
| `--output <dir>` | `-o` | Output directory | Same as input file dir |
|
|
265
|
-
| `--theme <name>` | | Built-in theme name | `default` |
|
|
266
|
-
| `--css <path...>` | | Custom CSS file(s) to inject | |
|
|
267
|
-
| `--toc` | | Force Table of Contents generation | `false` |
|
|
268
|
-
| `--config <path>` | `-c` | Config file path (`markforge.config.ts`, `.json`, `.yaml`) | Auto-discovered |
|
|
269
|
-
| `--watch` | `-w` | Watch input and re-compile on change | `false` |
|
|
270
|
-
| `--version` | `-V` | Print version and exit | |
|
|
271
|
-
| `--help` | `-h` | Show help | |
|
|
272
|
-
|
|
273
|
-
---
|
|
274
|
-
|
|
275
|
-
## 🏗️ Architecture
|
|
276
|
-
|
|
277
|
-
```
|
|
278
|
-
Markdown / MDX source
|
|
279
|
-
│
|
|
280
|
-
▼
|
|
281
|
-
┌─────────────┐
|
|
282
|
-
│ AST Parser │ → Frontmatter + Node tree
|
|
283
|
-
└──────┬──────┘
|
|
284
|
-
│
|
|
285
|
-
┌─────┼─────┐
|
|
286
|
-
│ │ │
|
|
287
|
-
▼ ▼ ▼
|
|
288
|
-
DOCX PDF HTML
|
|
289
|
-
Builder Builder Builder
|
|
290
|
-
│ │ │
|
|
291
|
-
│ Chromium │
|
|
292
|
-
│ (headless│
|
|
293
|
-
│ PDF) │
|
|
294
|
-
▼ ▼ ▼
|
|
295
|
-
.docx .pdf .html
|
|
263
|
+
```typescript
|
|
264
|
+
import * as fs from "node:fs";
|
|
265
|
+
import {
|
|
266
|
+
parseMarkdownDocument,
|
|
267
|
+
buildDocxDocument,
|
|
268
|
+
buildPdfDocument,
|
|
269
|
+
buildHtmlDocument,
|
|
270
|
+
Theme,
|
|
271
|
+
} from "@masumdev/markforge";
|
|
272
|
+
|
|
273
|
+
const markdownContent = fs.readFileSync("./report.md", "utf-8");
|
|
274
|
+
|
|
275
|
+
// 1. Parse Markdown into structured AST
|
|
276
|
+
const doc = parseMarkdownDocument(markdownContent);
|
|
277
|
+
|
|
278
|
+
const config = {
|
|
279
|
+
theme: Theme.CORPORATE,
|
|
280
|
+
toc: true,
|
|
281
|
+
margins: { top: "2.5cm", bottom: "2.5cm", left: "2.5cm", right: "2.5cm" },
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
// 2. Build formats independently into binary buffers or HTML strings
|
|
285
|
+
const docxBuffer = await buildDocxDocument(doc, config);
|
|
286
|
+
const pdfBuffer = await buildPdfDocument(doc, config);
|
|
287
|
+
const htmlString = await buildHtmlDocument(doc, config);
|
|
288
|
+
|
|
289
|
+
// 3. Write output files
|
|
290
|
+
fs.writeFileSync("./dist/report.docx", docxBuffer);
|
|
291
|
+
fs.writeFileSync("./dist/report.pdf", pdfBuffer);
|
|
292
|
+
fs.writeFileSync("./dist/report.html", htmlString, "utf-8");
|
|
296
293
|
```
|
|
297
294
|
|
|
298
|
-
**Sub-systems:**
|
|
299
|
-
- `imageResolver` — Local / URL / Base64 / SVG asset resolution
|
|
300
|
-
- `mermaidRenderer` — Headless Mermaid.js diagram rasterization
|
|
301
|
-
- `syntaxHighlighter` — Dual dark/light theme tokenizer (no external deps)
|
|
302
|
-
- `htmlThemes` — `THEME_COMPONENTS` base + per-theme typography overrides
|
|
303
|
-
|
|
304
295
|
---
|
|
305
296
|
|
|
306
297
|
## 📄 License
|
|
307
298
|
|
|
308
|
-
MIT © [
|
|
299
|
+
MIT © [Masum Dev](https://github.com/masumdev)
|