feat(docs): clarify attribute prefixes

This commit is contained in:
Elian Doran 2025-04-07 12:35:52 +03:00
parent ec5025d7fd
commit 5130089b34
No known key found for this signature in database
6 changed files with 66 additions and 41 deletions

View File

@ -6735,6 +6735,13 @@
"value": "Cq5X6iKQop6R", "value": "Cq5X6iKQop6R",
"isInheritable": false, "isInheritable": false,
"position": 130 "position": 130
},
{
"type": "relation",
"name": "internalLink",
"value": "BlN9DFI679QC",
"isInheritable": false,
"position": 140
} }
], ],
"format": "markdown", "format": "markdown",

View File

@ -1,24 +1,25 @@
# Attributes # Attributes
<figure class="image"><img style="aspect-ratio:1071/146;" src="Attributes_image.png" width="1071" height="146"></figure>
In Trilium, attributes are key-value pairs assigned to notes, providing additional metadata or functionality. There are two primary types of attributes: In Trilium, attributes are key-value pairs assigned to notes, providing additional metadata or functionality. There are two primary types of attributes:
1. <a class="reference-link" href="Attributes/Labels.md">Labels</a>: Simple key-value text records 1. <a class="reference-link" href="Attributes/Labels.md">Labels</a> can be used for a variety of purposes, such as storing metadata or configuring the behaviour of notes. Labels are also searchable, enhancing note retrieval.
2. <a class="reference-link" href="Attributes/Relations.md">Relations</a>: Named links to other notes
For more information, including predefined labels, see <a class="reference-link" href="Attributes/Labels.md">Labels</a>.
2. <a class="reference-link" href="Attributes/Relations.md">Relations</a> define connections between notes, similar to links. These can be used for metadata and scripting purposes.
For more information, including a list of predefined relations, see <a class="reference-link" href="Attributes/Relations.md">Relations</a>.
These attributes play a crucial role in organizing, categorising, and enhancing the functionality of notes. These attributes play a crucial role in organizing, categorising, and enhancing the functionality of notes.
<figure class="image"><img style="aspect-ratio:1071/146;" src="Attributes_image.png" width="1071" height="146"></figure> ## Viewing the list of attributes
## Labels Both the labels and relations for the current note are displayed in the _Owned Attributes_ section of the <a class="reference-link" href="../Basic%20Concepts%20and%20Features/UI%20Elements/Ribbon.md">Ribbon</a>, where they can be viewed and edited. Inherited attributes are displayed in the _Inherited Attributes_ section of the ribbon, where they can only be viewed.
Labels in Trilium can be used for a variety of purposes, such as storing metadata or configuring the behaviour of notes. Labels are also searchable, enhancing note retrieval. In the list of attributes, labels are prefixed with the `#` character whereas relations are prefixed with the `~` character.
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. These can be used for metadata and scripting purposes.
For more information, including a list of predefined relations, see <a class="reference-link" href="Attributes/Relations.md">Relations</a>.
## Multiplicity ## Multiplicity

View File

@ -1,7 +1,7 @@
# Attribute Inheritance # 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). 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 ## 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. 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.
@ -9,7 +9,7 @@ To make an attribute inheritable, simply use the visual editor for <a class="re
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. 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 ## Copying Inheritance
Copying inheritance differs from standard inheritance by using a `child:` prefix in the attribute name. This prefix causes new child notes to automatically receive specific attributes from the parent note. These attributes are independent of the parent and will persist even if the note is moved elsewhere. Copying inheritance differs from standard inheritance by using a `child:` prefix in the attribute name. This prefix causes new child notes to automatically receive specific attributes from the parent note. These attributes are independent of the parent and will persist even if the note is moved elsewhere.
@ -22,6 +22,6 @@ Copying inheritance differs from standard inheritance by using a `child:` prefix
If a parent note has the label `#child:exampleAttribute`, all newly created child notes will inherit the `#exampleAttribute` label. This can be useful for setting default properties for notes in a specific section. If a parent note has the label `#child:exampleAttribute`, all newly created child notes will inherit the `#exampleAttribute` label. This can be useful for setting default properties for notes in a specific section.
## 3\. Template Inheritance ## Template Inheritance
Attributes can also be inherited from [templates](../Templates.md). When a new note is created using a template, it inherits the attributes defined in that template. This is particularly useful for maintaining consistency across notes that follow a similar structure or function. Attributes can also be inherited from [templates](../Templates.md). When a new note is created using a template, it inherits the attributes defined in that template. This is particularly useful for maintaining consistency across notes that follow a similar structure or function.

View File

@ -6735,6 +6735,13 @@
"value": "Cq5X6iKQop6R", "value": "Cq5X6iKQop6R",
"isInheritable": false, "isInheritable": false,
"position": 130 "position": 130
},
{
"type": "relation",
"name": "internalLink",
"value": "BlN9DFI679QC",
"isInheritable": false,
"position": 140
} }
], ],
"format": "html", "format": "html",

