@masumdev/markforge 0.2.5 → 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.
@@ -32,7 +32,7 @@ try {
32
32
  }
33
33
  } catch {
34
34
  }
35
- var FALLBACK_VERSION = "0.2.2";
35
+ var FALLBACK_VERSION = "0.3.0";
36
36
  function readVersionFromPackageJson(fromDir) {
37
37
  let currentDir = fromDir;
38
38
  for (let i = 0; i < 6; i++) {
package/dist/cli.mjs CHANGED
@@ -9,7 +9,7 @@ try {
9
9
  } catch {}
10
10
  import {
11
11
  MARKFORGE_VERSION
12
- } from "./chunk-NGC2ZAWZ.mjs";
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-GNRUPFM7.mjs"),
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
@@ -165,6 +165,79 @@ interface DocumentMetadata {
165
165
  coverPage?: boolean;
166
166
  [key: string]: unknown;
167
167
  }
168
+ type SignatureAlign = "left" | "center" | "right" | "space-between";
169
+ type SignatureStyle = "line" | "box" | "clean";
170
+ interface SignatureItem {
171
+ /**
172
+ * Title or sign-off label above signature (e.g. "Prepared by", "Approved by", "Acknowledged by").
173
+ */
174
+ title?: string;
175
+ /**
176
+ * Signatory person name (supports metadata tokens like {author}, {company}).
177
+ */
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
+ }
168
241
  /**
169
242
  * Document visual & layout options (theme, orientation, margins, headers, footers, etc.).
170
243
  */
@@ -201,6 +274,11 @@ interface DocumentLayoutConfig {
201
274
  * @default false
202
275
  */
203
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[];
204
282
  /**
205
283
  * Optional watermark configuration to display across pages.
206
284
  * @default false
@@ -454,12 +532,13 @@ declare function generateThemeCss(theme?: MarkforgeTheme): string;
454
532
  */
455
533
  declare function defineConfig(config: MarkforgeConfig): MarkforgeConfig;
456
534
 
457
- 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">> & {
458
536
  outputDir?: string;
459
537
  css?: string | string[];
460
538
  margins?: MarkforgeConfig["margins"];
461
539
  header?: MarkforgeConfig["header"];
462
540
  footer?: MarkforgeConfig["footer"];
541
+ signatures?: MarkforgeConfig["signatures"];
463
542
  watermark?: string;
464
543
  metadata?: MarkforgeConfig["metadata"];
465
544
  syntaxTheme?: string;
@@ -515,6 +594,25 @@ interface NormalizedHeaderFooter {
515
594
  divider: boolean;
516
595
  dividerColor: string;
517
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
+ }
518
616
  interface ResolvedDocumentConfig {
519
617
  title: string;
520
618
  subtitle?: string;
@@ -534,6 +632,7 @@ interface ResolvedDocumentConfig {
534
632
  header?: NormalizedHeaderFooter;
535
633
  footer?: NormalizedHeaderFooter;
536
634
  toc: boolean;
635
+ signatures?: NormalizedSignatureBlock;
537
636
  watermark?: NormalizedWatermark;
538
637
  css: string[];
539
638
  embedImages: boolean;
@@ -577,6 +676,10 @@ declare function normalizeHeaderFooter(raw: HeaderFooterItem | undefined, meta:
577
676
  date?: string;
578
677
  company?: string;
579
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;
580
683
  /**
581
684
  * Centralized Single Source of Truth for resolving document configuration.
582
685
  * Priority hierarchy: Frontmatter metadata > Project Config File / User Config > DEFAULT_CONFIG
@@ -593,4 +696,4 @@ declare const MARKFORGE_VERSION: string;
593
696
  */
594
697
  declare function getMarkforgeVersion(fromDir?: string): string;
595
698
 
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 };
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 };
package/dist/index.d.ts CHANGED
@@ -165,6 +165,79 @@ interface DocumentMetadata {
165
165
  coverPage?: boolean;
166
166
  [key: string]: unknown;
167
167
  }
168
+ type SignatureAlign = "left" | "center" | "right" | "space-between";
169
+ type SignatureStyle = "line" | "box" | "clean";
170
+ interface SignatureItem {
171
+ /**
172
+ * Title or sign-off label above signature (e.g. "Prepared by", "Approved by", "Acknowledged by").
173
+ */
174
+ title?: string;
175
+ /**
176
+ * Signatory person name (supports metadata tokens like {author}, {company}).
177
+ */
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
+ }
168
241
  /**
169
242
  * Document visual & layout options (theme, orientation, margins, headers, footers, etc.).
170
243
  */
@@ -201,6 +274,11 @@ interface DocumentLayoutConfig {
201
274
  * @default false
202
275
  */
203
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[];
204
282
  /**
205
283
  * Optional watermark configuration to display across pages.
206
284
  * @default false
@@ -454,12 +532,13 @@ declare function generateThemeCss(theme?: MarkforgeTheme): string;
454
532
  */
455
533
  declare function defineConfig(config: MarkforgeConfig): MarkforgeConfig;
456
534
 
457
- 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">> & {
458
536
  outputDir?: string;
459
537
  css?: string | string[];
460
538
  margins?: MarkforgeConfig["margins"];
461
539
  header?: MarkforgeConfig["header"];
462
540
  footer?: MarkforgeConfig["footer"];
541
+ signatures?: MarkforgeConfig["signatures"];
463
542
  watermark?: string;
464
543
  metadata?: MarkforgeConfig["metadata"];
465
544
  syntaxTheme?: string;
@@ -515,6 +594,25 @@ interface NormalizedHeaderFooter {
515
594
  divider: boolean;
516
595
  dividerColor: string;
517
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
+ }
518
616
  interface ResolvedDocumentConfig {
519
617
  title: string;
520
618
  subtitle?: string;
@@ -534,6 +632,7 @@ interface ResolvedDocumentConfig {
534
632
  header?: NormalizedHeaderFooter;
535
633
  footer?: NormalizedHeaderFooter;
536
634
  toc: boolean;
635
+ signatures?: NormalizedSignatureBlock;
537
636
  watermark?: NormalizedWatermark;
538
637
  css: string[];
539
638
  embedImages: boolean;
@@ -577,6 +676,10 @@ declare function normalizeHeaderFooter(raw: HeaderFooterItem | undefined, meta:
577
676
  date?: string;
578
677
  company?: string;
579
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;
580
683
  /**
581
684
  * Centralized Single Source of Truth for resolving document configuration.
582
685
  * Priority hierarchy: Frontmatter metadata > Project Config File / User Config > DEFAULT_CONFIG
@@ -593,4 +696,4 @@ declare const MARKFORGE_VERSION: string;
593
696
  */
594
697
  declare function getMarkforgeVersion(fromDir?: string): string;
595
698
 
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 };
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 };