feat(docs): improve description of labels and relations

This commit is contained in:
Elian Doran
2025-04-07 12:22:48 +03:00
parent 72f0bc32df
commit 190cff6f7e
13 changed files with 977 additions and 601 deletions

View File

@@ -6732,25 +6732,347 @@
{
"type": "relation",
"name": "internalLink",
"value": "Ucmcs8SfrYdD",
"value": "HI6GBBIduIgv",
"isInheritable": false,
"position": 120
},
{
"type": "relation",
"name": "internalLink",
"value": "Cq5X6iKQop6R",
"isInheritable": false,
"position": 130
}
],
"format": "markdown",
"dataFileName": "Attributes.md",
"attachments": [
{
"attachmentId": "P4eRVtGFoHh2",
"attachmentId": "4YqnV7iugVCJ",
"title": "image.png",
"role": "image",
"mime": "image/jpg",
"mime": "image/png",
"position": 10,
"dataFileName": "Attributes_image.png"
}
],
"dirFileName": "Attributes",
"children": [
{
"isClone": false,
"noteId": "HI6GBBIduIgv",
"notePath": [
"pOsGYCXsbNQG",
"tC7s2alapj8V",
"zEY4DaJG4YT5",
"HI6GBBIduIgv"
],
"title": "Labels",
"notePosition": 10,
"prefix": null,
"isExpanded": false,
"type": "text",
"mime": "text/html",
"attributes": [
{
"type": "relation",
"name": "internalLink",
"value": "zEY4DaJG4YT5",
"isInheritable": false,
"position": 10
},
{
"type": "relation",
"name": "internalLink",
"value": "BlN9DFI679QC",
"isInheritable": false,
"position": 20
},
{
"type": "relation",
"name": "internalLink",
"value": "bwZpz2ajCEwO",
"isInheritable": false,
"position": 30
},
{
"type": "label",
"name": "iconClass",
"value": "bx bx-hash",
"isInheritable": false,
"position": 40
},
{
"type": "relation",
"name": "internalLink",
"value": "vZWERwf8U3nx",
"isInheritable": false,
"position": 60
},
{
"type": "relation",
"name": "internalLink",
"value": "l0tKav7yLHGF",
"isInheritable": false,
"position": 70
},
{
"type": "relation",
"name": "internalLink",
"value": "oPVyFC7WL2Lp",
"isInheritable": false,
"position": 80
},
{
"type": "relation",
"name": "internalLink",
"value": "GPERMystNGTB",
"isInheritable": false,
"position": 90
},
{
"type": "relation",
"name": "internalLink",
"value": "OFXdgB2nNk1F",
"isInheritable": false,
"position": 100
},
{
"type": "relation",
"name": "internalLink",
"value": "CoFPLs3dRlXc",
"isInheritable": false,
"position": 110
},
{
"type": "relation",
"name": "internalLink",
"value": "AlhDUqhENtH7",
"isInheritable": false,
"position": 120
},
{
"type": "relation",
"name": "internalLink",
"value": "pKK96zzmvBGf",
"isInheritable": false,
"position": 130
},
{
"type": "relation",
"name": "internalLink",
"value": "WFGzWeUK6arS",
"isInheritable": false,
"position": 140
},
{
"type": "relation",
"name": "internalLink",
"value": "0ESUbbAxVnoK",
"isInheritable": false,
"position": 150
},
{
"type": "relation",
"name": "internalLink",
"value": "J5Ex1ZrMbyJ6",
"isInheritable": false,
"position": 160
},
{
"type": "relation",
"name": "internalLink",
"value": "d3fAXQ2diepH",
"isInheritable": false,
"position": 170
},
{
"type": "relation",
"name": "internalLink",
"value": "MgibgPcfeuGz",
"isInheritable": false,
"position": 180
},
{
"type": "relation",
"name": "internalLink",
"value": "m523cpzocqaD",
"isInheritable": false,
"position": 190
},
{
"type": "relation",
"name": "internalLink",
"value": "9sRHySam5fXb",
"isInheritable": false,
"position": 200
},
{
"type": "relation",
"name": "internalLink",
"value": "_help_YKWqdJhzi2VY",
"isInheritable": false,
"position": 210
},
{
"type": "relation",
"name": "internalLink",
"value": "u3YFHC9tQlpm",
"isInheritable": false,
"position": 220
},
{
"type": "relation",
"name": "internalLink",
"value": "R9pX4DGra2Vt",
"isInheritable": false,
"position": 230
},
{
"type": "relation",
"name": "internalLink",
"value": "iRwzGnHPzonm",
"isInheritable": false,
"position": 240
},
{
"type": "relation",
"name": "internalLink",
"value": "BCkXAVs63Ttv",
"isInheritable": false,
"position": 250
},
{
"type": "relation",
"name": "internalLink",
"value": "47ZrP6FNuoG8",
"isInheritable": false,
"position": 260
},
{
"type": "relation",
"name": "internalLink",
"value": "KC1HB96bqqHX",
"isInheritable": false,
"position": 270
},
{
"type": "relation",
"name": "internalLink",
"value": "BFvAtE74rbP6",
"isInheritable": false,
"position": 280
},
{
"type": "relation",
"name": "internalLink",
"value": "bdUJEHsAPYQR",
"isInheritable": false,
"position": 290
},
{
"type": "relation",
"name": "internalLink",
"value": "AxshuNRegLAv",
"isInheritable": false,
"position": 300
},
{
"type": "relation",
"name": "internalLink",
"value": "81SGnPGMk7Xc",
"isInheritable": false,
"position": 310
},
{
"type": "relation",
"name": "internalLink",
"value": "xWbu3jpNWapp",
"isInheritable": false,
"position": 320
}
],
"format": "markdown",
"dataFileName": "Labels.md",
"attachments": []
},
{
"isClone": false,
"noteId": "Cq5X6iKQop6R",
"notePath": [
"pOsGYCXsbNQG",
"tC7s2alapj8V",
"zEY4DaJG4YT5",
"Cq5X6iKQop6R"
],
"title": "Relations",
"notePosition": 20,
"prefix": null,
"isExpanded": false,
"type": "text",
"mime": "text/html",
"attributes": [
{
"type": "relation",
"name": "internalLink",
"value": "HI6GBBIduIgv",
"isInheritable": false,
"position": 10
},
{
"type": "label",
"name": "iconClass",
"value": "bx bx-transfer",
"isInheritable": false,
"position": 20
},
{
"type": "relation",
"name": "internalLink",
"value": "BlN9DFI679QC",
"isInheritable": false,
"position": 30
},
{
"type": "relation",
"name": "internalLink",
"value": "bwZpz2ajCEwO",
"isInheritable": false,
"position": 40
},
{
"type": "relation",
"name": "internalLink",
"value": "oPVyFC7WL2Lp",
"isInheritable": false,
"position": 50
},
{
"type": "relation",
"name": "internalLink",
"value": "GPERMystNGTB",
"isInheritable": false,
"position": 60
},
{
"type": "relation",
"name": "internalLink",
"value": "KC1HB96bqqHX",
"isInheritable": false,
"position": 70
},
{
"type": "relation",
"name": "internalLink",
"value": "HcABDtFCkbFN",
"isInheritable": false,
"position": 80
}
],
"format": "markdown",
"dataFileName": "Relations.md",
"attachments": []
},
{
"isClone": false,
"noteId": "bwZpz2ajCEwO",
@@ -6761,7 +7083,7 @@
"bwZpz2ajCEwO"
],
"title": "Attribute Inheritance",
"notePosition": 10,
"notePosition": 30,
"prefix": null,
"isExpanded": false,
"type": "text",
@@ -6787,6 +7109,20 @@
"value": "bx bx-list-plus",
"isInheritable": false,
"position": 30
},
{
"type": "relation",
"name": "internalLink",
"value": "HI6GBBIduIgv",
"isInheritable": false,
"position": 40
},
{
"type": "relation",
"name": "internalLink",
"value": "Cq5X6iKQop6R",
"isInheritable": false,
"position": 50
}
],
"format": "markdown",
@@ -6803,7 +7139,7 @@
"OFXdgB2nNk1F"
],
"title": "Promoted Attributes",
"notePosition": 20,
"notePosition": 40,
"prefix": null,
"isExpanded": false,
"type": "text",
@@ -6858,237 +7194,6 @@
"dataFileName": "Promoted Attributes_promot.png"
}
]
},
{
"isClone": false,
"noteId": "Ucmcs8SfrYdD",
"notePath": [
"pOsGYCXsbNQG",
"tC7s2alapj8V",
"zEY4DaJG4YT5",
"Ucmcs8SfrYdD"
],
"title": "Attribute Reference",
"notePosition": 30,
"prefix": null,
"isExpanded": false,
"type": "text",
"mime": "text/html",
"attributes": [
{
"type": "relation",
"name": "internalLink",
"value": "l0tKav7yLHGF",
"isInheritable": false,
"position": 10
},
{
"type": "relation",
"name": "internalLink",
"value": "bwZpz2ajCEwO",
"isInheritable": false,
"position": 20
},
{
"type": "relation",
"name": "internalLink",
"value": "vZWERwf8U3nx",
"isInheritable": false,
"position": 30
},
{
"type": "relation",
"name": "internalLink",
"value": "oPVyFC7WL2Lp",
"isInheritable": false,
"position": 40
},
{
"type": "relation",
"name": "internalLink",
"value": "OFXdgB2nNk1F",
"isInheritable": false,
"position": 50
},
{
"type": "relation",
"name": "internalLink",
"value": "CoFPLs3dRlXc",
"isInheritable": false,
"position": 60
},
{
"type": "relation",
"name": "internalLink",
"value": "WFGzWeUK6arS",
"isInheritable": false,
"position": 70
},
{
"type": "relation",
"name": "internalLink",
"value": "J5Ex1ZrMbyJ6",
"isInheritable": false,
"position": 80
},
{
"type": "relation",
"name": "internalLink",
"value": "d3fAXQ2diepH",
"isInheritable": false,
"position": 90
},
{
"type": "relation",
"name": "internalLink",
"value": "MgibgPcfeuGz",
"isInheritable": false,
"position": 100
},
{
"type": "relation",
"name": "internalLink",
"value": "BFvAtE74rbP6",
"isInheritable": false,
"position": 110
},
{
"type": "relation",
"name": "internalLink",
"value": "bdUJEHsAPYQR",
"isInheritable": false,
"position": 120
},
{
"type": "relation",
"name": "internalLink",
"value": "KC1HB96bqqHX",
"isInheritable": false,
"position": 130
},
{
"type": "relation",
"name": "internalLink",
"value": "HcABDtFCkbFN",
"isInheritable": false,
"position": 140
},
{
"type": "relation",
"name": "internalLink",
"value": "9sRHySam5fXb",
"isInheritable": false,
"position": 160
},
{
"type": "relation",
"name": "internalLink",
"value": "u3YFHC9tQlpm",
"isInheritable": false,
"position": 170
},
{
"type": "relation",
"name": "internalLink",
"value": "R9pX4DGra2Vt",
"isInheritable": false,
"position": 180
},
{
"type": "relation",
"name": "internalLink",
"value": "pKK96zzmvBGf",
"isInheritable": false,
"position": 220
},
{
"type": "relation",
"name": "internalLink",
"value": "AlhDUqhENtH7",
"isInheritable": false,
"position": 230
},
{
"type": "relation",
"name": "internalLink",
"value": "0ESUbbAxVnoK",
"isInheritable": false,
"position": 240
},
{
"type": "relation",
"name": "internalLink",
"value": "m523cpzocqaD",
"isInheritable": false,
"position": 250
},
{
"type": "relation",
"name": "internalLink",
"value": "_help_YKWqdJhzi2VY",
"isInheritable": false,
"position": 260
},
{
"type": "relation",
"name": "internalLink",
"value": "iRwzGnHPzonm",
"isInheritable": false,
"position": 270
},
{
"type": "relation",
"name": "internalLink",
"value": "BCkXAVs63Ttv",
"isInheritable": false,
"position": 280
},
{
"type": "relation",
"name": "internalLink",
"value": "47ZrP6FNuoG8",
"isInheritable": false,
"position": 290
},
{
"type": "relation",
"name": "internalLink",
"value": "81SGnPGMk7Xc",
"isInheritable": false,
"position": 300
},
{
"type": "relation",
"name": "internalLink",
"value": "GPERMystNGTB",
"isInheritable": false,
"position": 310
},
{
"type": "relation",
"name": "internalLink",
"value": "AxshuNRegLAv",
"isInheritable": false,
"position": 320
},
{
"type": "relation",
"name": "internalLink",
"value": "xWbu3jpNWapp",
"isInheritable": false,
"position": 330
},
{
"type": "label",
"name": "iconClass",
"value": "bx bx-book-bookmark",
"isInheritable": false,
"position": 340
}
],
"format": "markdown",
"dataFileName": "Attribute Reference.md",
"attachments": []
}
]
},

