Render
Render
The render command turns a Trilogy markdown report into an image or an HTML file. Embedded ```trilogy code blocks are executed: chart statements become charts, select statements become tables.
This is how you produce a report whose numbers and charts are generated from live queries rather than pasted in by hand - rerun it and the figures update.
Requires pytrilogy[report] extras.
Usage
trilogy render <input> [options]
Arguments
| Argument | Description |
|---|---|
input | Path to the Trilogy markdown report. |
Options
| Option | Description |
|---|---|
--to [html|png] | Output format for the rendered report. |
--theme [editorial|inter] | Visual theme (font and colors). |
-o, --out PATH | Output file path. Defaults to the input path with the format's extension. |
Full Examples
# Render to HTML next to the source
trilogy render report.md --to html
# Render to a PNG image
trilogy render report.md --to png
# Pick a theme and an explicit destination
trilogy render report.md --to png --theme editorial -o out/summary.png
Report Format
A report is ordinary markdown with Trilogy blocks in it. Each block runs against the model and its result is substituted in place:
# Weekly Sales
Revenue held steady across regions this week.
```trilogy
import raw.orders as orders;
select orders.region, sum(orders.amount) as revenue
order by revenue desc;
```
A select renders as a table; a chart statement renders as a chart. Run trilogy agent-info report for the full report format reference.
Notes
- Requires the report extras:
pip install "pytrilogy[report]", which brings in altair, markdown, and playwright - PNG rendering drives a headless browser, so the first run may need
playwright install - Because blocks execute at render time, a report doubles as a test that the queries still work