Encoding of Sz

00001012931000 · Info · (manual) · #api #manual #reference #zettelstore

Zettel in a Sz encoding are represented as a symbolic expression. To process these symbolic expressions, you need to know, how a specific part of a zettel is represented by a symbolic expression.

Basically, each part of a zettel is represented as a list, often a nested list. The first element of that list is always an unique symbol, which denotes that part. The meaning / semantic of all other elements depend on that symbol.


A full zettel is represented by a list of two elements. The first elements represents the metadata, the second element represents the zettel content.

Zettel = ( Metadata Content ).


Metadata is represented by a list, where the first element is the symbol META. Following elements represent each metadatum1 of a zettel in standard order.

Standard order is: Title, Role, Tags, Syntax, all other keys in alphabetic order.

Metadata = (META Metadatum MetadatumMetadatum ).


Zettel content is represented by a block.

Content = Block.


A block is represented by a list with the symbol BLOCK as the first element. All following elements represent a nested block-structured element.

Block = (BLOCK BlockElement BlockElementBlockElement ).


Both block-structured elements and some metadata values may contain inline-structured elements. Similar, inline-structured elements are represented as follows:

Inline = (INLINE InlineElement InlineElementInlineElement ).


Attributes may be specified for both block- and inline- structured elements. Attributes are represented by the following schema. Please note, the the symbol quote is lower-case by intention.

Attribute = ( [ quote ( AttributeKeyValue AttributeKeyValueAttributeKeyValue ) ] ')'.

Either, there are no attributes. These are specified by the empty list (). Or there are attributes. In this case, the first element of the list must be the symbol quote: (quote ( A1 A2 … An )).


A list with UNKNOWN as its first element signals an internal error during transforming a zettel into the Sz encoding. It may be ignored, or it may produce an error.

Unknown = (UNKNOWN Object … ).

The list may only contain the symbol UNKNOWN, or additionally an unlimited amount of other objects.

Similar, any symbol with the pattern **xyz:NOT-FOUND**, where xyz is any string, signals an internal error.

  1. “Metadatum” is used as the singular form of metadata. ↩︎