The problem
The syntax for properties:
- key:: value
has three issues:
- It’s confusing about how values are parsed (see documentation here): you can choose between multiple values or longer text with commas, but not both at the same time. It is limiting and very developer-oriented. Sometimes text is turned into pages and the user needs to figure out why; when you experience it it seems a bug.
- To use a block as a property value you need to save the block somewhere else and reference it with
((block-id))
, and this leads to even more issues especially with queries:
- Block A
id:: 12345-12345-12345-12345
- Block B
property:: ((12345-12345-12345-12345))
- When you open Logseq Markdown files in another editor, properties make them unusable.
The solution
Here there is an idea for a better properties syntax that:
- Support multiple values, mixing text and page references without ambiguities.
- Support blocks as values
- Looks good in Markdown editors
The idea is to use asterisk (*) bullet points for properties (as opposed to dash (-) bullet points used for blocks):
- Block A
* key:: single value
For multiple values use blocks again:
- Block A
* key::
- First value
- Second value
rendered it looks like this:
- Block A
- key::
- First value
- Second value
- key::
Since blocks can have their own properties, this means it’s possible to store structured data more or less like JSON:
- Oscar Wilde
* Description:: Oscar Wilde was an Irish poet and playwright. After writing in different forms throughout the 1880s, he became one of the most popular playwrights in London in the early 1890s.
* Books::
- The Picture of Dorian Gray
* Year:: 1891
- The Importance of Being Earnest
* Year:: 1895
- Lewis Carroll
* Books:: [[Alice in Wonderland]]
Rendered:
- Oscar Wilde
- Description:: Oscar Wilde was an Irish poet and playwright. After writing in different forms throughout the 1880s, he became one of the most popular playwrights in London in the early 1890s.
- Books::
- The Picture of Dorian Gray
- Year:: 1891
- The Importance of Being Earnest
- Year:: 1895
- The Picture of Dorian Gray
- Lewis Carroll
- Books:: [[Alice in Wonderland]]
To make it even better when rendered, the key::
syntax could be replaced by **key:**
and support spaces (**foo bar:**
):
- Oscar Wilde
* **Description:** Oscar Wilde was an Irish poet and playwright. After writing in different forms throughout the 1880s, he became one of the most popular playwrights in London in the early 1890s.
* **Books:**
- The Picture of Dorian Gray
* **Year:** 1891
- The Importance of Being Earnest
* **Year:** 1895
- Lewis Carroll
* **Books:** [[Alice in Wonderland]]
Rendered:
- Oscar Wilde
- Description: Oscar Wilde was an Irish poet and playwright. After writing in different forms throughout the 1880s, he became one of the most popular playwrights in London in the early 1890s.
-
Books:
- The Picture of Dorian Gray
- Year: 1891
- The Importance of Being Earnest
- Year: 1895
- The Picture of Dorian Gray
- Lewis Carroll
- Books: [[Alice in Wonderland]]
Since we are at it, I think it would be better if it’s the user that specifies if a property key is also a page, like this:
- Block A
* **[[Key A]]:** value
It may looks complex to type but this could be just the syntax to store in Markdown files: the Logseq UI could present this in a more WYSIWYG way.
CC @FlorianF