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
No known key found for this signature in database
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

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": "html",
"dataFileName": "Attributes.html",
"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": "html",
"dataFileName": "Labels.html",
"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": "html",
"dataFileName": "Relations.html",
"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": "html",
@ -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": "html",
"dataFileName": "Attribute Reference.html",
"attachments": []
}
]
},

View File

@ -16,14 +16,17 @@
<p>In Trilium, attributes are key-value pairs assigned to notes, providing
additional metadata or functionality. There are two primary types of attributes:</p>
<ol>
<li><strong>Labels</strong>: Simple key-value text records</li>
<li><strong>Relations</strong>: Named links to other notes</li>
<li><a class="reference-link" href="Attributes/Labels.html">Labels</a>: Simple
key-value text records</li>
<li><a class="reference-link" href="Attributes/Relations.html">Relations</a>:
Named links to other notes</li>
</ol>
<p>These attributes play a crucial role in organizing, categorising, and
enhancing the functionality of notes.</p>
<p>
<img src="Attributes_image.png">
</p>
<figure class="image">
<img style="aspect-ratio:1071/146;" src="Attributes_image.png" width="1071"
height="146">
</figure>
<h2>Labels</h2>
<p>Labels in Trilium can be used for a variety of purposes:</p>
<ul>
@ -36,24 +39,23 @@
such as the "weight" attribute in the&nbsp;<a class="reference-link" href="Advanced%20Showcases/Weight%20Tracker.html">Weight Tracker</a>.</li>
</ul>
<p>Labels are also searchable, enhancing note retrieval.</p>
<h3>Common Labels for Advanced Configuration</h3>
<p>See the corresponding section in&nbsp;<a class="reference-link" href="Attributes/Attribute%20Reference.html">Attribute Reference</a>&nbsp;for
a comprehensive list of attributes.</p>
<p>For more information, including predefined labels, see&nbsp;<a class="reference-link"
href="Attributes/Labels.html">Labels</a>.</p>
<h2>Relations</h2>
<p>Relations define connections between notes, similar to links.</p>
<h3>Uses</h3>
<p>Uses:</p>
<ul>
<li><strong>Metadata Relationships</strong>: For example, linking a book note
to an author note</li>
<li><strong>Scripting</strong>: Attaching scripts to events or conditions
related to the note</li>
</ul>
<h3>Common Relations</h3>
<p>See the corresponding section in&nbsp;<a class="reference-link" href="Attributes/Attribute%20Reference.html">Attribute Reference</a>&nbsp;for
a comprehensive list of relations.</p>
<p>For more information, including a list of predefined relations, see&nbsp;
<a
class="reference-link" href="Attributes/Relations.html">Relations</a>.</p>
<h2>Multiplicity</h2>
<p>Attributes in Trilium can be "multivalued", meaning multiple attributes
with the same name can coexist.</p>
<p>Attributes in Trilium can be "multi-valued", meaning multiple attributes
with the same name can co-exist.</p>
<h2>Attribute Definitions and Promoted Attributes</h2>
<p>Special labels create "label/attribute" definitions, enhancing the organization
and management of attributes. For more details, see&nbsp;<a class="reference-link"

View File

@ -13,15 +13,22 @@
<h1 data-trilium-h1>Attribute Inheritance</h1>
<div class="ck-content">
<p>Inheritance refers to the process of having a <a href="Labels.html">label</a> or
a <a href="Relations.html">relation</a> shared across multiple notes, generally
in parent-child relations (or anywhere if using templates).</p>
<h2>1. Standard Inheritance</h2>
<p>In Trilium, attributes can be automatically inherited by child notes if
they have the <code>isInheritable</code> flag set to <code>true</code>. This
means the attribute (a key-value pair) is applied to the note and all its
descendants.</p>
<h3>Example Use Case</h3>
<p>The <code>archived</code> 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.</p>
<p>To make an attribute inheritable, simply use the visual editor for&nbsp;
<a
class="reference-link" href="Labels.html">Labels</a>&nbsp;or&nbsp;<a class="reference-link" href="Relations.html">Relations</a>.
Alternatively, the attribute can be manually defined where <code>#myLabel=value</code> becomes <code>#myLabel(inheritable)=value</code> when
inheritable.</p>
<p>As an example, the <code>archived</code> 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.</p>
<h2>2. Copying Inheritance</h2>
<p>Copying inheritance differs from standard inheritance by using a <code>child:</code> prefix
in the attribute name. This prefix causes new child notes to automatically

