Usage & Features Guide
CLI Commands
Basic Compilation
# Compile to DOCX + PDF (default formats)markforge document.md
# Specify target output formats and destination directorymarkforge specification.md --to docx,pdf,html --output ./dist
# Use a theme with custom CSS overlaymarkforge report.md --theme corporate --css ./styles/custom.css
# Force Table of Contents + watch modemarkforge guide.md --toc --watch
# Start interactive live-reload preview server on port 3000markforge document.md --serve 3000 --openComplete CLI Options Reference
| Flag | Alias | Description | Default |
|---|---|---|---|
<file> | Markdown input file path | Required | |
--to <formats...> | -t | Comma-separated: docx, pdf, html, png | docx,pdf |
--output <dir> | -o | Target directory for generated files | Input file directory |
--config <file> | -c | Explicit configuration file path | Auto-detected |
--theme <name> | Built-in theme (corporate, default, academic, github, minimal) | corporate | |
--css <files...> | Custom CSS file(s) to inject | undefined | |
--orientation <type> | Page orientation (portrait, landscape) | portrait | |
--paper-size <size> | Standard paper size (A4, Letter, Legal, A3, A5) | A4 | |
--toc | Force Table of Contents generation | false | |
--watermark <text> | Document watermark text | undefined | |
--syntax-theme <theme> | Code syntax highlighting theme | github-dark | |
--watch | -w | Watch input file and recompile on change | false |
--serve [port] | -s | Start interactive live-reload preview server | false |
--open | -O | Automatically open browser on preview | false |
--version | -V | Print version and exit | |
--help | -h | Show help screen |
Enterprise Features Guide
1. Cover Page Builder
MarkForge includes an enterprise Cover Page Builder that generates isolated, unnumbered first pages across HTML, PDF, and DOCX formats:
---title: "Quarterly Financial Analysis"subtitle: "FY2026 Strategy & Growth Projections"author: "Ma'sum"company: "Enterprise Global Holdings"version: "1.0.0"date: "2026-08-29"coverPage: enabled: true preset: "modern" badge: "CONFIDENTIAL" badgeColor: "#ECFDFD" badgeTextColor: "#0D998D" logo: "./assets/brand-logo.png" logoWidth: 160 footerText: "Proprietary & Confidential - Authorized Distribution Only"---Available Presets
modern: Accent colored top bar with uppercase badge, high-contrast title, and metadata table.corporate-split: Left vertical colored brand panel with clean white content panel on the right.minimal: Elegant centered typography with clean borders and subtle metadata lines.card: Centered glassmorphic card container with rounded corners and elevated shadow styling.
2. Math & LaTeX Equation Rendering
MarkForge provides native, standalone KaTeX math rendering with inlined CSS for HTML/PDF and Cambria Math typography in Microsoft Word DOCX:
- Inline Math: Enclose equations in single dollar signs:
$E = mc^2$or$\nabla \cdot \mathbf{B} = 0$. - Block Math: Enclose multi-line equations in double dollar signs:
$$\frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$$
$$\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}$$3. Multi-Column Container Directives
Create multi-column responsive grid layouts inside standard Markdown using :::columns and :::col container directives:
:::columns 2:::col### Cloud Infrastructure- Edge API Gateways with Anycast routing- Automated horizontal auto-scaling- Multi-region failover database clusters::::::col### Observability & Security- Real-time Prometheus metrics pipeline- Distributed tracing with OpenTelemetry- Strict zero-trust mTLS encryption::::::Custom column gaps and column counts:
:::columns [cols=3 gap=2rem]:::colColumn 1::::::colColumn 2::::::colColumn 3::::::4. Interactive Live-Reload Preview Server
Launch a local development preview server with Server-Sent Events (SSE) live reloading and scroll preservation:
markforge document.md --serve 3000 --openFeatures:
- Instant Hot-Reload: Automatically detects changes to Markdown source, configuration files, and custom CSS.
- Scroll Preservation: Keeps your exact reading position when saving edits in your code editor.
- Modern Workbench UI: Clean Blu-by-BCA cyan corporate interface (
#0D998D,#33CDCF,#0F172A) with quick print and open in new tab buttons.
5. Hierarchical Section Numbering
Automatically generates hierarchical decimal numbers for document headings (1., 1.1., 1.1.1.) and synchronizes them with the Table of Contents:
---numberHeadings: enabled: true depth: 3 skipH1: false prefix: ""---6. Footnotes & Endnotes
Add standard academic footnotes and citations using [^1] reference identifiers and [^1]: Note text bottom definitions:
Modern web services rely on distributed consensus algorithms[^raft] to ensure data consistency[^cap].
[^raft]: Ongaro, D., & Ousterhout, J. (2014). In Search of an Understandable Consensus Algorithm.[^cap]: Brewer, E. A. (2000). Towards robust distributed systems.In HTML and PDF, footnotes are rendered at the bottom with return jump links (↩). In Microsoft Word DOCX, footnotes are rendered with dedicated superscript numbering.
7. PDF Security & Document Metadata
Configure PDF encryption, passwords, and permission flags:
---title: "Restricted Enterprise Blueprint"author: "Ma'sum"security: userPassword: "user123" ownerPassword: "admin_secret_key" permissions: printing: "highResolution" copying: false modifying: false annotating: true---8. Back Cover & Closing Page
Generate an isolated, branded final closing page with company contact cards and copyright disclosures:
---title: "Project Alpha Final Proposal"author: "Ma'sum"company: "Masum Dev Technologies"backCover: enabled: true preset: "corporate" title: "Thank You" subtitle: "We look forward to transforming digital experiences together." email: "contact@masumdev.com" phone: "+62 812 3456 7890" address: "Jakarta, Indonesia" website: "https://masumdev.com" social: github: "https://github.com/masumrpg" copyright: "Copyright (c) {year} {company}. All Rights Reserved."---Programmatic TypeScript API
import { compileMarkdown, parseMarkdown, buildHtmlDocument, buildDocxDocument, buildPdfDocument, startPreviewServer, renderMathToHtml,} from "@masumdev/markforge";
// 1. Compile Markdown file directlyconst result = await compileMarkdown("./specification.md", { to: ["docx", "pdf", "html"], outputDir: "./dist", theme: "corporate", coverPage: { enabled: true, preset: "modern", badge: "CONFIDENTIAL", }, numberHeadings: { enabled: true, depth: 3, },});
console.log(`Generated ${result.files.length} output files in ${result.durationMs}ms`);
// 2. Start programmatic preview serverconst server = await startPreviewServer({ filePath: "./specification.md", port: 3000, open: false,});
console.log(`Preview server active at ${server.url}`);
// Close server when finishedawait server.close();