SlideForge

Reference

Node.js API

Typed ESM functions for parsing, rendering, previewing, exporting, and validating presentations.

Functions

Import from ./dist/index.js after building the repository.

Public functions
FunctionPurpose
parsePresentationValidate input and return typed data, or throw
renderPresentationReturn a complete HTML document
previewPresentationStart a loopback Vite server for a JSON file
exportPresentationExport JSON, HTML, or a URL to PPTX and return layout issues
validateLayout ยท validatePptxBrowser layout checks and offline PPTX structure checks

Example

Save this as example.mjs in the repository root and run node example.mjs.

import { readFile } from 'node:fs/promises';
import { exportPresentation, validatePptx } from './dist/index.js';

const issues = await exportPresentation('examples/basic/presentation.json', {
  output: 'presentation.pptx',
});
console.log(issues);

const report = validatePptx(await readFile('presentation.pptx'));
if (!report.valid) process.exitCode = 1;

Export options

Options for exportPresentation(input, options). Failures throw; returned issues are layout diagnostics.

Export options
OptionDefaultMeaning
outputRequiredOutput PPTX path
selector[data-pptx="slide"], .slideSlide elements in document order
metadataFrom the documenttitle, author, subject, and lang overrides
validatetrueLayout errors block export; false still collects issues
timeout60000Playwright timeout in milliseconds
textSlack{ ratio: 0.06, min: 91440, max: 457200 }Extra text box width in EMU; false keeps converter sizes
eastAsianFontMicrosoft JhengHeiPowerPoint East Asian font for CJK text