Brew

Brew is a simple markup language that represents Magic the Gathering decks. It's inspired by markup languages like Org and Markdown.

Syntax

Metadata

A brew file can begin with zero or more metadata lines. These use %+KEY: VALUE syntax and must appear before the deck definition:

%+format: commander
# Deck Name

Currently the only recognized metadata key is format. Supported values are commander, legacy, modern, pauper, standard, and vintage.

Decks

A brew file contains zero or one decks:

# Deck Name

Groups

A deck can have zero or more groups (e.g. a sideboard):

# Deck Name
## Sideboard

Cards

A deck can contain zero or more cards. At its simplest a card is a quantity followed by a name:

# Deck Name
4 Lightning Bolt

A card always starts with a quantity followed by its name, and both are required.

Card Attributes

Cards can be further specified with optional attributes. These can appear in any order:

# Deck Name
4 Lightning Bolt [AER] *F* #111 @tag1 @tag2
  • Set: [AER] — the set code of the Magic the Gathering set the card is from
  • Finish: *F* for foil or *E* for etched
  • Collector Number: #111 — where the card falls in the set
  • Tag: @tag1 — user-defined tags; can be present multiple times

Structural Editing

Brew is not edited directly. Instead you operate structurally on it. Which is to say that to add a card you wouldn't type in the quantity and a card name by hand. Instead you would move the cursor to where you wanted the card added, and invoke an add card command. You would be prompted for a quantity and card, and then the brew text would get updated.

All that is to say you edit Brew at the level of syntax, and not at the level of characters. The text editor has rich keyboard shortcuts to do this, and an Emacs style minibuffer to prompt for input.

Import/Export

As a text format Brew has many other uses for decks:

  • You can export your decks to back them up.
  • You can export your deck to give it to someone else.
  • You can import another person's deck.