View File

@@ -1,12 +1,12 @@
# Attributes
In Trilium, attributes are key-value pairs assigned to notes, providing additional metadata or functionality. There are two primary types of attributes:
1. **Labels**: Simple key-value text records
2. **Relations**: Named links to other notes
1. <a class="reference-link" href="Attributes/Labels.md">Labels</a>: Simple key-value text records
2. <a class="reference-link" href="Attributes/Relations.md">Relations</a>: Named links to other notes
These attributes play a crucial role in organizing, categorising, and enhancing the functionality of notes.
![](Attributes_image.png)
<figure class="image"><img style="aspect-ratio:1071/146;" src="Attributes_image.png" width="1071" height="146"></figure>
## Labels
@@ -18,26 +18,22 @@ Labels in Trilium can be used for a variety of purposes:
Labels are also searchable, enhancing note retrieval.
### Common Labels for Advanced Configuration
See the corresponding section in <a class="reference-link" href="Attributes/Attribute%20Reference.md">Attribute Reference</a> for a comprehensive list of attributes.
For more information, including predefined labels, see <a class="reference-link" href="Attributes/Labels.md">Labels</a>.
## Relations
Relations define connections between notes, similar to links.
### Uses
Uses:
* **Metadata Relationships**: For example, linking a book note to an author note
* **Scripting**: Attaching scripts to events or conditions related to the note
### Common Relations
See the corresponding section in <a class="reference-link" href="Attributes/Attribute%20Reference.md">Attribute Reference</a> for a comprehensive list of relations.
For more information, including a list of predefined relations, see <a class="reference-link" href="Attributes/Relations.md">Relations</a>.
## Multiplicity
Attributes in Trilium can be "multivalued", meaning multiple attributes with the same name can coexist.
Attributes in Trilium can be "multi-valued", meaning multiple attributes with the same name can co-exist.
## Attribute Definitions and Promoted Attributes

