Skip to content

Usage & Features Guide

CLI Commands

Basic Compilation

Terminal window
# Compile to DOCX + PDF (default formats)
markforge document.md
# Specify target output formats and destination directory
markforge specification.md --to docx,pdf,html --output ./dist
# Use a theme with custom CSS overlay
markforge report.md --theme corporate --css ./styles/custom.css
# Force Table of Contents + watch mode
markforge guide.md --toc --watch
# Start interactive live-reload preview server on port 3000
markforge document.md --serve 3000 --open

Complete CLI Options Reference

FlagAliasDescriptionDefault
<file>Markdown input file pathRequired
--to <formats...>-tComma-separated: docx, pdf, html, pngdocx,pdf
--output <dir>-oTarget directory for generated filesInput file directory
--config <file>-cExplicit configuration file pathAuto-detected
--theme <name>Built-in theme (corporate, default, academic, github, minimal)corporate
--css <files...>Custom CSS file(s) to injectundefined
--orientation <type>Page orientation (portrait, landscape)portrait
--paper-size <size>Standard paper size (A4, Letter, Legal, A3, A5)A4
--tocForce Table of Contents generationfalse
--watermark <text>Document watermark textundefined
--syntax-theme <theme>Code syntax highlighting themegithub-dark
--watch-wWatch input file and recompile on changefalse
--serve [port]-sStart interactive live-reload preview serverfalse
--open-OAutomatically open browser on previewfalse
--version-VPrint version and exit
--help-hShow 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]
:::col
Column 1
:::
:::col
Column 2
:::
:::col
Column 3
:::
:::

4. Interactive Live-Reload Preview Server

Launch a local development preview server with Server-Sent Events (SSE) live reloading and scroll preservation:

Terminal window
markforge document.md --serve 3000 --open

Features:

  • 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 (&#8617;). 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 directly
const 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 server
const server = await startPreviewServer({
filePath: "./specification.md",
port: 3000,
open: false,
});
console.log(`Preview server active at ${server.url}`);
// Close server when finished
await server.close();