View File

@ -13,32 +13,42 @@
<h1 data-trilium-h1>Attributes</h1> <h1 data-trilium-h1>Attributes</h1>
<div class="ck-content"> <div class="ck-content">
<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><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>
<figure class="image"> <figure class="image">
<img style="aspect-ratio:1071/146;" src="Attributes_image.png" width="1071" <img style="aspect-ratio:1071/146;" src="Attributes_image.png" width="1071"
height="146"> height="146">
</figure> </figure>
<h2>Labels</h2> <p>In Trilium, attributes are key-value pairs assigned to notes, providing
<p>Labels in Trilium can be used for a variety of purposes, such as storing additional metadata or functionality. There are two primary types of attributes:</p>
metadata or configuring the behaviour of notes. Labels are also searchable, <ol>
enhancing note retrieval.</p> <li>
<p>For more information, including predefined labels, see&nbsp;<a class="reference-link" <p><a class="reference-link" href="Attributes/Labels.html">Labels</a>&nbsp;can
href="Attributes/Labels.html">Labels</a>.</p> be used for a variety of purposes, such as storing metadata or configuring
<h2>Relations</h2> the behaviour of notes. Labels are also searchable, enhancing note retrieval.
<p>Relations define connections between notes, similar to links. These can <br>
be used for metadata and scripting purposes.</p> <br>For more information, including predefined labels, see&nbsp;<a class="reference-link"
<p>For more information, including a list of predefined relations, see&nbsp; href="Attributes/Labels.html">Labels</a>.</p>
<a <p>&nbsp;</p>
class="reference-link" href="Attributes/Relations.html">Relations</a>.</p> </li>
<li>
<p><a class="reference-link" href="Attributes/Relations.html">Relations</a>&nbsp;define
connections between notes, similar to links. These can be used for metadata
and scripting purposes.</p>
<p>
<br>For more information, including a list of predefined relations, see&nbsp;
<a
class="reference-link" href="Attributes/Relations.html">Relations</a>.</p>
</li>
</ol>
<p>These attributes play a crucial role in organizing, categorising, and
enhancing the functionality of notes.</p>
<h2>Viewing the list of attributes</h2>
<p>Both the labels and relations for the current note are displayed in the <em>Owned Attributes</em> section
of the&nbsp;<a class="reference-link" href="../Basic%20Concepts%20and%20Features/UI%20Elements/Ribbon.html">Ribbon</a>,
where they can be viewed and edited. Inherited attributes are displayed
in the <em>Inherited Attributes</em> section of the ribbon, where they can
only be viewed.</p>
<p>In the list of attributes, labels are prefixed with the <code>#</code> character
whereas relations are prefixed with the <code>~</code> character.</p>
<h2>Multiplicity</h2> <h2>Multiplicity</h2>
<p>Attributes in Trilium can be "multi-valued", meaning multiple attributes <p>Attributes in Trilium can be "multi-valued", meaning multiple attributes
with the same name can co-exist.</p> with the same name can co-exist.</p>

View File

@ -16,7 +16,7 @@
<p>Inheritance refers to the process of having a <a href="Labels.html">label</a> or <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 a <a href="Relations.html">relation</a> shared across multiple notes, generally
in parent-child relations (or anywhere if using templates).</p> in parent-child relations (or anywhere if using templates).</p>
<h2>1. Standard Inheritance</h2> <h2>Standard Inheritance</h2>
<p>In Trilium, attributes can be automatically inherited by child notes if <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 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 means the attribute (a key-value pair) is applied to the note and all its
@ -29,7 +29,7 @@
<p>As an example, the <code>archived</code> label can be set to be inheritable, <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 allowing you to hide a whole subtree of notes from searches and other dialogs
by applying this label at the top level.</p> by applying this label at the top level.</p>
<h2>2. Copying Inheritance</h2> <h2>Copying Inheritance</h2>
<p>Copying inheritance differs from standard inheritance by using a <code>child:</code> prefix <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 in the attribute name. This prefix causes new child notes to automatically
receive specific attributes from the parent note. These attributes are receive specific attributes from the parent note. These attributes are
@ -47,7 +47,7 @@
newly created child notes will inherit the <code>#exampleAttribute</code> label. newly created child notes will inherit the <code>#exampleAttribute</code> label.
This can be useful for setting default properties for notes in a specific This can be useful for setting default properties for notes in a specific
section.</p> section.</p>
<h2>3. Template Inheritance</h2> <h2>Template Inheritance</h2>
<p>Attributes can also be inherited from <a href="../Templates.html">templates</a>. <p>Attributes can also be inherited from <a href="../Templates.html">templates</a>.
When a new note is created using a template, it inherits the attributes When a new note is created using a template, it inherits the attributes
defined in that template. This is particularly useful for maintaining consistency defined in that template. This is particularly useful for maintaining consistency