title: Syntax of Metadata
role: manual
tags: #manual #syntax #zettelstore
syntax: zmk
back: 00001006000000 00001006020000 00001006031500 00001007701000 00001007702000 00001012053200 00001012054200
backward: 00001006000000 00001006020000 00001006031500 00001007701000 00001007702000 00001012053200 00001012054200
box-number: 1
copyright: (c) 2020-present by Detlef Stern <ds@zettelstore.de>
created: 20210126175322
lang: en
license: EUPL-1.2-or-later
modified: 20251212134036
published: 20251212134036
visibility: public

The metadata of a zettel is a collection of key-value pairs.
The syntax roughly resembles the internal header of an email ([RFC5322](https://datatracker.ietf.org/doc/html/rfc5322)).

The key is a sequence of alphanumeric characters, a hyphen-minus character (&ldquo;`-`&rdquo;, U+002D) is also allowed.
It begins at the first position of a new line.
Uppercase letters of a key are translated to their lowercase equivalents.

A key is separated from its value either by

* a colon character (&ldquo;`:`&rdquo;),
* a non-empty sequence of space characters,
* a sequence of space characters, followed by a colon, followed by a sequence of space characters.

A value is a sequence of printable characters.
If the value should be continued in the following line, that following line (&ldquo;continuation line&rdquo;) must begin with a non-empty sequence of space characters.
The rest of the following line will be interpreted as the next part of the value.
There can be more than one continuation line for a value.

A non-continuation line that contains a possibly empty sequence of characters, followed by the percent sign character (&ldquo;`%`&rdquo;) is treated as a comment line.
It will be ignored.

Parsing metadata ends, if an empty line is found or if a line with at least three hyphen-minus characters is found.

Some examples:

    title1:The Title
     title-2 : Another title
    title-3: A wrapped
     title
    title-4: A
     wrapped
     title
     with
     more
     than
     one
      continuation
     line
    % A comment line
     % Another comment line.
    No metadata anymore, because of the empty line.