49 lines
1.9 KiB
Markdown
49 lines
1.9 KiB
Markdown
# Reportist
|
|
|
|
Reportist validates and renders structured YAML or JSON reports with Typst. It
|
|
also accepts a Typst plugin that maps another JSON document into the same
|
|
Reportist v1 report dictionary. Every PDF uses `templates/report.typ`.
|
|
|
|
## Render a report
|
|
|
|
```bash
|
|
./render.sh examples/example-report.yaml --output report.pdf
|
|
./render.sh examples/diagnostic-style.yaml --output custom-diagnostic.pdf
|
|
```
|
|
|
|
The second example uses the same sections, finding lists, progress bar, and
|
|
tables available to plugins. Existing output requires `--force`.
|
|
|
|
## Render JSON through a plugin
|
|
|
|
```bash
|
|
./render.sh input.json --plugin /path/to/plugin \
|
|
--plugin-input author='Reviewer Name' --output output.pdf \
|
|
--emit-ir output.report.json
|
|
```
|
|
|
|
The plugin directory contains `plugin.json`, `transform.typ`, and optionally a
|
|
`runtime/` directory. `plugin.json` declares `interface_version: 1`, `name`,
|
|
`input`, `output`, and `transform: "transform.typ"`. Typst imports
|
|
`transform.typ` and calls `transform(data)` with the parsed input JSON. The
|
|
function returns a Reportist v1 dictionary. `--plugin-input KEY=VALUE` is
|
|
available to the transform as `sys.inputs.at("plugin-KEY")`.
|
|
|
|
Reportist writes the returned dictionary as validated JSON in a private stage,
|
|
then uses its normal renderer. `--emit-ir` keeps a copy of this intermediate
|
|
report JSON and a referenced branding logo, if any, so the JSON can be
|
|
rendered again. A plugin can include Typst-readable resources and images in
|
|
`runtime/`; its returned report can reference images there with a path beginning
|
|
`plugin/runtime/`. The same report validation applies to authored and plugin
|
|
outputs. Reportist has no dependency on any specific plugin.
|
|
|
|
## Batch and validation
|
|
|
|
```bash
|
|
bash tools/render-all.sh /path/to/reports --output-dir /path/to/pdfs
|
|
bash tools/validate.sh examples/example-report.yaml
|
|
bash tools/validate-all.sh /path/to/reports
|
|
```
|
|
|
|
See [`docs/report-contract.md`](docs/report-contract.md) for all report fields.
|