Install the package
The npm package name is@chenglou/pretext.
Import the named exports
prepare and layout are sufficient. For manual rendering, also import prepareWithSegments and one of the line layout functions.
TypeScript support
Pretext ships declaration files automatically as of version0.0.3. No @types/ package or additional configuration is required — TypeScript consumers pick up the types directly from the published package.
ESM-only package
Pretext is an ESM-only package (
"type": "module" in package.json). It is distributed as built JavaScript from dist/layout.js with matching declaration files. CommonJS require() is not supported.import() or configure your build tool to handle ESM dependencies.
Browser environment requirement
Server-side rendering support is planned for a future release. For now, callprepare() in the browser, after fonts have loaded.