Typst Package

Cmash Typst — Feature Overview

The compilation engine: turns templates into print-ready PDF, PNG and SVG — with fonts, snippets, batches and PDF/X-4 finishing.


What Is Cmash Typst?

Cmash Typst compiles Typst templates into finished documents. It injects brand data and user input, resolves assets and fonts, and keeps a complete history of every compilation. It also provides the font library and the reusable snippet library, and can produce print-ready PDF/X-4 output.


Key Features

Compilation

  • Output formats — PDF, PNG, SVG.
  • Preview compilation — SVG, single or all pages, for editors without saving a record.
  • Full compilations — with status (pending, compiling, completed, failed), duration, error log and downloadable output.
  • Clean build per run — every compilation works in its own temporary directory.
  • Data injection — brand variables, form values and structured data are handed to the template.
  • Package export — export the compiled source with its resources.
  • Diagnostics — errors are captured per compilation.

Batches

  • Compile many items at once — a batch tracks total, completed and failed items and total duration, is linked to a project and renderer, and can be downloaded as one assembled PDF (pages are merged with qpdf).

PDF/X-4 for Print

  • Finishing — Typst produces the PDF; qpdf then stamps the OutputIntent, page boxes and XMP identification, followed by a preflight whose result is shown per compilation.
  • Consistent colour — the printing condition comes from the asset variant type used by the renderer; an explicit override profile can be set on the renderer and is always recorded in the report.
  • Non-destructive — nothing is colour-converted or flattened by this step.
  • Alternative backends — pstill and Ghostscript can be enabled.

Fonts

  • Font library — upload font files, set family, style (normal/italic) and weight (100–900), and generate a specimen preview.
  • Multilingual names are supported.

Snippets

  • Reusable Typst code — categories: Layout, Typography, Table, Chart, Header/Footer, Utility, Other.
  • Automatic availability — active snippets are available in every compilation as snippets/<slug>.typ; the shared cmash.typ library is available alongside.
  • Blueprint snippets are seeded.

Integrations & API

Filament resources in the Typst navigation group: Compilations, Compilation Batches, Fonts, Snippets. REST API (Sanctum):

Endpoint Description
/typst/fonts Fonts
/typst/snippets Snippets
/typst/compilations Compilations

Permissions & Dependencies

  • Requires PHP ^8.3, ext-zip, Filament ^5, Sanctum, spatie/laravel-translatable and CMAsh packages cmash, cmash-asset, cmash-userasset, cmash-brandkit, cmash-datadefinition, cmash-template, cmash-code-editor.
  • Server binaries — the typst binary and, for PDF/X and batches, qpdf (optional: pstill or Ghostscript).
  • Uses cmash-addons.local_packages_path from the platform for local Typst packages.
  • No package-specific roles or permissions.

Configuration

Config file: config/cmash-typst.php

Key Environment variable Default Meaning
binary TYPST_BINARY typst Path/name of the Typst executable.
timeout TYPST_TIMEOUT 60 Max seconds for one compilation.
batch_output_timeout CMASH_BATCH_OUTPUT_TIMEOUT 120 Max seconds for assembling a batch (qpdf page merge).
pdfx.backend CMASH_PDFX_BACKEND qpdf PDF/X finishing backend: qpdf, pstill, ghostscript. No automatic fallback.
pdfx.qpdf_binary QPDF_BINARY (or CMASH_QPDF_BINARY) qpdf qpdf executable.
pdfx.qpdf_timeout QPDF_TIMEOUT 120 qpdf timeout in seconds.
pdfx.pstill_binary PSTILL_BINARY (or CMASH_PSTILL_BINARY) pstill64 pStill executable.
pdfx.pstill_enabled CMASH_PDFX_PSTILL_ENABLED false Enable the pStill backend.
pdfx.ghostscript_binary GS_BINARY (or CMASH_PDFX_GHOSTSCRIPT_BINARY) gs Ghostscript executable.
pdfx.ghostscript_enabled CMASH_PDFX_GHOSTSCRIPT_ENABLED false Enable the Ghostscript backend.

Use Cases

  • Print-ready production — PDF/X-4 output with preflight results per compilation.
  • Live previews — SVG preview compilation while editing templates.
  • Mass production — compile a batch of personalised documents and download one merged PDF.
  • Brand typography — manage the font library centrally.
  • Reusable building blocks — share headers, tables and charts as snippets across templates.

Cmash Typst: from template to print-ready output.