New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

@stll/docx-core

Package Overview
Dependencies
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stll/docx-core

Typed OOXML/DOCX model, validation, serialization, legal-source compilation, and browser-native package projection.

Source
npmnpm
Version
0.40.0
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

@stll/docx-core

A typed OOXML/DOCX document model with parsing, validation, and serialization.

The package exposes a structured document model (paragraphs, runs, tables, styles, section properties) together with the tools to produce and check DOCX packages, plus a legal-source compiler that turns a legal draft (GFM markdown plus @ directives) into that model or a finished DOCX file, and a plain markdown reader (compileMarkdownToContent) that shares its parser.

import { compileLegalSourceToDocx, validateDocxPackage } from "@stll/docx-core";

const { docx } = await compileLegalSourceToDocx(source);
const result = await validateDocxPackage(docx);

The document model types are also available from a dedicated subpath:

import type { Document, Paragraph, Run } from "@stll/docx-core/model";

Install

bun add @stll/docx-core

Exports

  • . — the document model types, the legal-source compiler (parseLegalSource, compileLegalSourceToDocument, compileLegalSourceToDocx, validateLegalDraft), the markdown reader (compileMarkdownToContent, sanitizeExternalUrl), DOCX serialization (serializeDocumentToDocx), and validation (validateDocxPackage, validateDocumentModel, assertValidDocumentModel).
  • ./model — the document model types only.
  • ./ops — document operations over the model: applyDocumentOp and applyDocumentOps apply text and formatting edits addressed by paragraph id and offset, and return the new document, the blocks it touched and its exact inverse (operations addressed the same way), or a typed refusal. With a revision stamp, the text, formatting and paragraph operations record their edit as tracked changes instead, and resolveRevision accepts or rejects tracked changes by revision id. planTrackedDeletion plans a tracked deletion around the author's own insertions and comment anchors, and revisionIdDemand counts the new revision ids an operation takes. normalizeForOps and validateOpsDocument establish and check the contract a document meets before operations apply to it; toOpEnvelope wraps an operation with its schema version for journaling. validateDocumentBatch, parseDocumentBatch and validateSequencedBatch decode bounded batch envelopes. transformBatch, createSequencer and createClient provide conservative rebasing, idempotent in-memory sequencing and optimistic pending queues (see operation batches).

License

Apache-2.0

Keywords

document-model

FAQs

Package last updated on 28 Oct 2026

Related posts