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

@usejunior/docx-core

v0.25.0

Published

OOXML (.docx) core library: primitives, document generation, and track changes

Readme

@usejunior/docx-core

OOXML primitives and DOCX generation in TypeScript.

npm Apache 2.0

Install

npm install @usejunior/docx-core

Example

import { writeFile } from 'node:fs/promises';
import { generateDocx } from '@usejunior/docx-core';

const document = await generateDocx({
  sections: [{
    blocks: [{
      kind: 'paragraph',
      runs: [{ kind: 'text', text: 'Hello' }],
    }],
  }],
});

await writeFile('hello.docx', document);

DocumentSpec supports sections, headers and footers, fields, styles, tables, numbering, and comments. The supported runtime uses jszip and @xmldom/xmldom; it does not require Word, LibreOffice, Python, or .NET.

For two-document comparison, use @usejunior/docx-compare. For agent-driven editing, use @usejunior/safe-docx.

See the repository architecture, support contract, and package source and examples.

Bounded table-row editing

DocxDocument.insertTableRow(...) and deleteTableRow(...) edit existing body-level tables in clean or tracked mode. By default they accept only rectangular, unmerged tables with direct rows and cells; the experimental mergeAware: true option also admits validated horizontal gridSpan rows. Vertical merges, row offsets, nested tables, wrapped topology, table-property exceptions, and topology revisions still fail with a typed SafeDocxError.detail. Insertions return fresh paragraph anchors for chaining, and accept/reject resolve the emitted row revisions in body and supported side-story parts. For tracked edits, callers must seed RevisionContext.idState above existing package revision IDs; the MCP session layer performs that scan automatically.

Bounded table-column editing

DocxDocument.insertTableColumn(...) and deleteTableColumn(...) address zero-based logical tblGrid columns. Insertion requires a positive widthTwips and one explicit rowActions entry per row: { kind: 'cell', text } creates a physical cell, while { kind: 'growCell', side: 'left' | 'right' } widens the cell on that side of the boundary. These operations are clean-only and admit simple and horizontal-gridSpan rows. They reject tracked requests, vertical merges, offsets, nested tables, pending topology revisions, and deletion of cells with unresolved revisions. Invalid requests leave the document unchanged and report row/column/cell coordinates in SafeDocxError.detail; successful insertions return paragraph IDs for newly created cells. Column edits preserve live references to unaffected DOM elements.

Bounded table-cell editing

DocxDocument.splitTableCell({ anchorParagraphId, splitColumnIndex, existingSide, newCellText }) splits a horizontally spanning physical cell at the boundary before zero-based logical column splitColumnIndex, retaining its authored content on existingSide and returning the new cell's paragraph anchor. DocxDocument.absorbTableCell({ anchorParagraphId, absorbSide }) removes the anchored physical cell, discards its content, and expands the adjacent cell on absorbSide to cover the vacated grid slots. Neither changes tblGrid or other rows. A bookmark or comment range cut by removal loses its surviving partner endpoint even if that endpoint is in another cell or row. Both operations are clean-only and require direct body-level, non-vertically-merged tables with resolvable affected widths; percentage-width splits and percentage-width absorbing cells fail closed. Pending row/cell topology, revisions in a removed cell, nested tables, offsets, and tracked requests also fail before mutation. These APIs do not perform Word's shift-right/down insertion or shift-left/up deletion; those remain separate work under #1042.