View File

@ -5,15 +5,51 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../../../style.css">
<base target="_parent">
<title data-trilium-title>Attribute Reference</title>
<title data-trilium-title>Labels</title>
</head>
<body>
<div class="content">
<h1 data-trilium-h1>Attribute Reference</h1>
<h1 data-trilium-h1>Labels</h1>
<div class="ck-content">
<h2>Labels</h2>
<p>A label is an <a href="../Attributes.html">attribute</a> of a note which
has a name and optionally a value.&nbsp;</p>
<h2>Creating a label using the visual editor</h2>
<ol>
<li>Go to the <em>Owned Attributes</em> section in the&nbsp;<a class="reference-link"
href="../../Basic%20Concepts%20and%20Features/UI%20Elements/Ribbon.html">Ribbon</a>.</li>
<li>Press the + button (<em>Add new attribute</em>) to the right.</li>
<li>Select <em>Add new label</em> for the relation.</li>
</ol>
<aside class="admonition tip">
<p>If you prefer keyboard shortcuts, press <kbd>Alt</kbd>+<kbd>L</kbd> while
focused on a note or in the <em>Owned Attributes</em> section to display
the visual editor.</p>
</aside>
<p>While in the visual editor:</p>
<ul>
<li>Set the desired name</li>
<li>Optionally, set the value of the label. Labels can exist without a value.</li>
<li>Check <em>Inheritable</em> if the label should be inherited by the child
notes as well. See&nbsp;<a class="reference-link" href="Attribute%20Inheritance.html">Attribute Inheritance</a>&nbsp;for
more information.</li>
</ul>
<h2>Creating a label manually</h2>
<p>In the <em>Owned Attributes</em> section in the&nbsp;<a class="reference-link"
href="../../Basic%20Concepts%20and%20Features/UI%20Elements/Ribbon.html">Ribbon</a>:</p>
<ul>
<li>To create a label called <code>myLabel</code> with no value, simply type <code>#myLabel</code>.</li>
<li>To create a label called <code>myLabel</code> with a value <code>value</code>,
simply type <code>#myLabel=value</code>.</li>
<li>If the value contains spaces, then the text must be quoted: <code>#myLabel="Hello world"</code>.</li>
<li>If the string contains quotes (regardless of whether it has spaces), then
the text must be quoted with apostrophes instead: <code>#myLabel='Hello "world"'</code>.</li>
<li>To create an inheritable label called <code>myLabel</code>, simply write <code>#myLabel(inheritable)</code> for
no value or <code>#myLabel(inheritable)=value</code> if there is a value.</li>
</ul>
<h2>Predefined labels</h2>
<p>This is a list of labels that Trilium natively supports.</p>
<aside class="admonition tip">
<p>Some labels presented here end with a <code>*</code>. That means that there
are multiple labels with the same prefix, consult the specific page linked
@ -352,88 +388,6 @@
</tbody>
</table>
</figure>
<h2>Relations</h2>
<aside class="admonition tip">
<p>Some relations presented here end with a <code>*</code>. 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.</p>
</aside>
<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.html">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.html">Templates</a>&nbsp;for
a similar concept. See&nbsp;<a class="reference-link" href="Attribute%20Inheritance.html">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.html">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>
</div>
</div>
</body>

View File

