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
387 changes: 316 additions & 71 deletions apps/cli/markforge/docs/full-all-properties.md

Large diffs are not rendered by default.

42 changes: 22 additions & 20 deletions apps/cli/markforge/markforge.full-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,24 +138,24 @@ export default defineConfig({
math: true,

// PDF Document Security & Password Encryption
security: {
userPassword: "masumdev_secret", // Password required to open document
ownerPassword: "masumdev_admin", // Master password required to modify permissions
permissions: {
printing: "highResolution", // "highResolution" | "lowResolution" | false
modifying: false,
copying: true,
annotating: true,
fillingForms: true,
contentAccessibility: true,
documentAssembly: false,
},
},
// security: {
// userPassword: "masumdev_secret", // Password required to open document
// ownerPassword: "masumdev_admin", // Master password required to modify permissions
// permissions: {
// printing: "highResolution", // "highResolution" | "lowResolution" | false
// modifying: false,
// copying: true,
// annotating: true,
// fillingForms: true,
// contentAccessibility: true,
// documentAssembly: false,
// },
// },
// security: undefined, // Omit or leave undefined for unrestricted standard PDF

// Watermark configuration (using WatermarkPosition enum or strings)
watermark: {
text: "CONFIDENTIAL DRAFT",
text: "{metakuda}",
color: "#E11D48",
opacity: 0.1,
fontSize: 52,
Expand Down Expand Up @@ -211,14 +211,15 @@ export default defineConfig({
company: "{company}",
address: "Jakarta, Indonesia",
email: "contact@masumdev.com",
phone: "+62 812 3456 7890",
// phone: "+62 812 3456 7890",
website: "https://react-native-library-docs.netlify.app",
social: {
github: "https://github.com/masumrpg",
// twitter: "https://x.com/masumdev",
// linkedin: "https://linkedin.com/in/masumdev",
},
// social: {
// github: "https://github.com/masumrpg",
// // twitter: "https://x.com/masumdev",
// // linkedin: "https://linkedin.com/in/masumdev",
// },
copyright: "Copyright (c) {year} {company}. All Rights Reserved.",
// bgGradient: "#fff",
},
// backCover: false, // Set to false to disable back cover closing page

Expand All @@ -231,6 +232,7 @@ export default defineConfig({
version: "1.0.0",
date: "2026-08-29",
lang: "en",
metakuda: "Kuda"
},

// Custom external stylesheet path(s) to inject into HTML and PDF documents
Expand Down
32 changes: 32 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,38 @@ sidebar:
description: Release history and version notes for @masumdev/markforge.
---

## [0.4.1] - 2026-08-30

### Enhancements, Security, CLI, and Configuration Refinements

- **Watermark Suppression on Front & Back Covers**:
- Excluded the vector/PNG watermark overlay from both the Front Cover Page (page 0) and the Back Cover Closing Page (final page) in PDF generation.
- Suppressed the HTML fixed canvas watermark in print media (`@media print { .document-watermark { display: none !important; } }`) to ensure only explicit `pdf-lib` page indexing controls watermark rendering.
- **Symmetric & Unified Cover & Back Cover Styling Configuration**:
- Unified configuration property names across `CoverPageConfig` and `BackCoverConfig` for complete API consistency.
- Added support for `backgroundColor`, `bgGradient`, `textColor`, `titleColor`, `subtitleColor`, `accentColor`, `badge`, `badgeColor`, `badgeTextColor`, `logo`, `logoWidth`, `footerText`, `copyright`, `address`, `email`, `phone`, `website`, and `social` across front and back covers in HTML, PDF, and DOCX.
- **Heading Color Harmonization (`h1` through `h6`)**:
- Unified all heading levels (`h1`, `h2`, `h3`, `h4`, `h5`, `h6`) to use brand primary dark styling (`var(--mf-primary-dark)`) across HTML, PDF, and DOCX for visual consistency.
- `h1`: 2.5px solid primary border underline; `h2`: 1px subtle teal border underline.
- **Strict Package.json Version Resolution**:
- Removed fallback version constant in `version.ts`. The engine now resolves version strictly from the nearest `@masumdev/markforge` `package.json` at runtime and throws an explicit error if missing or unreadable.
- **Comprehensive Terminal CLI Parameter & Configuration Banner**:
- Ink CLI header box and Live Preview banner (`--serve`) now display all resolved configuration details: source path, config path, visual theme, syntax highlighter, layout, output directory, and active module list (TOC, Numbering, Cover, BackCover, Watermark, Security, Math, Syntax).
- **Arbitrary Dynamic Metadata & Nested Record Token Interpolation**:
- Enhanced `replaceDocumentTokens` to dynamically unpack and replace tokens defined in top-level `metadata` or nested `metadata` dictionaries (e.g. `{metakuda}` or `{custom_key}`).
- Fixed AST parser inline text chunking to merge adjacent plain text spans, ensuring token names containing underscores (`_`) or hyphens are not split across separate tokens.
- **Table of Contents (TOC) Page Break Isolation**:
- Table of Contents is now fully isolated from subsequent document body content via `page-break-after: always; break-after: page;` in PDF/HTML and a dedicated section break in Microsoft Word DOCX.
- **Academic & Enterprise Page Numbering Schema**:
- Front Cover: Unnumbered, running headers/footers suppressed.
- Table of Contents: Formal lowercase Roman numerals (`i`, `ii`, ...).
- Main Document Body: Counter reset (`counter-reset: page 1;`) with standard decimal numbers (`1, 2, ...`).
- Back Cover: Unnumbered, isolated final closing section.
- **Config-Driven Section Numbering (`numberHeadings`)**:
- Propagated top-level configuration options (`numberHeadings: { enabled, depth, skipH1, prefix }`) directly into AST parsing and compilation across HTML, PDF, and DOCX.

---

## [0.4.0] - 2026-08-29

### Major Enterprise Features & Security Release
Expand Down
20 changes: 16 additions & 4 deletions apps/docs/src/content/docs/markforge/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ numberHeadings: {

### Cover Page Builder (`coverPage`)

Generates a dedicated, unnumbered title page before the main document content:
Generates a dedicated, unnumbered title page before the main document content with full custom styling support:

```typescript
coverPage: {
Expand All @@ -326,14 +326,20 @@ coverPage: {
badgeColor: "#ECFDFD", // Badge background color
badgeTextColor: "#0D998D", // Badge text color
footerText: "Strictly Confidential", // Bottom disclaimer text
backgroundColor: "#0A192F", // Optional custom background color
bgGradient: "linear-gradient(135deg, #0A192F 0%, #172A45 100%)", // Custom CSS gradient
titleColor: "#FFFFFF", // Custom title color
subtitleColor: "#64FFDA", // Custom subtitle color
textColor: "#8892B0", // Custom text color
accentColor: "#64FFDA", // Custom accent color
}
```

---

### Back Cover / Closing Page (`backCover`)

Generates an isolated closing back cover card at the end of the document:
Generates an isolated closing back cover card at the end of the document with symmetric styling properties matching `coverPage`:

```typescript
backCover: {
Expand All @@ -352,6 +358,12 @@ backCover: {
github: "https://github.com/masumrpg",
},
copyright: "Copyright (c) {year} {company}. All Rights Reserved.",
backgroundColor: "#0A192F", // Custom background color
bgGradient: "linear-gradient(135deg, #0A192F 0%, #172A45 100%)", // Custom gradient
titleColor: "#FFFFFF", // Custom title color
subtitleColor: "#64FFDA", // Custom subtitle color
textColor: "#8892B0", // Custom text color
accentColor: "#64FFDA", // Custom accent color
}
```

Expand Down Expand Up @@ -399,12 +411,12 @@ watermark: {

---

### Signatures & Approval Block (`signatureBlock`)
### Signatures & Approval Block (`signatures`)

Appends a formal multi-signatory approval grid to the document:

```typescript
signatureBlock: {
signatures: {
align: SignatureAlign.SPACE_BETWEEN, // "left" | "center" | "right" | "space-between"
style: SignatureStyle.BOX, // "line" | "box" | "clean"
spacingBefore: "2.5cm",
Expand Down
4 changes: 2 additions & 2 deletions packages/markforge/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ export default defineConfig({
},

// Document signatures and approval block
signatureBlock: {
signatures: {
align: SignatureAlign.SPACE_BETWEEN,
style: SignatureStyle.BOX,
spacingBefore: "2.5cm",
Expand Down Expand Up @@ -303,7 +303,7 @@ export default defineConfig({
| `numberHeadings` | `boolean \| object` | `false` | Automated hierarchical decimal numbering for headings (`1.`, `1.1.`, etc.) |
| `coverPage` | `boolean \| object` | `false` | Isolated front cover page builder with presets and company logo |
| `backCover` | `boolean \| object` | `false` | Isolated closing back cover page builder with corporate contact info |
| `signatureBlock` | `object` | `undefined` | Formal multi-signatory approval and signing block |
| `signatures` | `object` | `undefined` | Formal multi-signatory approval and signing block |
| `math` | `boolean` | `false` | KaTeX LaTeX math equation rendering (`$inline$` and `$$block$$`) |
| `security` | `object` | `undefined` | ISO 32000-2 AES-256 PDF encryption, user/owner passwords, and permissions |
| `watermark` | `string \| object` | `undefined` | 100% unselectable diagonal watermark configuration |
Expand Down
2 changes: 1 addition & 1 deletion packages/markforge/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@masumdev/markforge",
"version": "0.4.0",
"version": "0.4.1",
"description": "Modern, high-performance Markdown & MDX multi-format document publishing engine and CLI (DOCX, PDF, HTML, and Images) with embedded HTML/CSS, image inliner, and Ink terminal UI.",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
Expand Down
16 changes: 13 additions & 3 deletions packages/markforge/src/cli.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ async function main() {
const { loadConfig } = await import("./config/loadConfig.js");

// Load config (auto-discover starting from input file's dir or explicit -c path)
const { config: fileConfig } = await loadConfig(
const { config: fileConfig, configPath } = await loadConfig(
options.config as string | undefined,
path.dirname(resolvedInputPath)
);
Expand Down Expand Up @@ -107,11 +107,20 @@ async function main() {
config: mergedConfig,
});

const themeLabel =
typeof mergedConfig.theme === "object" ? "Custom (ThemeProps)" : String(mergedConfig.theme || "corporate");

console.log(`\n======================================================`);
console.log(` MarkForge Live Reload Preview Server`);
console.log(` MarkForge Live Reload Preview Server v${MARKFORGE_VERSION}`);
console.log(`======================================================`);
console.log(` Target File : ${resolvedInputPath}`);
console.log(` Config File : ${configPath || "(default auto-discovery)"}`);
console.log(` Theme : ${themeLabel} | Syntax: ${mergedConfig.syntaxTheme || "github-dark"}`);
console.log(` Layout : ${mergedConfig.paperSize || "A4"} (${mergedConfig.orientation || "portrait"})`);
console.log(` Server URL : ${instance.url}`);
console.log(` Author : Ma'sum (https://github.com/masumrpg)`);
console.log(` Auto-Open : ${Boolean(options.open) ? "Enabled" : "Disabled"}`);
console.log(` Author : Ma'sum (@masumrpg)`);
console.log(` GitHub : https://github.com/masumrpg`);
console.log(`======================================================\n`);
console.log(`[READY] Watching for markdown and style changes. Press Ctrl+C to exit.\n`);
return;
Expand All @@ -127,6 +136,7 @@ async function main() {
<App
inputFile={resolvedInputPath}
config={mergedConfig}
configPath={configPath}
onComplete={(res) => {
if (res.errors && res.errors.length > 0) {
process.exitCode = 1;
Expand Down
Loading
Loading