dalet/specification/daletl.md

86 lines
1.3 KiB
Markdown
Raw Normal View History

# Daletl specification for Dalet v1.0-preview
## Data format
Daletl must be serialized as [MessagePack](https://github.com/msgpack/msgpack/blob/master/spec.md). All data transfer between server and client is done in this format.
### Root
Daletl root is array of tags. For convenience, we will use the json5 representation of the data.
```json5
[]
```
### Tag
All tags specification is in [Tags](./tags.md).
2024-07-24 16:41:50 +03:00
Each tag may be one of three types:
#### Data Representation
##### As array of 1-3 elements
1. Tag id
2. Tag body (optional if argument not specified, if argument specified it must be null)
3. Tag argument (optional)
Tag id is integer number.
2024-07-24 16:41:50 +03:00
Body can be only a string, null, array of tags or tag (equals to array of tags with 1 tag).
Argument can be number or string.
2024-07-24 16:41:50 +03:00
###### Heading example
```json5
[1, "This is heading", 1]
```
2024-07-24 16:41:50 +03:00
###### Unordered list example
```json5
[
4,
[
[0, "Item 1"],
[0, "Item 2"],
],
]
```
2024-07-24 16:41:50 +03:00
##### As string
String becomes element tag.
```json5
"Element"
```
equals to
```json5
[0, "Element"]
```
##### As array of tags
If array not started with a number. The implication is that this turns into an “element” tag
```json5
["Element", [1, "Heading"]]
```
equals to
```json5
[
0,
[
[0, "Element"],
[1, "Heading"],
],
]
```