1
0
silverbullet/website/Attributes.md

62 lines
1.5 KiB
Markdown
Raw Normal View History

2023-07-25 15:33:24 +00:00
Attributes can contribute additional [[Metadata]] to various entities:
* Pages
* Items
* Tasks
## Syntax
2023-07-26 15:12:56 +00:00
The syntax is as follows:
2023-07-25 15:33:24 +00:00
```
2023-07-26 15:12:56 +00:00
[attributeName: value]
2023-07-25 15:33:24 +00:00
```
2023-07-26 15:12:56 +00:00
For Obsidian/LogSeq compatibility, you can also double the colon like this: `[attributeName:: value]`
Attribute names need to be alphanumeric. Values are interpreted as [[YAML]] values. So here are some examples of valid attribute definitions:
2023-07-25 15:33:24 +00:00
2023-07-26 15:12:56 +00:00
* string: [attribute1: sup]
* number: [attribute2: 10]
* array: [attribute3: [sup, yo]]
2023-07-25 15:33:24 +00:00
2023-07-26 15:12:56 +00:00
Multiple attributes can be attached to a single entity, e.g. like so:
2023-07-25 15:33:24 +00:00
2023-07-26 15:12:56 +00:00
* Some item [attribute1: sup][attribute2: 22]
2023-07-25 15:33:24 +00:00
## Scope
2023-07-26 15:12:56 +00:00
Depending on where these attributes appear, they attach to different things. For instance, this attaches an attribute to a page:
2023-07-25 15:33:24 +00:00
[pageAttribute:: hello]
2023-07-26 15:12:56 +00:00
Example query:
2023-08-04 19:17:36 +00:00
<!-- #query page where name = "Attributes" select name, pageAttribute -->
|name |pageAttribute|
|----------|-----|
|Attributes|hello|
2023-07-26 15:12:56 +00:00
<!-- /query -->
This attaches an attribute to an item:
2023-07-25 15:33:24 +00:00
* Item [itemAttribute:: hello]
2023-07-26 15:12:56 +00:00
Example query:
<!-- #query item where page = "Attributes" and itemAttribute = "hello" -->
|name|itemAttribute|page |pos |
|----|-----|----------|----|
2023-08-04 19:17:36 +00:00
|Item|hello|Attributes|1106|
2023-07-26 15:12:56 +00:00
<!-- /query -->
This attaches an attribute to a task:
2023-07-25 15:33:24 +00:00
* [ ] Task [taskAttribute:: hello]
2023-07-26 15:12:56 +00:00
Example query:
<!-- #query task where page = "Attributes" and taskAttribute = "hello" -->
|name|done |taskAttribute|page |pos |
|----|-----|-----|----------|----|
2023-08-04 19:17:36 +00:00
|Task|false|hello|Attributes|1382|
2023-07-26 15:12:56 +00:00
<!-- /query -->