The hackers&wizards document engine: it turns a quote, a timesheet, an agreement, a certificate or a training handout into a PDF in the company's design. The package holds the document base, every document component, composing a component to standalone HTML and rendering it to PDF with headless Chrome. Company OS and the trainer hub install it and keep what fills their documents. Slide decks come from slides.
| You want | Go to |
|---|---|
| to see every document type and component | the catalog, with invented data, each type also as a whole page |
| documents in your repository | Install and Use |
| to change a component or the document base | Work on the package |
| to release a change | Releasing a change in CLAUDE.md |
| someone to ask | the maintainer, Benedikt Stemmildt |
Add it pinned to the newest tag
(git ls-remote --tags https://github.com/hackersandwizards/documents.git lists them); the
install needs no GitHub login:
bun add "git+https://github.com/hackersandwizards/documents.git#v<version>"Pin beside it, each @hackersandwizards package from its Git tag in the form above:
- Astro (
^7.4.4) and Vite (^8.3.5), which compile the components @hackersandwizards/brandv2.17.0 or newer, whose tokens, faces and logos the documents use@hackersandwizards/testimonials, whose marks a page names by package path@hackersandwizards/scaffoldingamong your runtime dependencies:./render-pdfimports its./chromeat run time
Bun only. The TypeScript exports parse HTML with Bun's HTMLRewriter, so under Node,
vitest included, they throw HTMLRewriter is not defined. Call them from a Bun process, and
test their callers with bun test.
Compose a component with its props, then print the page to PDF. Run it from your Astro project's
root: composeDocument compiles the component with that project's Astro.
import { composeDocument, renderPdf } from "@hackersandwizards/documents/render-pdf";
const html = await composeDocument("DocMarkdown", { kind: "Briefing", html: "<h1>Hi</h1>" });
await Bun.write("briefing.html", html);
await renderPdf("briefing.html", "briefing.pdf");The imports, each under @hackersandwizards/documents/:
render-pdf:renderPdf(an HTML file or URL),composeDocument,renderHandoutPdf,bakeDocumentCss,assertBrandFonts,inlineImages,subsetFaces,brandCssdocument.css: the print base;tokens.css: the document tokens, every value a role on the brand's tokenscomponents/<Doc*.astro>: a document component, rendered in your own Astro routecompose:openComposer,composePage,escapeHtmlonepager:composeOnepager,fitOnepager, the onepager and its two-page fit;onepager.css: its own stylesheetsurvey-readout:composeSurveyReadout, the attendee-feedback readout deck;bandColor,scalePosition,STRENGTH_AT, its score bandshandoutandhandout.css:HANDOUT_TEXT, the handout's words per language, and its print stylesheet
Every export and what it does: CLAUDE.md.
Run each with bun run <name>; --help prints its usage.
documents-composewrites one component with its props as standalone HTMLdocuments-privacyfails on private data in the package, and on each term of a deny filedocuments-stylesfails on a style in a document HTML file that the engine did not draw
Requirements: Bun 1.4 or newer, as the gate's admin-check needs, poppler (brew install poppler) for the font and handout checks,
and gitleaks (brew install gitleaks) for the commit hook. Rendering starts Chrome for Testing
and the first render or bun run check installs it into ~/.cache/puppeteer.
bun installinstalls and points the git hooks at.githooks/, which .githooks/README.md listsbun run devserves the catalog athttp://127.0.0.1:4330/bun run checkruns the gate: scaffolding's steps with the catalog build, then this repository'sbun run buildwrites the catalog todist/, never committed; Pages publishes it on every push tomain
A release is a tag v<version> matching package.json. Before its commit, Company OS's privacy
check runs with the real names over this checkout; the tag follows once the push has landed. The
steps: Releasing a change; the rest of the rules: CLAUDE.md.
The repo is public, its history included, so nothing goes in that may not be public. Security issues: SECURITY.md. Licence: PolyForm Strict 1.0.0, see LICENSE.