View File

@@ -1,11 +1,13 @@
# Attribute Inheritance
Inheritance refers to the process of having a [label](Labels.md) or a [relation](Relations.md) shared across multiple notes, generally in parent-child relations (or anywhere if using templates).
## 1\. Standard Inheritance
In Trilium, attributes can be automatically inherited by child notes if they have the `isInheritable` flag set to `true`. This means the attribute (a key-value pair) is applied to the note and all its descendants.
### Example Use Case
To make an attribute inheritable, simply use the visual editor for <a class="reference-link" href="Labels.md">Labels</a> or <a class="reference-link" href="Relations.md">Relations</a>. Alternatively, the attribute can be manually defined where `#myLabel=value` becomes `#myLabel(inheritable)=value` when inheritable.
The `archived` label can be set to be inheritable, allowing you to hide a whole subtree of notes from searches and other dialogs by applying this label at the top level.
As an example, the `archived` label can be set to be inheritable, allowing you to hide a whole subtree of notes from searches and other dialogs by applying this label at the top level.
## 2\. Copying Inheritance

View File

@@ -0,0 +1,37 @@
# Relations
A relation is similar to a [label](Labels.md), but instead of having a text value it refers to another note.
## Creating a relation using the visual editor
1. Go to the _Owned Attributes_ section in the <a class="reference-link" href="../../Basic%20Concepts%20and%20Features/UI%20Elements/Ribbon.md">Ribbon</a>.
2. Press the + button (_Add new attribute_) to the right.
3. Select _Add new relation_ for the relation.
> [!TIP]
> If you prefer keyboard shortcuts, press <kbd>Alt</kbd>+<kbd>L</kbd> while focused on a note or in the _Owned Attributes_ section to display the visual editor.
While in the visual editor:
* Set the desired name
* Set the Target note (the note to point to). Unlike labels, relations cannot exist with a target note.
* Check _Inheritable_ if the label should be inherited by the child notes as well. See <a class="reference-link" href="Attribute%20Inheritance.md">Attribute Inheritance</a> for more information.
## Creating a relation manually
In the _Owned Attributes_ section in the <a class="reference-link" href="../../Basic%20Concepts%20and%20Features/UI%20Elements/Ribbon.md">Ribbon</a>:
* To create a relation called `myRelation`:
* First type `~myRelation=@`.
* After this, an autocompletion box should appear.
* Type the title of the note to point to and press <kbd>Enter</kbd> to confirm (or click the desired note).
* Alternatively copy a note from the <a class="reference-link" href="../../Basic%20Concepts%20and%20Features/UI%20Elements/Note%20Tree.md">Note Tree</a> and paste it after the `=` sign (without the `@`, in this case).
* To create an inheritable relation, follow the same steps as previously described but instead of `~myRelation` write `~myRelation(inheritable)`.
## Predefined relations
These relations are supported and used internally by Trilium.
> [!TIP]
> Some relations presented here end with a `*`. That means that there are multiple relations with the same prefix, consult the specific page linked in the description of that relation for more information.
<figure class="table" style="width:100%;"><table class="ck-table-resized"><colgroup><col style="width:33.95%;"><col style="width:66.05%;"></colgroup><thead><tr><th>Label</th><th>Description</th></tr></thead><tbody><tr><td><code>runOn*</code></td><td>See&nbsp;<a class="reference-link" href="../../Scripting/Events.md">Events</a></td></tr><tr><td><code>template</code></td><td>note's attributes will be inherited even without a parent-child relationship, note's content and subtree will be added to instance notes if empty. See documentation for details.</td></tr><tr><td><code>inherit</code></td><td>note's attributes will be inherited even without a parent-child relationship. See&nbsp;<a class="reference-link" href="../Templates.md">Templates</a>&nbsp;for a similar concept. See&nbsp;<a class="reference-link" href="Attribute%20Inheritance.md">Attribute Inheritance</a>&nbsp;in the documentation.</td></tr><tr><td><code>renderNote</code></td><td>notes of type&nbsp;<a class="reference-link" href="../../Note%20Types/Render%20Note.md">Render Note</a>&nbsp;will be rendered using a code note (HTML or script) and it is necessary to point using this relation to which note should be rendered</td></tr><tr><td><code>widget_relation</code></td><td>target of this relation will be executed and rendered as a widget in the sidebar</td></tr><tr><td><code>shareCss</code></td><td>CSS note which will be injected into the share page. CSS note must be in the shared sub-tree as well. Consider using <code>share_hidden_from_tree</code> and <code>share_omit_default_css</code> as well.</td></tr><tr><td><code>shareJs</code></td><td>JavaScript note which will be injected into the share page. JS note must be in the shared sub-tree as well. Consider using <code>share_hidden_from_tree</code>.</td></tr><tr><td><code>shareTemplate</code></td><td>Embedded JavaScript note that will be used as the template for displaying the shared note. Falls back to the default template. Consider using <code>share_hidden_from_tree</code>.</td></tr><tr><td><code>shareFavicon</code></td><td>Favicon note to be set in the shared page. Typically you want to set it to share root and make it inheritable. Favicon note must be in the shared sub-tree as well. Consider using <code>share_hidden_from_tree</code>.</td></tr></tbody></table></figure>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 32 KiB