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

@openthesis/docx-renderer

v0.1.0

Published

Template-driven DOCX renderer — converts structured JSON content into submission-ready .docx using a parsed style template

Readme

@openthesis/docx-renderer

Template-Driven DOCX Renderer — convert structured JSON content into submission-ready .docx files.

What it does

  template.json  +  content.json
        │               │
        └───────┬───────┘
                ▼
         docx-renderer
         (dolanmiu/docx)
                │
                ▼
          output.docx

Key Features

  • Template-driven — all formatting (fonts, sizes, margins, spacing) from parsed template
  • Block dispatcher pattern — extensible content block → DOCX element routing
  • Complete table formatting — gridlines, header shading, column widths
  • Headers/footers/page numbers — configurable
  • Three document types — thesis (学位论文), journal (期刊), official document (公文)
  • Backward compatible — supports legacy {cover_blocks, body_blocks} JSON format

Install

npm install @openthesis/docx-renderer

Usage

import { renderDocument, createUSTBTemplate } from '@openthesis/docx-renderer';
import type { ThesisDocument } from '@openthesis/document-schema';

const template = createUSTBTemplate(); // or load from parsed template.json

const doc: ThesisDocument = {
  type: 'thesis',
  meta: { title: 'My Thesis' },
  cover: [
    { type: 'centered_text', text: 'XX大学', font_size_pt: 26, bold: true },
    { type: 'page_break' },
  ],
  sections: [
    {
      id: 'intro',
      type: 'chapter',
      title: 'Introduction',
      content: [
        { type: 'paragraph', text: 'This is the introduction...' },
      ],
    },
  ],
};

const buffer = await renderDocument({
  outputPath: 'output.docx',
  template,
  document: doc,
});

Supported Content Blocks

| Block Type | Description | |-----------|-------------| | heading1heading4 | Section headings | | paragraph / paragraph_no_indent | Body text | | centered_text | Cover page titles | | equation / equation_numbered | LaTeX equations | | figure | Image with caption | | table | Data table with caption | | red_header | 公文红色发文机关标志 | | document_number | 发文字号 | | recipient_line | 主送/抄送机关 | | signature_block | 发文机关署名+日期 | | attachment_note | 附件说明 | | spacer / page_break / horizontal_rule | Layout |

Related

License

MIT