Anleitung
Tables
Build a table from a list in your data, with fixed column widths, a header on every page and running totals.
Auf dieser Seite
Tables in Markdown
A normal Markdown table works. Put {{#each}} between the rows to repeat a
row for each item:
| Pos. | Leistung | Betrag |
| --- | --- | ---: |
{{#each rechnung.positionen}}
| {{ pos }} | {{ text }} | {{ betrag | money }} |
{{/each}}The | inside {{ betrag | money }} does not start a new column.
The table block
For longer tables, describe the table in the front matter. brevier writes the HTML for you.
---
table:
items: rechnung.positionen
columns:
- field: pos
label: Pos.
width: 1fr
- field: text
label: Leistung
width: 6fr
- field: betrag
label: Betrag
width: 2fr
align: right
format: money
header:
repeat: true
zebra: true
carryOver: true
---The table goes where the body has {{ table }}. Without that tag, it goes
at the end.
| Key | Meaning |
|---|---|
items |
The list in your data. One row per item. |
columns |
One entry per column. |
header.repeat |
Repeat the header row on every page. |
header.style |
A CSS class for the header row. |
zebra |
Shade every second row. |
keepRowTogether |
Never split one row across two pages. |
carryOver |
Print running totals at each page break. |
Each column has these keys:
| Key | Meaning |
|---|---|
field |
The field in each item. |
label |
The header text. Without it, brevier uses the schema's title, then the field name. |
width |
A share like 2fr, or a percentage like 40%. |
align |
left, center or right. |
format |
A formatter, like money or date. |
carryOver |
Add this column to the running total. |
Running totals (Übertrag)
A German invoice that runs over several pages shows the sum so far at each page break. This row is the Übertrag. brevier adds it for you:
- at the bottom of a page, the sum of all rows above
- at the top of the next page, the same sum again
With carryOver: true on the table, every money column carries its sum.
Set carryOver on a column to choose the columns yourself. brevier adds up
with exact decimal numbers, so the cents always match.
