@masumdev/markforge 0.2.4 → 0.3.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 +229 -298
- package/dist/{App-IJVCGBJM.mjs → App-AM2CWXHJ.mjs} +1413 -378
- package/dist/{chunk-NGC2ZAWZ.mjs → chunk-HKB4CSPZ.mjs} +1 -1
- package/dist/cli.mjs +2 -2
- package/dist/index.d.mts +409 -59
- package/dist/index.d.ts +409 -59
- package/dist/index.js +1533 -479
- package/dist/index.mjs +1520 -480
- package/package.json +1 -1
- package/schema.json +198 -36
package/dist/cli.mjs
CHANGED
|
@@ -9,7 +9,7 @@ try {
|
|
|
9
9
|
} catch {}
|
|
10
10
|
import {
|
|
11
11
|
MARKFORGE_VERSION
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-HKB4CSPZ.mjs";
|
|
13
13
|
import "./chunk-YZHGBG4N.mjs";
|
|
14
14
|
|
|
15
15
|
// src/cli.tsx
|
|
@@ -57,7 +57,7 @@ async function main() {
|
|
|
57
57
|
const cliFormats = options.to ? options.to.split(",").map((f) => f.trim().toLowerCase()).filter(Boolean) : void 0;
|
|
58
58
|
const [{ render }, { App }, { loadConfig }] = await Promise.all([
|
|
59
59
|
import("ink"),
|
|
60
|
-
import("./App-
|
|
60
|
+
import("./App-AM2CWXHJ.mjs"),
|
|
61
61
|
import("./loadConfig-PD6ENMAM.mjs")
|
|
62
62
|
]);
|
|
63
63
|
const { config: fileConfig } = await loadConfig(
|
package/dist/index.d.mts
CHANGED
|
@@ -1,21 +1,147 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
declare enum OutputFormat {
|
|
2
|
+
DOCX = "docx",
|
|
3
|
+
PDF = "pdf",
|
|
4
|
+
HTML = "html",
|
|
5
|
+
PNG = "png"
|
|
6
|
+
}
|
|
7
|
+
type MarkforgeFormat = "docx" | "pdf" | "html" | "png" | OutputFormat;
|
|
8
|
+
interface ThemeProps {
|
|
9
|
+
/**
|
|
10
|
+
* Primary brand accent color (e.g. "#33CDCF", "#2563EB", "#7C3AED", "#E11D48").
|
|
11
|
+
* @default "#33CDCF"
|
|
12
|
+
*/
|
|
13
|
+
primaryColor?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Dark primary tone for headings, active links, and prominent badges.
|
|
16
|
+
* @default "#009DA0"
|
|
17
|
+
*/
|
|
18
|
+
primaryDark?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Light primary background tint for callouts and active pills.
|
|
21
|
+
* @default "#ECFDFD"
|
|
22
|
+
*/
|
|
23
|
+
primaryLight?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Document page background color.
|
|
26
|
+
* @default "#FFFFFF"
|
|
27
|
+
*/
|
|
28
|
+
backgroundColor?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Primary body copy text color.
|
|
31
|
+
* @default "#0F172A"
|
|
32
|
+
*/
|
|
33
|
+
textColor?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Muted secondary text color for subtitles, dates, and footers.
|
|
36
|
+
* @default "#64748B"
|
|
37
|
+
*/
|
|
38
|
+
textMuted?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Border color for tables, dividers, and card containers.
|
|
41
|
+
* @default "#E2E8F0"
|
|
42
|
+
*/
|
|
43
|
+
borderColor?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Background color for cards, table headers, and blockquotes.
|
|
46
|
+
* @default "#F8FAFC"
|
|
47
|
+
*/
|
|
48
|
+
cardBackground?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Background color for code blocks.
|
|
51
|
+
* @default "#0F172A"
|
|
52
|
+
*/
|
|
53
|
+
codeBackground?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Text color for code blocks.
|
|
56
|
+
* @default "#F8FAFC"
|
|
57
|
+
*/
|
|
58
|
+
codeText?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Primary body and heading font family.
|
|
61
|
+
* @default "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"
|
|
62
|
+
*/
|
|
63
|
+
fontFamily?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Monospace font family for code blocks and inline code.
|
|
66
|
+
* @default "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace"
|
|
67
|
+
*/
|
|
68
|
+
fontMono?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Optional custom raw CSS styles appended directly to the stylesheet.
|
|
71
|
+
*/
|
|
72
|
+
customCss?: string;
|
|
73
|
+
}
|
|
74
|
+
declare enum Theme {
|
|
75
|
+
CORPORATE = "corporate"
|
|
76
|
+
}
|
|
77
|
+
type MarkforgeTheme = Theme | ThemeProps | "corporate" | (string & {});
|
|
78
|
+
declare enum Orientation {
|
|
79
|
+
PORTRAIT = "portrait",
|
|
80
|
+
LANDSCAPE = "landscape"
|
|
81
|
+
}
|
|
82
|
+
type DocumentOrientation = "portrait" | "landscape" | Orientation;
|
|
83
|
+
declare enum PaperSizeEnum {
|
|
84
|
+
A4 = "A4",
|
|
85
|
+
LETTER = "Letter",
|
|
86
|
+
LEGAL = "Legal",
|
|
87
|
+
A3 = "A3",
|
|
88
|
+
A5 = "A5"
|
|
89
|
+
}
|
|
90
|
+
type PaperSize = "A4" | "Letter" | "Legal" | "A3" | "A5" | PaperSizeEnum;
|
|
91
|
+
declare enum SyntaxTheme {
|
|
92
|
+
GITHUB_DARK = "github-dark",
|
|
93
|
+
GITHUB_LIGHT = "github-light",
|
|
94
|
+
DRACULA = "dracula",
|
|
95
|
+
MONOKAI = "monokai",
|
|
96
|
+
NORD = "nord"
|
|
97
|
+
}
|
|
98
|
+
declare enum WatermarkPosition {
|
|
99
|
+
DIAGONAL = "diagonal",
|
|
100
|
+
CENTER = "center",
|
|
101
|
+
TOP_RIGHT = "top-right",
|
|
102
|
+
BOTTOM_RIGHT = "bottom-right"
|
|
103
|
+
}
|
|
5
104
|
interface PageMargins {
|
|
6
105
|
top?: string | number;
|
|
7
106
|
bottom?: string | number;
|
|
8
107
|
left?: string | number;
|
|
9
108
|
right?: string | number;
|
|
10
109
|
}
|
|
110
|
+
interface HeaderFooterSlot {
|
|
111
|
+
/**
|
|
112
|
+
* Header or footer template text (supports tokens like {title}, {author}, {version}, {date}, {company}, {page}, {pages}).
|
|
113
|
+
*/
|
|
114
|
+
text: string;
|
|
115
|
+
/**
|
|
116
|
+
* Custom text color for this zone (e.g. "#0D998D", "#94A3B8").
|
|
117
|
+
*/
|
|
118
|
+
color?: string;
|
|
119
|
+
/**
|
|
120
|
+
* Custom font size in points (e.g. 9, 10).
|
|
121
|
+
*/
|
|
122
|
+
fontSize?: number;
|
|
123
|
+
/**
|
|
124
|
+
* Custom font family for this zone (e.g. "Segoe UI", "Inter").
|
|
125
|
+
*/
|
|
126
|
+
fontFamily?: string;
|
|
127
|
+
/**
|
|
128
|
+
* Whether to render this zone in bold weight.
|
|
129
|
+
*/
|
|
130
|
+
bold?: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Whether to render this zone in italics.
|
|
133
|
+
*/
|
|
134
|
+
italic?: boolean;
|
|
135
|
+
}
|
|
11
136
|
interface HeaderFooterItem {
|
|
12
|
-
left?: string;
|
|
13
|
-
center?: string;
|
|
14
|
-
right?: string;
|
|
137
|
+
left?: string | HeaderFooterSlot;
|
|
138
|
+
center?: string | HeaderFooterSlot;
|
|
139
|
+
right?: string | HeaderFooterSlot;
|
|
15
140
|
font?: string;
|
|
16
141
|
size?: number;
|
|
17
142
|
color?: string;
|
|
18
143
|
divider?: boolean;
|
|
144
|
+
dividerColor?: string;
|
|
19
145
|
}
|
|
20
146
|
interface WatermarkOptions {
|
|
21
147
|
text: string;
|
|
@@ -23,54 +149,111 @@ interface WatermarkOptions {
|
|
|
23
149
|
opacity?: number;
|
|
24
150
|
fontSize?: number;
|
|
25
151
|
rotate?: number;
|
|
26
|
-
position?: "diagonal" | "center" | "top-right" | "bottom-right";
|
|
152
|
+
position?: "diagonal" | "center" | "top-right" | "bottom-right" | WatermarkPosition;
|
|
27
153
|
}
|
|
28
|
-
|
|
154
|
+
/**
|
|
155
|
+
* Pure document metadata dictionary (author, title, date, version, etc.).
|
|
156
|
+
*/
|
|
157
|
+
interface DocumentMetadata {
|
|
29
158
|
title?: string;
|
|
30
159
|
subtitle?: string;
|
|
31
160
|
author?: string | string[];
|
|
32
161
|
date?: string;
|
|
33
162
|
version?: string;
|
|
34
|
-
|
|
35
|
-
orientation?: DocumentOrientation;
|
|
36
|
-
paperSize?: PaperSize;
|
|
37
|
-
margins?: PageMargins;
|
|
38
|
-
header?: HeaderFooterItem;
|
|
39
|
-
footer?: HeaderFooterItem;
|
|
40
|
-
toc?: boolean;
|
|
41
|
-
watermark?: string | WatermarkOptions | false;
|
|
42
|
-
css?: string | string[];
|
|
43
|
-
coverPage?: boolean;
|
|
163
|
+
company?: string;
|
|
44
164
|
lang?: string;
|
|
165
|
+
coverPage?: boolean;
|
|
45
166
|
[key: string]: unknown;
|
|
46
167
|
}
|
|
47
|
-
|
|
168
|
+
type SignatureAlign = "left" | "center" | "right" | "space-between";
|
|
169
|
+
type SignatureStyle = "line" | "box" | "clean";
|
|
170
|
+
interface SignatureItem {
|
|
48
171
|
/**
|
|
49
|
-
*
|
|
50
|
-
* @default ["docx", "pdf"]
|
|
172
|
+
* Title or sign-off label above signature (e.g. "Prepared by", "Approved by", "Acknowledged by").
|
|
51
173
|
*/
|
|
52
|
-
|
|
174
|
+
title?: string;
|
|
53
175
|
/**
|
|
54
|
-
*
|
|
55
|
-
* Defaults to the same directory as the input file.
|
|
176
|
+
* Signatory person name (supports metadata tokens like {author}, {company}).
|
|
56
177
|
*/
|
|
57
|
-
|
|
178
|
+
name: string;
|
|
179
|
+
/**
|
|
180
|
+
* Signatory job title, role, or department (e.g. "Lead System Architect", "Chief Technology Officer").
|
|
181
|
+
*/
|
|
182
|
+
role?: string;
|
|
183
|
+
/**
|
|
184
|
+
* Signature date string or template (e.g. "2026-08-29", "{date}", or true for auto-formatted current date).
|
|
185
|
+
*/
|
|
186
|
+
date?: string | boolean;
|
|
187
|
+
/**
|
|
188
|
+
* Optional signature image path, URL, or Base64 data URI (stamp, digital seal, or handwritten signature).
|
|
189
|
+
*/
|
|
190
|
+
image?: string;
|
|
191
|
+
/**
|
|
192
|
+
* Height reserved for physical handwriting signature (e.g. 60, "60px", "1.5cm").
|
|
193
|
+
* @default 60
|
|
194
|
+
*/
|
|
195
|
+
signatureHeight?: number | string;
|
|
196
|
+
}
|
|
197
|
+
interface SignatureBlockConfig {
|
|
198
|
+
/**
|
|
199
|
+
* List of 1 to 4 signature slots.
|
|
200
|
+
*/
|
|
201
|
+
items: SignatureItem[];
|
|
202
|
+
/**
|
|
203
|
+
* Horizontal alignment of the signature block.
|
|
204
|
+
* @default "right" for 1 item, "space-between" for >= 2 items
|
|
205
|
+
*/
|
|
206
|
+
align?: SignatureAlign;
|
|
207
|
+
/**
|
|
208
|
+
* Visual layout style of the signature block:
|
|
209
|
+
* - "line": Traditional signature with a horizontal separator line above name.
|
|
210
|
+
* - "box": Formal bordered rectangular approval card.
|
|
211
|
+
* - "clean": Minimalist blank vertical space without borders.
|
|
212
|
+
* @default "line"
|
|
213
|
+
*/
|
|
214
|
+
style?: SignatureStyle;
|
|
215
|
+
/**
|
|
216
|
+
* Border or divider line color.
|
|
217
|
+
* @default "#CBD5E1"
|
|
218
|
+
*/
|
|
219
|
+
borderColor?: string;
|
|
220
|
+
/**
|
|
221
|
+
* Color of the signature title / label.
|
|
222
|
+
* @default "#64748B"
|
|
223
|
+
*/
|
|
224
|
+
titleColor?: string;
|
|
225
|
+
/**
|
|
226
|
+
* Color of the signatory name.
|
|
227
|
+
* @default "#0F172A"
|
|
228
|
+
*/
|
|
229
|
+
nameColor?: string;
|
|
230
|
+
/**
|
|
231
|
+
* Color of the role and date text.
|
|
232
|
+
* @default "#64748B"
|
|
233
|
+
*/
|
|
234
|
+
roleColor?: string;
|
|
235
|
+
/**
|
|
236
|
+
* Vertical spacing before the signature block (e.g. "2.5rem", 480).
|
|
237
|
+
* @default "2.5rem"
|
|
238
|
+
*/
|
|
239
|
+
spacingBefore?: number | string;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Document visual & layout options (theme, orientation, margins, headers, footers, etc.).
|
|
243
|
+
*/
|
|
244
|
+
interface DocumentLayoutConfig {
|
|
58
245
|
/**
|
|
59
246
|
* Built-in visual theme name.
|
|
60
247
|
* @default "default"
|
|
61
248
|
*/
|
|
62
249
|
theme?: MarkforgeTheme;
|
|
63
|
-
/**
|
|
64
|
-
* Path(s) to custom CSS stylesheets to inject into the document.
|
|
65
|
-
*/
|
|
66
|
-
css?: string | string[];
|
|
67
250
|
/**
|
|
68
251
|
* Page orientation.
|
|
69
252
|
* @default "portrait"
|
|
70
253
|
*/
|
|
71
254
|
orientation?: DocumentOrientation;
|
|
72
255
|
/**
|
|
73
|
-
*
|
|
256
|
+
* Standard paper size.
|
|
74
257
|
* @default "A4"
|
|
75
258
|
*/
|
|
76
259
|
paperSize?: PaperSize;
|
|
@@ -79,11 +262,11 @@ interface MarkforgeConfig {
|
|
|
79
262
|
*/
|
|
80
263
|
margins?: PageMargins;
|
|
81
264
|
/**
|
|
82
|
-
*
|
|
265
|
+
* Running header template configuration.
|
|
83
266
|
*/
|
|
84
267
|
header?: HeaderFooterItem;
|
|
85
268
|
/**
|
|
86
|
-
*
|
|
269
|
+
* Running footer template configuration.
|
|
87
270
|
*/
|
|
88
271
|
footer?: HeaderFooterItem;
|
|
89
272
|
/**
|
|
@@ -91,20 +274,60 @@ interface MarkforgeConfig {
|
|
|
91
274
|
* @default false
|
|
92
275
|
*/
|
|
93
276
|
toc?: boolean;
|
|
277
|
+
/**
|
|
278
|
+
* Document signature and approval block at the bottom of the document.
|
|
279
|
+
* Supports 1-4 signature items, flexible alignment, and multiple styles ("line", "box", "clean").
|
|
280
|
+
*/
|
|
281
|
+
signatures?: SignatureBlockConfig | SignatureItem[];
|
|
94
282
|
/**
|
|
95
283
|
* Optional watermark configuration to display across pages.
|
|
96
|
-
*
|
|
284
|
+
* @default false
|
|
97
285
|
*/
|
|
98
286
|
watermark?: string | WatermarkOptions | false;
|
|
287
|
+
/**
|
|
288
|
+
* Path(s) to custom CSS stylesheets to inject into the document.
|
|
289
|
+
*/
|
|
290
|
+
css?: string | string[];
|
|
291
|
+
/**
|
|
292
|
+
* Code syntax highlighting theme.
|
|
293
|
+
* @default "github-dark"
|
|
294
|
+
*/
|
|
295
|
+
syntaxTheme?: "github-dark" | "github-light" | "dracula" | "monokai" | "nord" | SyntaxTheme | (string & {});
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Complete metadata extracted from Markdown frontmatter.
|
|
299
|
+
* Combines document metadata and layout overrides.
|
|
300
|
+
*/
|
|
301
|
+
type FrontmatterMetadata = DocumentMetadata & DocumentLayoutConfig;
|
|
302
|
+
/**
|
|
303
|
+
* Top-level MarkForge configuration (from config file, CLI, or API).
|
|
304
|
+
* Clean, 100% intuitive, and zero-duplicate architecture.
|
|
305
|
+
*/
|
|
306
|
+
interface MarkforgeConfig extends DocumentLayoutConfig {
|
|
307
|
+
/**
|
|
308
|
+
* Target format(s) to compile markdown to.
|
|
309
|
+
* @default ["docx", "pdf"]
|
|
310
|
+
*/
|
|
311
|
+
to?: MarkforgeFormat | MarkforgeFormat[];
|
|
312
|
+
/**
|
|
313
|
+
* Output directory where compiled documents will be saved.
|
|
314
|
+
* Defaults to the same directory as the input file.
|
|
315
|
+
*/
|
|
316
|
+
outputDir?: string;
|
|
317
|
+
/**
|
|
318
|
+
* Default document metadata (title, author, date, etc.) used when not provided in frontmatter.
|
|
319
|
+
*/
|
|
320
|
+
metadata?: DocumentMetadata;
|
|
99
321
|
/**
|
|
100
322
|
* Whether to embed all images (local and remote) directly into the document.
|
|
101
323
|
* @default true
|
|
102
324
|
*/
|
|
103
325
|
embedImages?: boolean;
|
|
104
326
|
/**
|
|
105
|
-
*
|
|
327
|
+
* Whether to generate standalone self-contained HTML bundle.
|
|
328
|
+
* @default true
|
|
106
329
|
*/
|
|
107
|
-
|
|
330
|
+
bundleHtml?: boolean;
|
|
108
331
|
/**
|
|
109
332
|
* Watch files and automatically recompile on changes.
|
|
110
333
|
* @default false
|
|
@@ -125,16 +348,6 @@ interface MarkforgeConfig {
|
|
|
125
348
|
* @default false
|
|
126
349
|
*/
|
|
127
350
|
open?: boolean;
|
|
128
|
-
/**
|
|
129
|
-
* Whether to generate standalone self-contained HTML bundle.
|
|
130
|
-
* @default true
|
|
131
|
-
*/
|
|
132
|
-
bundleHtml?: boolean;
|
|
133
|
-
/**
|
|
134
|
-
* Code syntax highlighting theme.
|
|
135
|
-
* @default "github-dark"
|
|
136
|
-
*/
|
|
137
|
-
syntaxTheme?: string;
|
|
138
351
|
}
|
|
139
352
|
interface GeneratedOutputFile {
|
|
140
353
|
format: MarkforgeFormat;
|
|
@@ -291,14 +504,11 @@ declare const SYNTAX_COLORS: {
|
|
|
291
504
|
punctuation: string;
|
|
292
505
|
plain: string;
|
|
293
506
|
};
|
|
294
|
-
|
|
295
|
-
* Tokenizes a single line of code into styled tokens based on language.
|
|
296
|
-
*/
|
|
297
|
-
declare function tokenizeCodeLine(line: string, lang?: string, theme?: "dark" | "light"): SyntaxToken[];
|
|
507
|
+
declare function tokenizeCodeLine(line: string, lang?: string, theme?: string): SyntaxToken[];
|
|
298
508
|
/**
|
|
299
509
|
* Converts a code snippet to syntax-highlighted HTML with colored span tokens.
|
|
300
510
|
*/
|
|
301
|
-
declare function highlightCodeToHtml(code: string, lang?: string): string;
|
|
511
|
+
declare function highlightCodeToHtml(code: string, lang?: string, theme?: string): string;
|
|
302
512
|
|
|
303
513
|
/**
|
|
304
514
|
* Renders Mermaid diagram definition into an SVG/PNG buffer for DOCX and HTML embedding.
|
|
@@ -306,26 +516,29 @@ declare function highlightCodeToHtml(code: string, lang?: string): string;
|
|
|
306
516
|
declare function renderMermaidToPng(mermaidCode: string, _baseDir?: string): Promise<Buffer | null>;
|
|
307
517
|
|
|
308
518
|
/**
|
|
309
|
-
*
|
|
519
|
+
* Flagship corporate theme — full design system with Blu-by-BCA-Digital cyan palette.
|
|
310
520
|
*/
|
|
311
|
-
declare const
|
|
521
|
+
declare const THEME_CORPORATE = "\n:root {\n --mf-bg: #ffffff;\n --mf-text: #0f172a;\n --mf-text-muted: #64748b;\n --mf-primary: #33CDCF;\n --mf-primary-dark: #009DA0;\n --mf-primary-light: #ECFDFD;\n --mf-border: #e2e8f0;\n --mf-card-bg: #f8fafc;\n --mf-code-bg: #0f172a;\n --mf-code-text: #f8fafc;\n --mf-font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif;\n --mf-font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;\n}\nbody { background-color: var(--mf-bg); color: var(--mf-text); font-family: var(--mf-font-family); font-size: 15px; line-height: 1.65; margin: 0; padding: 2.5rem; }\n.document-container { max-width: 860px; margin: 0 auto; position: relative; z-index: 1; }\nh1, h2, h3, h4, h5, h6 { color: var(--mf-text); font-weight: 700; margin-top: 1.8rem; margin-bottom: 0.8rem; line-height: 1.25; }\nh1 { font-size: 2.2rem; border-bottom: 2px solid var(--mf-primary); padding-bottom: 0.5rem; }\nh2 { font-size: 1.6rem; color: var(--mf-primary-dark); border-bottom: 1px solid #CCFBF1; padding-bottom: 0.4rem; }\nh3 { font-size: 1.3rem; }\nh4 { font-size: 1.1rem; }\np { margin: 0.8rem 0; }\n";
|
|
522
|
+
declare const THEME_DEFAULT = "\n:root {\n --mf-bg: #ffffff;\n --mf-text: #0f172a;\n --mf-text-muted: #64748b;\n --mf-primary: #33CDCF;\n --mf-primary-dark: #009DA0;\n --mf-primary-light: #ECFDFD;\n --mf-border: #e2e8f0;\n --mf-card-bg: #f8fafc;\n --mf-code-bg: #0f172a;\n --mf-code-text: #f8fafc;\n --mf-font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif;\n --mf-font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;\n}\nbody { background-color: var(--mf-bg); color: var(--mf-text); font-family: var(--mf-font-family); font-size: 15px; line-height: 1.65; margin: 0; padding: 2.5rem; }\n.document-container { max-width: 860px; margin: 0 auto; position: relative; z-index: 1; }\nh1, h2, h3, h4, h5, h6 { color: var(--mf-text); font-weight: 700; margin-top: 1.8rem; margin-bottom: 0.8rem; line-height: 1.25; }\nh1 { font-size: 2.2rem; border-bottom: 2px solid var(--mf-primary); padding-bottom: 0.5rem; }\nh2 { font-size: 1.6rem; color: var(--mf-primary-dark); border-bottom: 1px solid #CCFBF1; padding-bottom: 0.4rem; }\nh3 { font-size: 1.3rem; }\nh4 { font-size: 1.1rem; }\np { margin: 0.8rem 0; }\n";
|
|
523
|
+
declare const THEMES: Record<string, string>;
|
|
524
|
+
|
|
312
525
|
/**
|
|
313
|
-
*
|
|
526
|
+
* Resolves theme CSS based on preset name or custom ThemeProps object.
|
|
314
527
|
*/
|
|
315
|
-
declare
|
|
316
|
-
declare const THEMES: Record<string, string>;
|
|
528
|
+
declare function generateThemeCss(theme?: MarkforgeTheme): string;
|
|
317
529
|
|
|
318
530
|
/**
|
|
319
531
|
* Type-safe configuration helper for markforge.config.ts
|
|
320
532
|
*/
|
|
321
533
|
declare function defineConfig(config: MarkforgeConfig): MarkforgeConfig;
|
|
322
534
|
|
|
323
|
-
declare const DEFAULT_CONFIG: Required<Omit<MarkforgeConfig, "outputDir" | "css" | "margins" | "header" | "footer" | "watermark" | "metadata" | "syntaxTheme">> & {
|
|
535
|
+
declare const DEFAULT_CONFIG: Required<Omit<MarkforgeConfig, "outputDir" | "css" | "margins" | "header" | "footer" | "watermark" | "metadata" | "syntaxTheme" | "signatures">> & {
|
|
324
536
|
outputDir?: string;
|
|
325
537
|
css?: string | string[];
|
|
326
538
|
margins?: MarkforgeConfig["margins"];
|
|
327
539
|
header?: MarkforgeConfig["header"];
|
|
328
540
|
footer?: MarkforgeConfig["footer"];
|
|
541
|
+
signatures?: MarkforgeConfig["signatures"];
|
|
329
542
|
watermark?: string;
|
|
330
543
|
metadata?: MarkforgeConfig["metadata"];
|
|
331
544
|
syntaxTheme?: string;
|
|
@@ -338,12 +551,149 @@ declare function loadConfig(customPath?: string, startDir?: string): Promise<{
|
|
|
338
551
|
configPath: string | null;
|
|
339
552
|
}>;
|
|
340
553
|
|
|
554
|
+
/**
|
|
555
|
+
* Standard paper dimensions in Word Twips (1/20th of a point, 1440 twips = 1 inch).
|
|
556
|
+
*/
|
|
557
|
+
declare const PAPER_DIMENSIONS_TWIP: Record<PaperSize, {
|
|
558
|
+
width: number;
|
|
559
|
+
height: number;
|
|
560
|
+
}>;
|
|
561
|
+
interface NormalizedMargins {
|
|
562
|
+
top: string;
|
|
563
|
+
bottom: string;
|
|
564
|
+
left: string;
|
|
565
|
+
right: string;
|
|
566
|
+
topTwip: number;
|
|
567
|
+
bottomTwip: number;
|
|
568
|
+
leftTwip: number;
|
|
569
|
+
rightTwip: number;
|
|
570
|
+
}
|
|
571
|
+
interface NormalizedWatermark {
|
|
572
|
+
text: string;
|
|
573
|
+
color: string;
|
|
574
|
+
opacity: number;
|
|
575
|
+
fontSize: number;
|
|
576
|
+
rotate: number;
|
|
577
|
+
position: "diagonal" | "center" | "top-right" | "bottom-right";
|
|
578
|
+
}
|
|
579
|
+
interface NormalizedHeaderFooterZone {
|
|
580
|
+
text: string;
|
|
581
|
+
color: string;
|
|
582
|
+
fontSize: number;
|
|
583
|
+
fontFamily: string;
|
|
584
|
+
bold: boolean;
|
|
585
|
+
italic: boolean;
|
|
586
|
+
}
|
|
587
|
+
interface NormalizedHeaderFooter {
|
|
588
|
+
left?: NormalizedHeaderFooterZone;
|
|
589
|
+
center?: NormalizedHeaderFooterZone;
|
|
590
|
+
right?: NormalizedHeaderFooterZone;
|
|
591
|
+
font: string;
|
|
592
|
+
size: number;
|
|
593
|
+
color: string;
|
|
594
|
+
divider: boolean;
|
|
595
|
+
dividerColor: string;
|
|
596
|
+
}
|
|
597
|
+
interface NormalizedSignatureItem {
|
|
598
|
+
title?: string;
|
|
599
|
+
name: string;
|
|
600
|
+
role?: string;
|
|
601
|
+
date?: string;
|
|
602
|
+
image?: string;
|
|
603
|
+
signatureHeight: number;
|
|
604
|
+
}
|
|
605
|
+
interface NormalizedSignatureBlock {
|
|
606
|
+
items: NormalizedSignatureItem[];
|
|
607
|
+
align: SignatureAlign;
|
|
608
|
+
style: SignatureStyle;
|
|
609
|
+
borderColor: string;
|
|
610
|
+
titleColor: string;
|
|
611
|
+
nameColor: string;
|
|
612
|
+
roleColor: string;
|
|
613
|
+
spacingBefore: string;
|
|
614
|
+
spacingBeforeTwip: number;
|
|
615
|
+
}
|
|
616
|
+
interface ResolvedDocumentConfig {
|
|
617
|
+
title: string;
|
|
618
|
+
subtitle?: string;
|
|
619
|
+
author?: string;
|
|
620
|
+
date?: string;
|
|
621
|
+
version?: string;
|
|
622
|
+
company?: string;
|
|
623
|
+
lang: string;
|
|
624
|
+
theme: MarkforgeTheme;
|
|
625
|
+
orientation: DocumentOrientation;
|
|
626
|
+
paperSize: PaperSize;
|
|
627
|
+
paperDimensions: {
|
|
628
|
+
widthTwip: number;
|
|
629
|
+
heightTwip: number;
|
|
630
|
+
};
|
|
631
|
+
margins: NormalizedMargins;
|
|
632
|
+
header?: NormalizedHeaderFooter;
|
|
633
|
+
footer?: NormalizedHeaderFooter;
|
|
634
|
+
toc: boolean;
|
|
635
|
+
signatures?: NormalizedSignatureBlock;
|
|
636
|
+
watermark?: NormalizedWatermark;
|
|
637
|
+
css: string[];
|
|
638
|
+
embedImages: boolean;
|
|
639
|
+
bundleHtml: boolean;
|
|
640
|
+
syntaxTheme: string;
|
|
641
|
+
}
|
|
642
|
+
/**
|
|
643
|
+
* Replaces dynamic variables ({title}, {subtitle}, {author}, {version}, {date}, {company}) in text templates.
|
|
644
|
+
*/
|
|
645
|
+
declare function replaceDocumentTokens(template: string | undefined, meta: {
|
|
646
|
+
title?: string;
|
|
647
|
+
subtitle?: string;
|
|
648
|
+
author?: string;
|
|
649
|
+
version?: string;
|
|
650
|
+
date?: string;
|
|
651
|
+
company?: string;
|
|
652
|
+
}): string;
|
|
653
|
+
/**
|
|
654
|
+
* Normalizes watermark configuration into a consistent structured object.
|
|
655
|
+
*/
|
|
656
|
+
declare function normalizeWatermark(rawWatermark?: string | WatermarkOptions | false): NormalizedWatermark | undefined;
|
|
657
|
+
/**
|
|
658
|
+
* Normalizes an individual left, center, or right header/footer zone slot.
|
|
659
|
+
*/
|
|
660
|
+
declare function normalizeHeaderFooterSlot(rawSlot: string | HeaderFooterSlot | undefined, parent: HeaderFooterItem | undefined, meta: {
|
|
661
|
+
title?: string;
|
|
662
|
+
subtitle?: string;
|
|
663
|
+
author?: string;
|
|
664
|
+
version?: string;
|
|
665
|
+
date?: string;
|
|
666
|
+
company?: string;
|
|
667
|
+
}): NormalizedHeaderFooterZone | undefined;
|
|
668
|
+
/**
|
|
669
|
+
* Normalizes a header or footer item into a structured NormalizedHeaderFooter object.
|
|
670
|
+
*/
|
|
671
|
+
declare function normalizeHeaderFooter(raw: HeaderFooterItem | undefined, meta: {
|
|
672
|
+
title?: string;
|
|
673
|
+
subtitle?: string;
|
|
674
|
+
author?: string;
|
|
675
|
+
version?: string;
|
|
676
|
+
date?: string;
|
|
677
|
+
company?: string;
|
|
678
|
+
}): NormalizedHeaderFooter | undefined;
|
|
679
|
+
/**
|
|
680
|
+
* Normalizes signature and approval block configuration.
|
|
681
|
+
*/
|
|
682
|
+
declare function normalizeSignatures(raw?: SignatureBlockConfig | SignatureItem[], meta?: Record<string, unknown>): NormalizedSignatureBlock | undefined;
|
|
683
|
+
/**
|
|
684
|
+
* Centralized Single Source of Truth for resolving document configuration.
|
|
685
|
+
* Priority hierarchy: Frontmatter metadata > Project Config File / User Config > DEFAULT_CONFIG
|
|
686
|
+
*/
|
|
687
|
+
declare function resolveDocumentConfig(frontmatter?: Record<string, unknown>, userConfig?: MarkforgeConfig): ResolvedDocumentConfig;
|
|
688
|
+
|
|
341
689
|
/**
|
|
342
690
|
* Dynamically resolved version — reads from the nearest package.json at runtime.
|
|
343
691
|
* Falls back to the hardcoded FALLBACK_VERSION constant if not found.
|
|
344
692
|
*/
|
|
345
693
|
declare const MARKFORGE_VERSION: string;
|
|
346
|
-
/**
|
|
694
|
+
/**
|
|
695
|
+
* Resolves the MarkForge version dynamically from package.json in the specified or current directory.
|
|
696
|
+
*/
|
|
347
697
|
declare function getMarkforgeVersion(fromDir?: string): string;
|
|
348
698
|
|
|
349
|
-
export { type CompilationResult, DEFAULT_CONFIG, type DocumentOrientation, type FrontmatterMetadata, type GeneratedOutputFile, type HeaderFooterItem, MARKFORGE_VERSION, type MarkdownASTNode, type MarkdownInlineSpan, type MarkdownNodeType, type MarkforgeConfig, type MarkforgeFormat, type MarkforgeTheme, type PageMargins, type PaperSize, type ParsedMarkdownDocument, type ResolvedImage, SYNTAX_COLORS, type SyntaxToken, THEMES,
|
|
699
|
+
export { type CompilationResult, DEFAULT_CONFIG, type DocumentLayoutConfig, type DocumentMetadata, type DocumentOrientation, type FrontmatterMetadata, type GeneratedOutputFile, type HeaderFooterItem, type HeaderFooterSlot, MARKFORGE_VERSION, type MarkdownASTNode, type MarkdownInlineSpan, type MarkdownNodeType, type MarkforgeConfig, type MarkforgeFormat, type MarkforgeTheme, type NormalizedHeaderFooter, type NormalizedHeaderFooterZone, type NormalizedMargins, type NormalizedSignatureBlock, type NormalizedSignatureItem, type NormalizedWatermark, Orientation, OutputFormat, PAPER_DIMENSIONS_TWIP, type PageMargins, type PaperSize, PaperSizeEnum, type ParsedMarkdownDocument, type ResolvedDocumentConfig, type ResolvedImage, SYNTAX_COLORS, type SignatureAlign, type SignatureBlockConfig, type SignatureItem, type SignatureStyle, SyntaxTheme, type SyntaxToken, THEMES, THEME_CORPORATE, THEME_DEFAULT, Theme, type ThemeProps, type WatermarkOptions, WatermarkPosition, buildDocxDocument, buildHtmlDocument, buildPdfDocument, compileMarkdown, defineConfig, escapeHtml, findChromeExecutable, formatServerTimestamp, generateThemeCss, getMarkforgeVersion, getMimeType, highlightCodeToHtml, injectPagedMediaStyles, inlineHtmlImages, loadConfig, compileMarkdown as markforge, normalizeHeaderFooter, normalizeHeaderFooterSlot, normalizeSignatures, normalizeWatermark, parseInlineSpans, parseMarginToTwip, parseMarkdownDocument, renderInlinesToHtml, renderMermaidToPng, replaceDocumentTokens, resolveDocumentConfig, resolveImage, slugify, tokenizeCodeLine };
|