Skip to content

dft render

Render a face to SVG, HTML, PNG, PDF, JSON, YAML, or terminal output.

dft render [OPTIONS] FACE

Use "-" as the FACE argument to read YAML from stdin — useful for AI agents and shell pipelines that don't want to write a temp file.

Arguments

Argument Description
FACE Path to face YAML file, or "-" to read YAML from stdin. (required)

Options

Flag Description
--output PATH Output file path. Default: face name with extension. Use "-" to write to stdout.
--format TEXT Output format: svg, html, png, pdf, terminal, json, text, yaml. Default: svg.
--project-dir PATH Project directory for resolving relative paths.
--var KEY=VALUE Variable value (repeatable).
--no-cache Bypass all query caches and re-run from scratch.
--json-errors Emit errors as JSON to stdout instead of Rich panels. Success-path output is still controlled by --format.

Output formats

Format Purpose
svg (default) Scalable vector graphics — embedding, presentations
html Interactive HTML page with embedded charts
png Raster image — screenshots, thumbnails
pdf PDF document — reports, printing
terminal ASCII/Unicode charts printed to stdout
json Post-execution resolved layout + data
text Plain text rendering
yaml Compiled face YAML

Examples

Static export

dft render faces/sales.yml                         # → faces/sales.svg
dft render faces/sales.yml --format html
dft render faces/sales.yml --format png
dft render faces/sales.yml --format pdf
dft render faces/sales.yml --output sales.svg

Variables

dft render faces/sales.yml \
  --var region=West \
  --var category=Electronics

Terminal preview

dft render faces/sales.yml --format terminal
================================================================================
 Sales Dashboard
================================================================================

Daily Revenue Trend
      ┌────────────────────────────────────────────────────────────┐
2400.0┤    ▗                ▟                                 ▗    │
2141.7┤   ▄▀▖              ▞ ▚               ▞▖              ▄▀▖   │
...

Terminal format writes directly to stdout. Use shell redirection to save:

dft render faces/sales.yml --format terminal > dashboard.txt

Reading YAML from stdin

dft render - --format terminal --project-dir . <<'EOF'
charts:
  revenue:
    query:
      type: csv
      file: data/sales.csv
    type: bar
    x: region
    y: revenue
rows:
  - revenue
EOF
echo 'charts: {c: {query: {type: csv, file: data.csv}}}
rows: [c]' | dft render - --format terminal
cat generated_dashboard.yml | dft render - --output - > output.svg

--project-dir controls where relative file paths (CSVs, etc.) are resolved from when reading stdin. Defaults to cwd.

CI artifact generation

for face in faces/*.yml; do
  dft render "$face" \
    --format html \
    --output "dist/$(basename "$face" .yml).html"
done

Inspect resolved layout for debugging

dft render faces/sales.yml --format json > sales_resolved.json

Caching

By default, dft render reuses cached query results. Pass --no-cache to force re-execution from scratch.

Error output

For programmatic consumers (agents, CI), --json-errors emits machine-readable errors to stdout instead of formatted Rich panels:

dft render faces/sales.yml --json-errors --format svg

The success-path output (the SVG, HTML, etc.) is still controlled by --format; only error paths change shape.

  • dft serve — interactive preview with auto-reload
  • dft validate — pre-render validation
  • dft query — inspect one named query without rendering the whole face
  • dft check — sub-second structural validation