@ -0,0 +1,145 @@
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../../../style.css">
<base target="_parent">
<title data-trilium-title>Relations</title>
</head>
<body>
<div class="content">
<h1 data-trilium-h1>Relations</h1>
<div class="ck-content">
<p>A relation is similar to a <a href="Labels.html">label</a>, but instead
of having a text value it refers to another note.</p>
<h2>Creating a relation using the visual editor</h2>
<ol>
<li>Go to the <em>Owned Attributes</em> section in the&nbsp;<a class="reference-link"
href="../../Basic%20Concepts%20and%20Features/UI%20Elements/Ribbon.html">Ribbon</a>.</li>
<li>Press the + button (<em>Add new attribute</em>) to the right.</li>
<li>Select <em>Add new relation</em> for the relation.</li>
</ol>
<aside class="admonition tip">
<p>If you prefer keyboard shortcuts, press <kbd>Alt</kbd>+<kbd>L</kbd> while
focused on a note or in the <em>Owned Attributes</em> section to display
the visual editor.</p>
</aside>
<p>While in the visual editor:</p>
<ul>
<li>Set the desired name</li>
<li>Set the Target note (the note to point to). Unlike labels, relations cannot
exist with a target note.</li>
<li>Check <em>Inheritable</em> if the label should be inherited by the child
notes as well. See&nbsp;<a class="reference-link" href="Attribute%20Inheritance.html">Attribute Inheritance</a>&nbsp;for
more information.</li>
</ul>
<h2>Creating a relation manually</h2>
<p>In the <em>Owned Attributes</em> section in the&nbsp;<a class="reference-link"
href="../../Basic%20Concepts%20and%20Features/UI%20Elements/Ribbon.html">Ribbon</a>:</p>
<ul>
<li>To create a relation called <code>myRelation</code>:
<ul>
<li>First type <code>~myRelation=@</code>.</li>
<li>After this, an autocompletion box should appear.</li>
<li>Type the title of the note to point to and press <kbd>Enter</kbd> to confirm
(or click the desired note).</li>
<li>Alternatively copy a note from the&nbsp;<a class="reference-link" href="../../Basic%20Concepts%20and%20Features/UI%20Elements/Note%20Tree.html">Note Tree</a>&nbsp;and
paste it after the <code>=</code> sign (without the <code>@</code>, in this
case).</li>
</ul>
</li>
<li>To create an inheritable relation, follow the same steps as previously
described but instead of <code>~myRelation</code> write <code>~myRelation(inheritable)</code>.</li>
</ul>
<h2>Predefined relations</h2>
<p>These relations are supported and used internally by Trilium.</p>
<aside
class="admonition tip">
<p>Some relations presented here end with a <code>*</code>. 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.</p>
</aside>
<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.html">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.html">Templates</a>&nbsp;for
a similar concept. See&nbsp;<a class="reference-link" href="Attribute%20Inheritance.html">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.html">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>
</div>
</div>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

@ -319,15 +319,16 @@
<ul>
<li><a href="User%20Guide/Advanced%20Usage/Attributes.html" target="detail">Attributes</a>
<ul>
<li><a href="User%20Guide/Advanced%20Usage/Attributes/Labels.html" target="detail">Labels</a>
</li>
<li><a href="User%20Guide/Advanced%20Usage/Attributes/Relations.html" target="detail">Relations</a>
</li>
<li><a href="User%20Guide/Advanced%20Usage/Attributes/Attribute%20Inheritance.html"
target="detail">Attribute Inheritance</a>
</li>
<li><a href="User%20Guide/Advanced%20Usage/Attributes/Promoted%20Attributes.html"
target="detail">Promoted Attributes</a>
</li>
<li><a href="User%20Guide/Advanced%20Usage/Attributes/Attribute%20Reference.html"
target="detail">Attribute Reference</a>
</li>
</ul>
</li>
<li><a href="User%20Guide/Advanced%20Usage/Templates.html" target="detail">Templates</a>