npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@kaos-intelligence/idml

v0.1.0

Published

Parse Adobe InDesign IDML packages into a fully-typed document model — stories, spreads, styles cascade, reading order, assets, and EPUB 3.3 semantic mapping.

Readme

@kaos-intelligence/idml

Parse Adobe InDesign IDML packages into a fully-typed document model.

IDML (InDesign Markup Language) is InDesign's interchange format: a ZIP of XML files describing everything in a document — text stories, page spreads, master spreads, the paragraph/character style cascade, linked assets, and the XML backing story. This parser unzips the package, parses every part, and returns one resolved IDMLDocument ready to be mapped into an EPUB (or any other target).

What it extracts

  • Stories — Stories/Story_*.xml: text content as paragraphs and runs
  • Spreads — Spreads/Spread_*.xml: page geometry, page items, anchored objects
  • Master spreads — MasterSpreads/MasterSpread_*.xml: templates
  • Style cascade — Resources/Styles.xml: resolved paragraph/character styles
  • Backing story — XML/BackingStory.xml: semantic structure (when present)
  • Reading order — resolved from the backing story, with a geometric spread-order fallback
  • Assets — linked images from Links/ and fonts from Resources/Fonts.xml
  • CSS — generated from the resolved styles (points → em, configurable base)
  • EPUB semantic mapping — InDesign styles → XHTML elements, epub:type, and ARIA roles

Install

npm install @kaos-intelligence/idml-parser

Requires Node.js ≥ 20.

Usage

import { parseIDML } from '@kaos-intelligence/idml-parser';

const doc = await parseIDML('/abs/path/to/book.idml');

console.log(doc.meta.title, doc.meta.pageWidth, 'x', doc.meta.pageHeight);
console.log('stories:', doc.stories.length);
console.log('spreads:', doc.spreads.length);
console.log('styles:', doc.styles.length);
console.log('assets:', doc.assets.length);
console.log('reading order nodes:', doc.readingOrder.length);
console.log(doc.css); // generated stylesheet (when styles were resolved)

parseIDML(idmlPath) runs the full pipeline: container → designmap → stories → spreads → masters → backing story → styles → fonts → assets → reading order → CSS, and returns the assembled IDMLDocument.

Lower-level helpers are also exported for custom pipelines:

import {
  generateCss,
  mapStyleToEpub,
  resolveReadingOrder,
  parseFonts,
  extractAssets,
} from '@kaos-intelligence/idml-parser';

// CSS from resolved styles (base font size in pt, default 12)
const css = generateCss({ styles: doc.styles, baseFontSizePt: 12 });

// Map one resolved style to its EPUB equivalent:
// { styleId, styleName, element, className?, epubType?, role? }
const mapping = mapStyleToEpub(doc.styles[0]);

// Re-resolve reading order with custom options
const order = resolveReadingOrder({
  backingStory: doc.backingStory,
  spreads: doc.spreads,
  stories: doc.stories,
  emitPageBreaks: true, // default
});

All model types (IDMLDocument, Story, Spread, MasterSpread, Paragraph, Run, PageItem, AnchoredObject, ResolvedStyle, IdmlAsset, ReadingOrderNode, BackingStory, …) are exported from the package root and from @kaos-intelligence/idml-parser/types.

Development

pnpm build       # tsc → dist/
pnpm test        # vitest run
pnpm typecheck   # tsc --noEmit

License

MIT © 2026 kaOS Intelligence Inc. See LICENSE.