@masumdev/markforge 0.2.2 → 0.2.4

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.
package/README.md CHANGED
@@ -165,43 +165,133 @@ footer:
165
165
 
166
166
  ---
167
167
 
168
- ## ⚙️ Configuration (`markforge.config.ts`)
168
+ ## ⚙️ Configuration Reference
169
+
170
+ MarkForge automatically discovers configuration files starting from the input file's directory up to the workspace root, or via the `-c, --config <path>` CLI flag.
171
+
172
+ ### 1. TypeScript (`markforge.config.ts`)
169
173
 
170
174
  ```typescript
171
175
  import { defineConfig } from "@masumdev/markforge";
172
176
 
173
177
  export default defineConfig({
178
+ // Output formats: "docx" | "pdf" | "html"
174
179
  to: ["docx", "pdf", "html"],
175
180
  outputDir: "./dist/documents",
176
- theme: "default",
177
- orientation: "portrait",
178
- paperSize: "A4",
181
+
182
+ // Theme: "default" | "academic" | "github" | "corporate" | "minimal" | "dracula"
183
+ theme: "academic",
184
+
185
+ // Custom CSS stylesheet(s) to inject
186
+ css: ["./styles/custom.css"],
187
+
188
+ // Page layout & dimensions
189
+ orientation: "portrait", // "portrait" | "landscape"
190
+ paperSize: "A4", // "A4" | "Letter" | "Legal" | "A3" | "A5"
179
191
  margins: {
180
192
  top: "2.5cm",
181
193
  bottom: "2.5cm",
182
194
  left: "3cm",
183
195
  right: "3cm",
184
196
  },
197
+
198
+ // Multi-zone header & footer (supports tokens: {title}, {author}, {version}, {date}, {page}, {pages})
185
199
  header: {
186
- left: "My Organization",
200
+ left: "Enterprise Architecture",
187
201
  center: "{title}",
188
202
  right: "v{version}",
189
203
  },
190
204
  footer: {
191
- left: "Confidential",
205
+ left: "Confidential — Internal Use Only",
192
206
  right: "Page {page} of {pages}",
193
207
  },
194
- toc: true,
195
- embedImages: true,
196
- watermark: {
197
- enabled: false, // disabled by default enable to add branding
198
- text: "DRAFT",
199
- opacity: 0.07,
200
- position: "diagonal",
208
+
209
+ // Document features
210
+ toc: true, // Auto-generate Table of Contents
211
+ embedImages: true, // Embed/inline all images as Base64 data URIs
212
+ bundleHtml: true, // Self-contained HTML with embedded styles and scripts
213
+ syntaxTheme: "github-dark", // "github-dark" | "github-light" | "dracula" | "monokai" | "nord"
214
+
215
+ // Diagonal page watermark
216
+ watermark: "CONFIDENTIAL",
217
+
218
+ // Default document metadata
219
+ metadata: {
220
+ title: "System Architecture Specification",
221
+ author: "Ma'sum",
222
+ version: "1.0.0",
223
+ company: "My Organization",
201
224
  },
225
+
226
+ // Server & watch options
227
+ watch: false,
228
+ serve: false,
229
+ port: 4000,
230
+ open: false,
202
231
  });
203
232
  ```
204
233
 
234
+ ### 2. JSON with `$schema` (`markforge.config.json`)
235
+
236
+ Adding `$schema` enables **instant autocompletion and validation** in VS Code, WebStorm, and other IDEs:
237
+
238
+ ```json
239
+ {
240
+ "$schema": "https://raw.githubusercontent.com/masumdev/react-native-library/main/packages/markforge/schema.json",
241
+ "to": ["docx", "pdf", "html"],
242
+ "outputDir": "./dist/documents",
243
+ "theme": "academic",
244
+ "orientation": "portrait",
245
+ "paperSize": "A4",
246
+ "margins": {
247
+ "top": "2.5cm",
248
+ "bottom": "2.5cm",
249
+ "left": "3cm",
250
+ "right": "3cm"
251
+ },
252
+ "header": {
253
+ "left": "Enterprise Architecture",
254
+ "right": "{title}"
255
+ },
256
+ "footer": {
257
+ "left": "Confidential",
258
+ "right": "Page {page} of {pages}"
259
+ },
260
+ "toc": true,
261
+ "embedImages": true,
262
+ "syntaxTheme": "github-dark",
263
+ "watermark": "CONFIDENTIAL"
264
+ }
265
+ ```
266
+
267
+ ### 3. YAML (`markforge.config.yaml` / `.markforgerc.yaml`)
268
+
269
+ ```yaml
270
+ to:
271
+ - docx
272
+ - pdf
273
+ - html
274
+ outputDir: ./dist/documents
275
+ theme: academic
276
+ orientation: portrait
277
+ paperSize: A4
278
+ margins:
279
+ top: 2.5cm
280
+ bottom: 2.5cm
281
+ left: 3cm
282
+ right: 3cm
283
+ header:
284
+ left: Enterprise Architecture
285
+ right: "{title}"
286
+ footer:
287
+ left: Confidential
288
+ right: "Page {page} of {pages}"
289
+ toc: true
290
+ embedImages: true
291
+ watermark: CONFIDENTIAL
292
+ ```
293
+
294
+
205
295
  ---
206
296
 
207
297
  ## 💻 Programmatic API