Skip to main content
hatchmark render turns a dashboard, or one block of it, into a PNG: a chart to drop into a chat, a doc or a slide, or a whole page to attach to a report. The picture is the built page drawn by a real browser, so it has the same fonts, colours and layout a reader sees at that width and theme. Like every command it never asks questions and prints one line of JSON when an agent runs it.

Options

A whole page is as tall as its content; the window height does not matter.

Filters

--filter takes the same id and value as the dashboard’s query parameter in the page URL, so --filter period=last_30_days renders what /explorer/?period=last_30_days shows. The id is the filter’s id in the dashboard file (see Dashboards). A browser silently falls back to the default for a value it does not know. Render refuses it instead, with HM0002 and the values the filter accepts, so an agent can correct the call. Filters that are not set keep their defaults. The theme is always --theme: theme is the page’s own URL parameter, and no filter may use it as its id (HM2050).

Output

Human output names the file and its size in pixels. JSON output has the diagnostic report fields, with any warnings from the build, plus:
path is relative to --cwd when the file is inside it. block is present only with --block.

What it does

  1. Loads and checks the project, then runs the dashboard’s queries the way hatchmark build does, reusing results from the build cache. Errors stop it before anything is drawn, with the same diagnostics and exit codes as build.
  2. Renders the page build would write, with the same runtime and fonts, and serves it to the browser from memory. Nothing is written to outDir.
  3. Opens the page at the width, scale and theme, applies the filters as the page does on load, waits for the fonts and for filters that redraw the page, and saves the screenshot.

The browser

Render needs a Chromium-based browser and looks for one in this order:
  1. The executable HATCHMARK_BROWSER names, such as a Chrome or Chromium binary. If it does not start, render stops with HM0011 rather than trying another browser.
  2. The Chromium headless shell in Playwright’s browser cache, when it is already there (~/Library/Caches/ms-playwright on macOS, ~/.cache/ms-playwright on Linux, or PLAYWRIGHT_BROWSERS_PATH).
  3. An installed Google Chrome, then Microsoft Edge.
On most machines Chrome or Edge is already installed, and render downloads nothing. When none is found it exits 3 with HM0011. Rerun with --install-browser to download the Chromium headless shell once, about 106 MB on macOS and 132 MB on Linux. Render never downloads without that flag. A browser draws pages, and Hatchmark pages are HTML and CSS around SVG charts. That is why render uses one rather than an SVG rasterizer: a rasterizer can draw a chart’s SVG but not the KPI cards, tables, page grid or filter controls around it, so its pictures would not match the page. Driving the browser adds about 14 MB to the install (playwright-core, with no browser inside).

Accuracy

The test suite renders pages and cards with filters, themes and widths from 390 to 1440 pixels, and compares each PNG with a screenshot of the page build wrote, opened in the same browser. This is done twice, with the Chromium headless shell and with a full Chrome build through HATCHMARK_BROWSER. The PNG must have exactly the browser’s size, and at most 0.1% of its pixels may differ by more than 24 of 255 on any colour channel. In practice none do. Different browser builds draw text slightly differently, and on Linux the headless shell and full Chrome place glyphs a fraction of a pixel apart. To match a particular browser exactly, point HATCHMARK_BROWSER at it.

Exit codes