Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
}
89 changes: 89 additions & 0 deletions apps/cli/markforge/docs/full-all-properties.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
---
title: "Unified Platform Architecture & Document Suite"
subtitle: "Enterprise Specification & Feature Validation Guide"
author: "Masum RPG"
company: "Masum Dev Technologies"
version: "1.0.0"
date: "2026-08-29"
lang: "en"
---

# Executive Summary

This sample document validates **100% of all properties** supported by **MarkForge Document Engine**:

- **Metadata & Dynamic Tokens**: Title, Subtitle, Author, Date, Version, Company in headers and footers.
- **Table of Contents (TOC)**: Automatically extracted from Markdown heading hierarchy.
- **Watermark Engine**: Custom angle, opacity, font size, and color.
- **Syntax Highlighting**: Theme-aware tokenizer applied to multi-language code snippets.
- **Visual Callouts**: GitHub-style alert callouts rendered with border and background styling.
- **Tables & Typography**: Formatted tables with text alignment.

---

# Architecture Pipeline

MarkForge transforms Markdown directly into professional Word documents, print-ready PDFs, and responsive web pages.

```mermaid
graph LR
MD["Markdown (.md)"] --> AST["MarkForge AST"]
AST --> DOCX["DOCX Document"]
AST --> PDF["Chromium PDF Engine"]
AST --> HTML["Self-Contained HTML"]
```

---

# Multi-Language Code Blocks

The code blocks below are styled according to the configured `syntaxTheme`:

```typescript
import { compileMarkdown } from "@masumdev/markforge";

export async function generateReleaseNotes(): Promise<void> {
const result = await compileMarkdown({
content: "# Release v1.0.0\n\nAll features verified.",
config: {
to: ["docx", "pdf", "html"],
theme: "corporate",
syntaxTheme: "dracula",
},
});
console.log(`Generated ${result.files.length} output files.`);
}
```

```python
import os

def check_environment():
api_key = os.getenv("API_KEY")
if not api_key:
raise ValueError("Missing API key configuration")
return {"status": "ready", "env": "production"}
```

---

# Callout Verifications

> [!NOTE]
> All running header tokens (`{title}`, `{author}`, `{version}`) are evaluated dynamically at compile time.

> [!TIP]
> Use `--watch` flag during local authoring for instant live updates.

> [!IMPORTANT]
> Both Word Twips and CSS `@page` dimensions are accurately synchronized.

---

# Benchmark Metrics

| Pipeline Component | Target Output | Processing Time | Quality Level |
| :--- | :--- | :---: | :---: |
| Native DOCX Packager | `sample.docx` | 45ms | Pixel-Perfect Word Layout |
| Headless Chromium | `sample.pdf` | 650ms | 300 DPI Vector PDF |
| HTML5 Bundler | `sample.html` | 18ms | Single Self-Contained File |
118 changes: 118 additions & 0 deletions apps/cli/markforge/markforge.full-config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
import {
defineConfig,
OutputFormat,
Theme,
Orientation,
PaperSizeEnum,
SyntaxTheme,
WatermarkPosition,
} from "@masumdev/markforge";

