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

@x12i/reportix-composer-core

v0.6.0

Published

Reportix Composer rendering engine: HTML, PDF, DOCX, and PPTX export plus template store.

Downloads

287

Readme

@x12i/reportix-composer-core

The rendering engine and template store behind Reportix Composer. Every other surface (CLI, API, MCP server, UIs) is a thin wrapper around this package.

Install

npm install @x12i/reportix-composer-core

PDF export uses Playwright Chromium. Install the browser once after adding this package:

npx playwright install chromium

Quick start

import {
  renderToHtml,
  renderToPdf,
  renderToDocx,
  renderToPptx,
  TemplateStore,
  createTemplateFromImage,
  shutdown
} from "@x12i/reportix-composer-core";

const markdown = "# Quarterly report\n\nHello {{data.name}}.";

const { html, title } = await renderToHtml(markdown, "clean-report", {
  data: { name: "world" }
});
const pdfBuffer = await renderToPdf(markdown, "clean-report", { data: { name: "world" } });
const docxBuffer = await renderToDocx(markdown, "clean-report", { data: { name: "world" } });
const pptxBuffer = await renderToPptx(markdown, "clean-report", { data: { name: "world" } }); // landscape 16:9; H1 = new slide

const store = new TemplateStore();
await store.list();
await store.get("clean-report");
await store.createFromHtml({
  id: "my-report",
  name: "My Report",
  layoutHtml: "<!doctype html><html><head></head><body><!--CONTENT--></body></html>",
  stylesCss: "body { font-family: Georgia, serif; }"
});

// Optional: draft a template from a design screenshot (requires Anthropic API key)
await createTemplateFromImage({
  id: "from-design",
  name: "From Design",
  imageBuffer,
  imageMediaType: "image/png",
  anthropicApiKey: process.env.ANTHROPIC_API_KEY!
});

// Always close the headless browser when finished
await shutdown();

renderToHtml / renderToPdf / renderToDocx / renderToPptx all take (markdown, templateId, options?), where options can override templatesDir / assetsDir, supply frontmatterOverrides, or override PDF page settings (options.pdf).

PPTX slides are always landscape 16:9. Each # heading starts a new slide; an optional title slide is added when a document title is present.

Image assets

AssetStore registers reusable images under ~/.reportix-composer/assets (override with REPORTIX_COMPOSER_ASSETS_DIR or assetsDir). Reference them in Markdown or frontmatter as {{image:<token>}}; the renderers resolve tokens to data: URIs before format-specific output.

How templates work

A template is a directory with template.json, layout.html, and styles.css. Built-ins ship read-only inside @x12i/reportix-composer-templates. User-created templates live in a writable directory (default ~/.reportix-composer/templates, overridable via REPORTIX_COMPOSER_TEMPLATES_DIR or templatesDir). Create / update / delete only touch that directory, never the built-ins.

CSS is injected by replacing the template's </head> tag, so every layout.html must contain one.

Manifests include format-specific configs: docx (Word styles/page) and pptx (slide size/fonts/styles).

Environment variables

| Variable | Purpose | | --- | --- | | REPORTIX_COMPOSER_TEMPLATES_DIR | Override user templates directory | | REPORTIX_COMPOSER_ASSETS_DIR | Override image assets directory | | ANTHROPIC_API_KEY | Used by createTemplateFromImage when no key is passed inline |

Known limitations

  • PDF/HTML images: absolute http(s) URLs, data URIs, or {{image:<token>}} asset references.
  • DOCX / PPTX images: local paths, URLs, data URIs, and asset tokens; failures become [image: alt] placeholders.
  • DOCX / PPTX code blocks: monospace paragraphs with shading — no syntax highlighting.
  • DOCX fonts: must be names Word can resolve locally.
  • PPTX overflow: content under a single H1 is not auto-split across slides.
  • theme vs docx.styles / pptx.styles: not kept in sync automatically after creation.
  • Raw HTML in markdown: passed through for HTML/PDF; dropped for DOCX and PPTX.

Related packages