@masumdev/markforge 0.2.4 → 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 +203 -302
- package/dist/{App-IJVCGBJM.mjs → App-GNRUPFM7.mjs} +899 -323
- package/dist/cli.mjs +1 -1
- package/dist/index.d.mts +309 -62
- package/dist/index.d.ts +309 -62
- package/dist/index.js +1149 -483
- package/dist/index.mjs +1137 -484
- package/package.json +1 -1
- package/schema.json +198 -36
package/dist/cli.mjs
CHANGED
|
@@ -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-GNRUPFM7.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,38 @@ 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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
*/
|
|
52
|
-
to?: MarkforgeFormat | MarkforgeFormat[];
|
|
53
|
-
/**
|
|
54
|
-
* Output directory where compiled documents will be saved.
|
|
55
|
-
* Defaults to the same directory as the input file.
|
|
56
|
-
*/
|
|
57
|
-
outputDir?: string;
|
|
168
|
+
/**
|
|
169
|
+
* Document visual & layout options (theme, orientation, margins, headers, footers, etc.).
|
|
170
|
+
*/
|
|
171
|
+
interface DocumentLayoutConfig {
|
|
58
172
|
/**
|
|
59
173
|
* Built-in visual theme name.
|
|
60
174
|
* @default "default"
|
|
61
175
|
*/
|
|
62
176
|
theme?: MarkforgeTheme;
|
|
63
|
-
/**
|
|
64
|
-
* Path(s) to custom CSS stylesheets to inject into the document.
|
|
65
|
-
*/
|
|
66
|
-
css?: string | string[];
|
|
67
177
|
/**
|
|
68
178
|
* Page orientation.
|
|
69
179
|
* @default "portrait"
|
|
70
180
|
*/
|
|
71
181
|
orientation?: DocumentOrientation;
|
|
72
182
|
/**
|
|
73
|
-
*
|
|
183
|
+
* Standard paper size.
|
|
74
184
|
* @default "A4"
|
|
75
185
|
*/
|
|
76
186
|
paperSize?: PaperSize;
|
|
@@ -79,11 +189,11 @@ interface MarkforgeConfig {
|
|
|
79
189
|
*/
|
|
80
190
|
margins?: PageMargins;
|
|
81
191
|
/**
|
|
82
|
-
*
|
|
192
|
+
* Running header template configuration.
|
|
83
193
|
*/
|
|
84
194
|
header?: HeaderFooterItem;
|
|
85
195
|
/**
|
|
86
|
-
*
|
|
196
|
+
* Running footer template configuration.
|
|
87
197
|
*/
|
|
88
198
|
footer?: HeaderFooterItem;
|
|
89
199
|
/**
|
|
@@ -93,18 +203,53 @@ interface MarkforgeConfig {
|
|
|
93
203
|
toc?: boolean;
|
|
94
204
|
/**
|
|
95
205
|
* Optional watermark configuration to display across pages.
|
|
96
|
-
*
|
|
206
|
+
* @default false
|
|
97
207
|
*/
|
|
98
208
|
watermark?: string | WatermarkOptions | false;
|
|
209
|
+
/**
|
|
210
|
+
* Path(s) to custom CSS stylesheets to inject into the document.
|
|
211
|
+
*/
|
|
212
|
+
css?: string | string[];
|
|
213
|
+
/**
|
|
214
|
+
* Code syntax highlighting theme.
|
|
215
|
+
* @default "github-dark"
|
|
216
|
+
*/
|
|
217
|
+
syntaxTheme?: "github-dark" | "github-light" | "dracula" | "monokai" | "nord" | SyntaxTheme | (string & {});
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Complete metadata extracted from Markdown frontmatter.
|
|
221
|
+
* Combines document metadata and layout overrides.
|
|
222
|
+
*/
|
|
223
|
+
type FrontmatterMetadata = DocumentMetadata & DocumentLayoutConfig;
|
|
224
|
+
/**
|
|
225
|
+
* Top-level MarkForge configuration (from config file, CLI, or API).
|
|
226
|
+
* Clean, 100% intuitive, and zero-duplicate architecture.
|
|
227
|
+
*/
|
|
228
|
+
interface MarkforgeConfig extends DocumentLayoutConfig {
|
|
229
|
+
/**
|
|
230
|
+
* Target format(s) to compile markdown to.
|
|
231
|
+
* @default ["docx", "pdf"]
|
|
232
|
+
*/
|
|
233
|
+
to?: MarkforgeFormat | MarkforgeFormat[];
|
|
234
|
+
/**
|
|
235
|
+
* Output directory where compiled documents will be saved.
|
|
236
|
+
* Defaults to the same directory as the input file.
|
|
237
|
+
*/
|
|
238
|
+
outputDir?: string;
|
|
239
|
+
/**
|
|
240
|
+
* Default document metadata (title, author, date, etc.) used when not provided in frontmatter.
|
|
241
|
+
*/
|
|
242
|
+
metadata?: DocumentMetadata;
|
|
99
243
|
/**
|
|
100
244
|
* Whether to embed all images (local and remote) directly into the document.
|
|
101
245
|
* @default true
|
|
102
246
|
*/
|
|
103
247
|
embedImages?: boolean;
|
|
104
248
|
/**
|
|
105
|
-
*
|
|
249
|
+
* Whether to generate standalone self-contained HTML bundle.
|
|
250
|
+
* @default true
|
|
106
251
|
*/
|
|
107
|
-
|
|
252
|
+
bundleHtml?: boolean;
|
|
108
253
|
/**
|
|
109
254
|
* Watch files and automatically recompile on changes.
|
|
110
255
|
* @default false
|
|
@@ -125,16 +270,6 @@ interface MarkforgeConfig {
|
|
|
125
270
|
* @default false
|
|
126
271
|
*/
|
|
127
272
|
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
273
|
}
|
|
139
274
|
interface GeneratedOutputFile {
|
|
140
275
|
format: MarkforgeFormat;
|
|
@@ -291,14 +426,11 @@ declare const SYNTAX_COLORS: {
|
|
|
291
426
|
punctuation: string;
|
|
292
427
|
plain: string;
|
|
293
428
|
};
|
|
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[];
|
|
429
|
+
declare function tokenizeCodeLine(line: string, lang?: string, theme?: string): SyntaxToken[];
|
|
298
430
|
/**
|
|
299
431
|
* Converts a code snippet to syntax-highlighted HTML with colored span tokens.
|
|
300
432
|
*/
|
|
301
|
-
declare function highlightCodeToHtml(code: string, lang?: string): string;
|
|
433
|
+
declare function highlightCodeToHtml(code: string, lang?: string, theme?: string): string;
|
|
302
434
|
|
|
303
435
|
/**
|
|
304
436
|
* Renders Mermaid diagram definition into an SVG/PNG buffer for DOCX and HTML embedding.
|
|
@@ -306,14 +438,16 @@ declare function highlightCodeToHtml(code: string, lang?: string): string;
|
|
|
306
438
|
declare function renderMermaidToPng(mermaidCode: string, _baseDir?: string): Promise<Buffer | null>;
|
|
307
439
|
|
|
308
440
|
/**
|
|
309
|
-
*
|
|
441
|
+
* Flagship corporate theme — full design system with Blu-by-BCA-Digital cyan palette.
|
|
310
442
|
*/
|
|
311
|
-
declare const
|
|
443
|
+
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";
|
|
444
|
+
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";
|
|
445
|
+
declare const THEMES: Record<string, string>;
|
|
446
|
+
|
|
312
447
|
/**
|
|
313
|
-
*
|
|
448
|
+
* Resolves theme CSS based on preset name or custom ThemeProps object.
|
|
314
449
|
*/
|
|
315
|
-
declare
|
|
316
|
-
declare const THEMES: Record<string, string>;
|
|
450
|
+
declare function generateThemeCss(theme?: MarkforgeTheme): string;
|
|
317
451
|
|
|
318
452
|
/**
|
|
319
453
|
* Type-safe configuration helper for markforge.config.ts
|
|
@@ -338,12 +472,125 @@ declare function loadConfig(customPath?: string, startDir?: string): Promise<{
|
|
|
338
472
|
configPath: string | null;
|
|
339
473
|
}>;
|
|
340
474
|
|
|
475
|
+
/**
|
|
476
|
+
* Standard paper dimensions in Word Twips (1/20th of a point, 1440 twips = 1 inch).
|
|
477
|
+
*/
|
|
478
|
+
declare const PAPER_DIMENSIONS_TWIP: Record<PaperSize, {
|
|
479
|
+
width: number;
|
|
480
|
+
height: number;
|
|
481
|
+
}>;
|
|
482
|
+
interface NormalizedMargins {
|
|
483
|
+
top: string;
|
|
484
|
+
bottom: string;
|
|
485
|
+
left: string;
|
|
486
|
+
right: string;
|
|
487
|
+
topTwip: number;
|
|
488
|
+
bottomTwip: number;
|
|
489
|
+
leftTwip: number;
|
|
490
|
+
rightTwip: number;
|
|
491
|
+
}
|
|
492
|
+
interface NormalizedWatermark {
|
|
493
|
+
text: string;
|
|
494
|
+
color: string;
|
|
495
|
+
opacity: number;
|
|
496
|
+
fontSize: number;
|
|
497
|
+
rotate: number;
|
|
498
|
+
position: "diagonal" | "center" | "top-right" | "bottom-right";
|
|
499
|
+
}
|
|
500
|
+
interface NormalizedHeaderFooterZone {
|
|
501
|
+
text: string;
|
|
502
|
+
color: string;
|
|
503
|
+
fontSize: number;
|
|
504
|
+
fontFamily: string;
|
|
505
|
+
bold: boolean;
|
|
506
|
+
italic: boolean;
|
|
507
|
+
}
|
|
508
|
+
interface NormalizedHeaderFooter {
|
|
509
|
+
left?: NormalizedHeaderFooterZone;
|
|
510
|
+
center?: NormalizedHeaderFooterZone;
|
|
511
|
+
right?: NormalizedHeaderFooterZone;
|
|
512
|
+
font: string;
|
|
513
|
+
size: number;
|
|
514
|
+
color: string;
|
|
515
|
+
divider: boolean;
|
|
516
|
+
dividerColor: string;
|
|
517
|
+
}
|
|
518
|
+
interface ResolvedDocumentConfig {
|
|
519
|
+
title: string;
|
|
520
|
+
subtitle?: string;
|
|
521
|
+
author?: string;
|
|
522
|
+
date?: string;
|
|
523
|
+
version?: string;
|
|
524
|
+
company?: string;
|
|
525
|
+
lang: string;
|
|
526
|
+
theme: MarkforgeTheme;
|
|
527
|
+
orientation: DocumentOrientation;
|
|
528
|
+
paperSize: PaperSize;
|
|
529
|
+
paperDimensions: {
|
|
530
|
+
widthTwip: number;
|
|
531
|
+
heightTwip: number;
|
|
532
|
+
};
|
|
533
|
+
margins: NormalizedMargins;
|
|
534
|
+
header?: NormalizedHeaderFooter;
|
|
535
|
+
footer?: NormalizedHeaderFooter;
|
|
536
|
+
toc: boolean;
|
|
537
|
+
watermark?: NormalizedWatermark;
|
|
538
|
+
css: string[];
|
|
539
|
+
embedImages: boolean;
|
|
540
|
+
bundleHtml: boolean;
|
|
541
|
+
syntaxTheme: string;
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* Replaces dynamic variables ({title}, {subtitle}, {author}, {version}, {date}, {company}) in text templates.
|
|
545
|
+
*/
|
|
546
|
+
declare function replaceDocumentTokens(template: string | undefined, meta: {
|
|
547
|
+
title?: string;
|
|
548
|
+
subtitle?: string;
|
|
549
|
+
author?: string;
|
|
550
|
+
version?: string;
|
|
551
|
+
date?: string;
|
|
552
|
+
company?: string;
|
|
553
|
+
}): string;
|
|
554
|
+
/**
|
|
555
|
+
* Normalizes watermark configuration into a consistent structured object.
|
|
556
|
+
*/
|
|
557
|
+
declare function normalizeWatermark(rawWatermark?: string | WatermarkOptions | false): NormalizedWatermark | undefined;
|
|
558
|
+
/**
|
|
559
|
+
* Normalizes an individual left, center, or right header/footer zone slot.
|
|
560
|
+
*/
|
|
561
|
+
declare function normalizeHeaderFooterSlot(rawSlot: string | HeaderFooterSlot | undefined, parent: HeaderFooterItem | undefined, meta: {
|
|
562
|
+
title?: string;
|
|
563
|
+
subtitle?: string;
|
|
564
|
+
author?: string;
|
|
565
|
+
version?: string;
|
|
566
|
+
date?: string;
|
|
567
|
+
company?: string;
|
|
568
|
+
}): NormalizedHeaderFooterZone | undefined;
|
|
569
|
+
/**
|
|
570
|
+
* Normalizes a header or footer item into a structured NormalizedHeaderFooter object.
|
|
571
|
+
*/
|
|
572
|
+
declare function normalizeHeaderFooter(raw: HeaderFooterItem | undefined, meta: {
|
|
573
|
+
title?: string;
|
|
574
|
+
subtitle?: string;
|
|
575
|
+
author?: string;
|
|
576
|
+
version?: string;
|
|
577
|
+
date?: string;
|
|
578
|
+
company?: string;
|
|
579
|
+
}): NormalizedHeaderFooter | undefined;
|
|
580
|
+
/**
|
|
581
|
+
* Centralized Single Source of Truth for resolving document configuration.
|
|
582
|
+
* Priority hierarchy: Frontmatter metadata > Project Config File / User Config > DEFAULT_CONFIG
|
|
583
|
+
*/
|
|
584
|
+
declare function resolveDocumentConfig(frontmatter?: Record<string, unknown>, userConfig?: MarkforgeConfig): ResolvedDocumentConfig;
|
|
585
|
+
|
|
341
586
|
/**
|
|
342
587
|
* Dynamically resolved version — reads from the nearest package.json at runtime.
|
|
343
588
|
* Falls back to the hardcoded FALLBACK_VERSION constant if not found.
|
|
344
589
|
*/
|
|
345
590
|
declare const MARKFORGE_VERSION: string;
|
|
346
|
-
/**
|
|
591
|
+
/**
|
|
592
|
+
* Resolves the MarkForge version dynamically from package.json in the specified or current directory.
|
|
593
|
+
*/
|
|
347
594
|
declare function getMarkforgeVersion(fromDir?: string): string;
|
|
348
595
|
|
|
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,
|
|
596
|
+
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 NormalizedWatermark, Orientation, OutputFormat, PAPER_DIMENSIONS_TWIP, type PageMargins, type PaperSize, PaperSizeEnum, type ParsedMarkdownDocument, type ResolvedDocumentConfig, type ResolvedImage, SYNTAX_COLORS, 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, normalizeWatermark, parseInlineSpans, parseMarginToTwip, parseMarkdownDocument, renderInlinesToHtml, renderMermaidToPng, replaceDocumentTokens, resolveDocumentConfig, resolveImage, slugify, tokenizeCodeLine };
|