Anleitung

Templates

Write a template in Markdown or in HTML, and choose the CSS that styles it.

Auf dieser Seite

Markdown or HTML

brevier reads two kinds of template. Both use the same {{ }} tags.

Format Good for File
Markdown letters, simple invoices, text with a few tables rechnung.md
HTML full control: several header rows, grids, custom blocks rechnung.html

Start in Markdown. When you need more control, turn it into HTML with brevier eject (see below) and keep working there.

Front matter

A Markdown template can start with a YAML block between two --- lines. brevier reads its settings from there.

angebot.md
---
theme: print-base
style: angebot.css
page:
  size: A4
---

Text of the document …
Key Meaning
theme A built-in theme to use: print-base or web.
style A CSS file next to the template.
page Paper size, margins, headers and footers. See Page layout.
table A table built from a list in your data. See Tables.

An HTML template has no front matter. It names its theme in a <meta> tag inside <head>:

<meta name="brevier-theme" content="print-base">

For its own CSS, put a file with the same name next to it: rechnung.css next to rechnung.html.

Which CSS applies

brevier looks for CSS in this order. The first match wins.

  1. --theme and --style on the command line
  2. theme and style in the front matter
  3. a CSS file with the template's name: rechnung.css next to rechnung.md

The theme comes first, and your own stylesheet comes after it. So your rules win over the theme's rules. You can pass --style more than once; a later file wins over an earlier one.

Built-in themes

Theme Use
print-base Plain rules for printed pages. The default for new templates.
web Styles for --format html output shown in a web page.

Eject a Markdown template

eject writes the HTML that a Markdown template compiles to:

brevier eject rechnung.md

This creates rechnung.html next to the Markdown file. It stops if the file exists already; add --force to replace it.

Eject is a one-way step. After it, you edit the HTML file, and the Markdown file is no longer used.