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

cudoc-export

v0.5.0

Published

Export cudoc documentation as a standalone HTML site, PDF and Word from one collection

Readme

cudoc-export

Add optional HTML, PDF and Word output alongside your documentation host (Next.js, Docusaurus, Nextra, VitePress or Eleventy), reusing its collected content and prepared embeds. All three read one set of design tokens, so they share one appearance. Keep the primary site and document sources unchanged. The generated directory can be deployed or shared as local files, and can also be built without another host.

ESM · Node.js 20+

npm install @cudoment/cudoc cudoc-export
import { buildSite } from "cudoc-export"

const result = buildSite({
  sourceRoot: "docs",
  outDir: "site",
  title: "Product documentation",
  syntax: {},
})

The CLI equivalent is npx cudoc-export build docs --out-dir site. Open site/index.html and share the whole directory. The builder handles collection, embeds, local assets, navigation, TOC and code highlighting. Use a nonexistent output path initially; existing output must be owned by cudoc. The generated shell needs no JavaScript or CDN (unless annotations: true adds the review-note script or themeSwitch: true the theme button's script; both are local files that make no network request), and does not execute React components.

To export alongside an existing site, first run that host's collector and embed preparation, then reuse its library:

buildSite({
  sourceRoot: "docs",
  library: ".cudoc/documents",
  outDir: "shared-html",
  links: "host",
  hostUrl: "https://docs.example.com/project/",
  assetDirs: ["public"],
})

For PDF and Word alongside the site, call buildExport with the same options plus formats and granularity; the bound volume opens with a cover and a contents page, and page sets paper, running header and footer for both formats:

import { buildExport } from "cudoc-export"

await buildExport({
  sourceRoot: "docs",
  outDir: "out",
  formats: ["html", "pdf", "docx"],
  granularity: "both",
  page: { paper: "A4", footer: { center: "{page} / {pages}" } },
  volume: { fileName: "handbook", cover: { image: "design/cover.png" } },
})

The CLI equivalent is npx cudoc-export build docs --out-dir out --format html --format pdf --format docx --granularity both. The PDF is printed from the print-ready HTML the build always writes, by a headless Chromium the package installs; set CUDOC_SKIP_BROWSER_DOWNLOAD=1 to skip that download and npx cudoc-export install-browser to fetch it later.

library reads the collected AST and prepared embeds without recompiling or modifying them. Recollect after edits. Keep syntax/compiler options in the collector, and use separate host and HTML output directories. Add assetDirs for host asset roots such as public or static; use renderOptions.components for explicit HTML rendering of custom component nodes.

Choose links: "relative" (default) for local files, "host" for the primary deployment's collected document routes, or "none" to remove all hyperlinks while preserving labels and formatting. The policy covers body content, embeds, raw HTML, navigation and TOC. Local images and CSS remain local; host keeps external URLs, while none removes those hyperlinks too. CLI equivalents are --library, --links, --host-url and repeatable --asset-dir.

Choose host, cudoc or both independently for headingAnchor, badge, tableCellList, callout and link. The representative callout is > [!NOTE] Title. Authors do not register cudoc React components in the recommended setup. Syntax-only rendering needs no stored JSON; cross-document embedding requires document collection.