/**
* MarkForge Complete Specification Configuration Sample
* Demonstrates 100% of all configurable properties in MarkforgeConfig with full Enum autocompletion.
*/
export default defineConfig({
// Target output formats (using OutputFormat enum or strings)
to: [OutputFormat.DOCX, OutputFormat.PDF, OutputFormat.HTML],

// Output directory
outputDir: ".temp/output-full-spec",

// Visual document theme (using Theme.CORPORATE preset or a custom ThemeProps object)
theme: Theme.CORPORATE,

// Page orientation (using Orientation enum or strings)
orientation: Orientation.PORTRAIT,

// Standard paper size (using PaperSizeEnum or strings)
paperSize: PaperSizeEnum.A4,

// Page margins with CSS unit or pt numbers
margins: {
top: "3cm",
bottom: "2.5cm",
left: "2.5cm",
right: "2.5cm",
},

// Document running headers with dynamic variable substitution & per-zone slot styling
header: {
// Left slot: Can be a plain string template OR a rich HeaderFooterSlot object
left: {
text: "{company}",
color: "#0D998D",
fontSize: 9,
fontFamily: "Inter, Segoe UI, sans-serif",
bold: true,
},
// Center slot: Plain string template using default header styles
center: "Internal",
// Right slot: Custom colored and italicized version tag
right: {
text: "v{version}",
color: "#94A3B8",
fontSize: 8.5,
italic: true,
},
// Horizontal separator line under header
divider: false,
},

// Document running footers with dynamic page numbering & per-zone slot styling
footer: {
// Left slot: Author metadata token
left: {
text: "Author: {author}",
color: "#64748B",
fontSize: 8.5,
},
// Center slot: Document generation date token
center: {
text: "{date}",
color: "#94A3B8",
fontSize: 8.5,
italic: true,
},
// Right slot: Dynamic page numbering token with custom brand color
right: {
text: "Page {page} of {pages}",
color: "#0D998D",
fontSize: 9,
bold: true,
},
// Horizontal separator line above footer
divider: false,
},

// Automatic Table of Contents generation
toc: true,

// Watermark configuration (using WatermarkPosition enum or strings)
watermark: {
text: "CONFIDENTIAL DRAFT",
color: "#E11D48",
opacity: 0.1,
fontSize: 52,
rotate: -45,
position: WatermarkPosition.DIAGONAL,
},

// Code block syntax highlighting theme (using SyntaxTheme enum or strings)
syntaxTheme: SyntaxTheme.DRACULA,

// Assets and bundling flags
embedImages: true,
bundleHtml: true,

// Fallback metadata dictionary
metadata: {
title: "Complete MarkForge Reference Manual",
subtitle: "Enterprise Document Compiler & Visual Architecture",
author: "Masum RPG",
company: "Masum Dev Technologies",
version: "1.0.0",
date: "2026-08-29",
lang: "en",
},
});
3 changes: 2 additions & 1 deletion apps/cli/markforge/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
"private": true,
"type": "module",
"scripts": {
"test:all": "bun run test:ts && bun run test:json && bun run test:yaml && bun run test:rc && bun run test:auto",
"test:all": "bun run test:ts && bun run test:json && bun run test:yaml && bun run test:rc && bun run test:full-spec && bun run test:auto",
"test:ts": "bun ../../../packages/markforge/dist/cli.mjs ./docs/sample.md -c ./markforge.config.ts",
"test:json": "bun ../../../packages/markforge/dist/cli.mjs ./docs/sample.md -c ./markforge.config.json",
"test:yaml": "bun ../../../packages/markforge/dist/cli.mjs ./docs/sample.md -c ./markforge.config.yaml",
"test:rc": "bun ../../../packages/markforge/dist/cli.mjs ./docs/sample.md -c ./.markforgerc",
"test:full-spec": "bun ../../../packages/markforge/dist/cli.mjs ./docs/full-all-properties.md -c ./markforge.full-config.ts",
"test:auto": "bun ../../../packages/markforge/dist/cli.mjs ./docs/sample.md",
"build:sample": "bun ../../../packages/markforge/dist/cli.mjs ./docs/sample.md --to docx,pdf,html -o .temp/output",
"build:spec": "bun ../../../packages/markforge/dist/cli.mjs ./docs/full-specification.md --to docx,pdf,html -o .temp/output",
Expand Down
12 changes: 12 additions & 0 deletions apps/docs/src/content/docs/markforge/changelog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@ sidebar:
description: Release history and version notes for @masumdev/markforge.
---

## [0.2.4] - 2026-08-29

### 🚀 Features & Enhancements

- **Granular Header & Footer Slot Customization (`HeaderFooterSlot`)**: Each running header and footer zone (`left`, `center`, `right`) can now be individually styled with custom `color`, `fontSize` (in points), `fontFamily`, `bold`, and `italic`. Fully implemented across DOCX TextRuns and PDF CSS Paged Media (`@top-*` and `@bottom-*`).
- **Flagship `Theme.CORPORATE` Preset & `ThemeProps` Interface**: Simplified built-in themes to `Theme.CORPORATE` while providing the typed `ThemeProps` interface for total custom document theming (`backgroundColor`, `textColor`, `primaryColor`, `fontFamily`, `fontMono`, `customCss`).
- **TypeScript Enums**: Full autocompletion and type-safety with `OutputFormat`, `Theme`, `Orientation`, `PaperSizeEnum`, `SyntaxTheme`, and `WatermarkPosition`.
- **Background-Layered Watermark**: Watermarks are positioned strictly at the background layer (`z-index: 0`) under content to avoid obscuring tables, text, or images.
- **Enterprise Windows Sandboxing**: Headless Chromium runner is sandboxed with `--disable-sync`, isolated temp directory, and zero Google network requests, prioritizing `msedge.exe` on Windows.

---

## [0.2.3] - 2026-08-28

### 🛠️ Fixed
Expand Down
Loading
Loading