# notes

noteId: d8q85vCoLuob
type: text
mime: text/html
blobId: K8abiGfxRwBlkM9EfYoN
dateCreated: 2025-03-09 12:18:55.626+0200
dateModified: 2025-03-09 12:18:55.626+0200
utcDateCreated: 2025-03-09 10:18:56.329Z
utcDateModified: 2025-03-09 10:18:56.329Z
title:
  Error [TransformError]: The package "@esbuild/linux-x64" could not be found, and is needed by esbuild.


# options

name: openNoteContexts
utcDateModified: 2025-03-10 13:01:03.311Z
value:
  [{"ntxId":"50R4QW","mainNtxId":null,"notePath":"root/xegaRGkDMfkv/krkLW8AwcYf2/fKYGY3OOo5d1","hoistedNoteId":"root","active":false,"viewScope":{"viewMode":"default","tocPreviousVisible":false,"highlightsListPreviousVisible":false}},{"ntxId":"Ck9thr","mainNtxId":"50R4QW","notePath":"root/pOsGYCXsbNQG/KSZ04uQ2D1St/grjYqerjn243","hoistedNoteId":"root","active":true,"viewScope":{"viewMode":"default"}}]


name: allowedHtmlTags
utcDateModified: 2025-03-09 07:48:52.566Z
value:
  ["h1","h2","h3","h4","h5","h6","blockquote","p","a","ul","ol","li","b","i","strong","em","strike","s","del","abbr","code","hr","br","div","table","thead","caption","tbody","tfoot","tr","th","td","pre","section","img","figure","figcaption","span","label","input","details","summary","address","aside","footer","header","hgroup","main","nav","dl","dt","menu","bdi","bdo","dfn","kbd","mark","q","time","var","wbr","area","map","track","video","audio","picture","del","ins","en-media","acronym","article","big","button","cite","col","colgroup","data","dd","fieldset","form","legend","meter","noscript","option","progress","rp","samp","small","sub","sup","template","textarea","tt"]


# blobs

blobId: K5jYojouhYZvmkq9hmxL
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:07.746Z
content:
  <h2>Advanced Showcases</h2>
  <p>Trilium offers advanced functionality through <a href="#root/CdNpE2pqjmI6">Scripts</a> and <a href="#root/OFXdgB2nNk1F">Promoted Attributes</a>. To illustrate these features, we've prepared several showcases available in the <a href="#root/wX4HbRucYSDD">demo notes</a>:</p>
  <ul>
  <li><a href="#root/iRwzGnHPzonm">Relation Map</a></li>
  <li><a href="#root/l0tKav7yLHGF">Day Notes</a></li>
  <li><a href="#root/R7abl2fc6Mxi">Weight Tracker</a></li>
  <li><a href="#root/xYjQUYhpbUEW">Task Manager</a></li>
  </ul>
  <p>It's important to note that these examples are not natively supported by Trilium out of the box; instead, they demonstrate what you can build within Trilium.</p>


blobId: LAAy9lFoYm9NS4kt69UU
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:07.753Z
content:
  <h2>Anonymized Database</h2>
  <p><img src="api/images/gaRKhojVlYx5/anonymization.png" alt="screenshot of advanced settings" /></p>
  <p>In certain scenarios, understanding the structure of a database is crucial for troubleshooting issues. However, sharing your actual <a href="#root/wX4HbRucYSDD">database</a> file with personal notes is not advisable. To address this, Trilium offers a feature to anonymize the database. This feature can be accessed via Menu -&gt; Options -&gt; Advanced tab.</p>
  <p>This feature creates a copy of your database with all sensitive data removed. Specifically, it strips out note titles, contents, revisions, history, and some non-system attributes while retaining the overall structure and metadata, such as modification dates. After anonymization, the database undergoes a <a href="https://sqlite.org/lang_vacuum.html">vacuuming process</a> to ensure no sensitive data remnants remain in the file. The anonymized database is saved in the <code>anonymized</code> directory within the <a href="#root/tAassRL4RSQL">data directory</a>, making it safe to share with bug reports.</p>
  <p>This will create a copy of your document and remove all sensitive data (currently note titles, contents, revisions, history and some of the options, and non-system attributes) while leaving all structure and metadata (e.g. date of last change). After this is done, the database is <a href="https://sqlite.org/lang_vacuum.html">VACUUMed</a> to make sure there's no stale sensitive data in the document file. The resulting file is stored in <code>anonymized</code> directory (placed in the <a href="#root/tAassRL4RSQL">data directory</a>). You can safely attach it to a bug report.</p>
  <h2>Command Line Anonymization</h2>
  <p>If your <a href="#root/wX4HbRucYSDD">database</a> is corrupted to the point where Trilium cannot start, the anonymization process can still be executed via the command line:</p>
  <pre><code class="language-text-x-trilium-auto">node src/anonymize.js</code></pre><p>Run this command from the directory containing Trilium's source files, typically found in the <code>resources/app</code> directory for desktop builds.</p>


blobId: lXr7s1YNX6vCXq89nPon
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:07.759Z
content:
  <h2>Apache proxy setup</h2>
  <p>I've assumed you have created a DNS A record for <code>trilium.yourdomain.com</code> that you want to use for your Trilium server.</p>
  <ol>
  <li><p>Download docker image and create container</p>
  <pre><code class="language-text-x-trilium-auto"> docker pull triliumnext/notes:[VERSION]
   docker create --name trilium -t -p 127.0.0.1:8080:8080 -v ~/trilium-data:/home/node/trilium-data triliumnext/notes:[VERSION]</code></pre></li>
  <li><p>Configure Apache proxy and websocket proxy</p>
  <ol>
  <li><p>Enable apache proxy modules</p>
  <pre><code class="language-text-x-trilium-auto"> a2enmod ssl
   a2enmod proxy
   a2enmod proxy_http
   a2enmod proxy_wstunnel</code></pre></li>
  <li><p>Create a new let's encrypt certificate</p>
  <pre><code class="language-text-x-trilium-auto"> sudo certbot certonly -d trilium.mydomain.com</code></pre><p>Choose standalone (2) and note the location of the created certificates (typically /etc/letsencrypt/live/...)</p>
  </li>
  <li><p>Create a new virtual host file for apache (you may want to use <code>apachectl -S</code> to determine the server root location, mine is /etc/apache2)</p>
  <pre><code class="language-text-x-trilium-auto"> sudo nano /etc/apache2/sites-available/trilium.yourdomain.com.conf</code></pre><p>Paste (and customize) the following text into the configuration file</p>
  <pre><code class="language-text-x-trilium-auto"> 
       ServerName http://trilium.yourdomain.com
       RewriteEngine on
           RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
   
   
       ServerName https://trilium.yourdomain.com
       RewriteEngine On
       RewriteCond %{HTTP:Connection} Upgrade [NC]
       RewriteCond %{HTTP:Upgrade} websocket [NC]
       RewriteRule /(.*) ws://localhost:8080/$1 [P,L]
       AllowEncodedSlashes NoDecode
       ProxyPass / http://localhost:8080/ nocanon
       ProxyPassReverse / http://localhost:8080/
       SSLCertificateFile /etc/letsencrypt/live/trilium.yourdomain.com/fullchain.pem
       SSLCertificateKeyFile /etc/letsencrypt/live/trilium.yourdomain.com/privkey.pem
       Include /etc/letsencrypt/options-ssl-apache.conf
   </code></pre></li>
  <li><p>Enable the virtual host with <code>sudo a2ensite trilium.yourdomain.com.conf</code></p>
  </li>
  <li><p>Reload apache2 with <code>sudo systemctl reload apache2</code></p>
  </li>
  </ol>
  </li>
  <li><p>Create and enable a systemd service to start the docker container on boot</p>
  <ol>
  <li><p>Create a new empty file called <code>/lib/systemd/system/trilium.service</code> with the contents</p>
  <pre><code class="language-text-x-trilium-auto"> [Unit]
   Description=Trilium Server
   Requires=docker.service
   After=docker.service

   [Service]
   Restart=always
   ExecStart=/usr/bin/docker start -a trilium
   ExecStop=/usr/bin/docker stop -t 2 trilium

   [Install]
   WantedBy=local.target</code></pre></li>
  <li><p>Install, enable and start service</p>
  <pre><code class="language-text-x-trilium-auto"> sudo systemctl daemon-reload
   sudo systemctl enable trilium.service
   sudo systemctl start trilium.service</code></pre></li>
  </ol>
  </li>
  </ol>


blobId: AooqY5FYZiHcGu1xSDuX
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:07.762Z
content:
  <h2>Archived-notes</h2>
  <p>Archived notes are notes which have <code>archived</code> <a href="#root/zEY4DaJG4YT5">attribute</a> - either directly or <a href="#root/bwZpz2ajCEwO">inherited</a>.</p>
  <p>Such notes are then by default not shown in the autocomplete and in the full text <a href="#root/eIg8jdvaoNNd">search</a>.</p>
  <p>This can be useful for notes which are no longer very useful but still valuable enough to keep around without them getting too much in the way.</p>
  <p>You can control whether archived notes are displayed in the note tree with a setting:</p>
  <p><img src="api/images/1fkGrskxHx5u/hide-archived.png" alt="" /></p>


blobId: Ng24lmGB5ZBcLrRi5LAT
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:07.768Z
content:
  <h2>Attachments</h2>
  <p>A <a href="#root/BFs8mudNFgCS">note</a> in Trilium can <em>own</em> one or more attachments, which can be either images or files. These attachments can be displayed or linked within the note that owns them.</p>
  <p>This can be especially useful to include dependencies for your <a href="#root/CdNpE2pqjmI6">scripts</a>. The <a href="#root/R7abl2fc6Mxi">Weight Tracker</a> shows how to use <a href="https://chartjs.org/">chartjs</a> which is attached to the <a href="#root/HcUYTojFohtb">script note</a>.</p>
  <p>Each note exclusively owns its attachments, meaning attachments cannot be shared or linked from one note to another. If an attachment link is copied to a different note, the attachment itself is duplicated, and the copies are managed independently thereafter.</p>
  <p>Attachments, especially image files, are the recommended method for embedding visuals in notes. It is important to link image attachments within the text of the owning note; otherwise, they will be automatically deleted after a configurable timeout period if not referenced.</p>


blobId: XiFYQUahfhM07GEiqi2R
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:07.773Z
content:
  <h2>Attribute Inheritance in Trilium</h2>
  <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>
  <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 receive specific attributes from the parent note. These attributes are independent of the parent and will persist even if the note is moved elsewhere.</p>
  <h3>How to Use</h3>
  <ul>
  <li><strong>Syntax:</strong> <code>#child:attributeName</code></li>
  <li><strong>Chained Inheritance:</strong> You can chain this inheritance, such as <code>#child:child:attributeName</code>, where each child down the hierarchy receives the appropriate attribute.</li>
  </ul>
  <h3>Example</h3>
  <p>If a parent note has the label <code>#child:exampleAttribute</code>, all newly created child notes will inherit the <code>#exampleAttribute</code> label. This can be useful for setting default properties for notes in a specific section.</p>
  <h2>3. Template Inheritance</h2>
  <p>Attributes can also be inherited from <a href="#root/KC1HB96bqqHX">templates</a>. 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.</p>


blobId: V6FJf7j62e4PoCE6Yx5H
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:07.789Z
content:
  <h2>Attributes in Trilium</h2>
  <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>
  </ol>
  <p>These attributes play a crucial role in organizing, categorizing, and enhancing the functionality of notes.</p>
  <p><img src="api/images/exRtMRlEGzyO/attributes.png" alt="Screenshot of 'task template' attributes" /></p>
  <h2>Labels</h2>
  <p>Labels in Trilium can be used for a variety of purposes:</p>
  <ul>
  <li><strong>Metadata</strong>: Assign labels with optional values for categorization, such as <code>#year=1999</code>, <code>#genre="sci-fi"</code>, or <code>#author="Neal Stephenson"</code></li>
  <li><strong>Configuration</strong>: Labels can configure advanced features or settings</li>
  <li><strong>Scripts and Plugins</strong>: Used to tag notes with special metadata, such as the "weight" attribute in the <a href="#root/R7abl2fc6Mxi">Weight Tracker</a></li>
  </ul>
  <p>Labels are also searchable, enhancing note retrieval.</p>
  <h3>Common Labels for Advanced Configuration</h3>
  <ul>
  <li><strong><code>disableVersioning</code></strong>: Disables automatic versioning, ideal for large, unimportant notes like script libraries</li>
  <li><strong><code>versioningLimit</code></strong>: Used to limit the number of revisions for a single note</li>
  <li><strong><code>calendarRoot</code></strong>: Marks the note as the root for <a href="#root/l0tKav7yLHGF">day notes</a>. Only one note should carry this label</li>
  <li><strong><code>archived</code></strong>: Hides notes from default search results and dialogs</li>
  <li><strong><code>excludeFromExport</code></strong>: Excludes notes and their subtrees from export operations</li>
  <li><strong><code>run</code></strong>: Specifies events to trigger scripts (e.g., <code>frontendStartup</code>, <code>hourly</code>)</li>
  <li><strong><code>runAtHour</code></strong>: Defines specific hours for scripts to run, used with <code>#run=hourly</code></li>
  <li><strong><code>disableInclusion</code></strong>: Prevents a script from being included in parent script executions</li>
  <li><strong><code>sorted</code></strong>: Automatically sorts child notes alphabetically by title</li>
  <li><strong><code>top</code></strong>: Keeps the note at the top of its parent's list, useful with <code>sorted</code></li>
  <li><strong><code>hidePromotedAttributes</code></strong>: Hides certain attributes in the note's display</li>
  <li><strong><code>readOnly</code></strong>: Sets the note to read-only mode, applicable to text and code notes</li>
  <li><strong><code>autoReadOnlyDisabled</code></strong>: Disables automatic read-only mode for large notes</li>
  <li><strong><code>appCss</code></strong>: Marks CSS notes used to modify Trilium’s appearance</li>
  <li><strong><code>appTheme</code></strong>: Marks full CSS themes available in Trilium's options</li>
  <li><strong><code>cssClass</code></strong>: Adds a CSS class to the note's representation in the tree</li>
  <li><strong><code>iconClass</code></strong>: Adds a CSS class to the note's icon, useful for distinguishing notes visually. See <a href="#root/p9kXRFAkwN4o">note icons</a></li>
  <li><strong><code>pageSize</code></strong>: Specifies the number of items per page in note listings</li>
  <li><strong><code>customRequestHandler</code> and <code>customResourceProvider</code></strong>: Refer to <a href="#root/J5Ex1ZrMbyJ6">Custom request handler</a></li>
  <li><strong><code>widget</code></strong>: Marks a note as a custom widget, added to Trilium's component tree</li>
  <li><strong><code>workspace</code> and related attributes</strong>: See <a href="#root/9sRHySam5fXb">Workspace</a> for more details</li>
  <li><strong><code>searchHome</code></strong>: Specifies the parent for new search notes</li>
  <li><strong><code>inbox</code></strong>: Designates a default location for new notes created via the sidebar</li>
  <li><strong><code>sqlConsoleHome</code></strong>: Default location for SQL console notes</li>
  <li><strong><code>bookmarked</code> and <code>bookmarkFolder</code></strong>: See <a href="#root/u3YFHC9tQlpm">Bookmarks</a></li>
  <li><strong><code>shareXXX</code></strong>: See <a href="#root/R9pX4DGra2Vt">Sharing</a></li>
  <li><strong><code>keyboardShortcut</code></strong>: Assigns a keyboard shortcut to open the note</li>
  <li><strong><code>displayRelations</code> and <code>hideRelations</code></strong>: Manages the display of note relations</li>
  <li><strong><code>titleTemplate</code></strong>: See <a href="#root/47ZrP6FNuoG8">Default note title</a></li>
  <li><strong><code>template</code></strong>: Makes the note available as a template</li>
  <li><strong><code>toc</code></strong>: Controls the visibility of the table of contents</li>
  <li><strong><code>color</code></strong>: Defines the color of the note in the tree and links</li>
  <li><strong><code>hideChildrenOverview</code></strong>: Hides child notes in the parent note's editor</li>
  <li><strong><code>viewType</code></strong>: Sets the view of child notes (grid or list)</li>
  </ul>
  <h2>Relations</h2>
  <p>Relations define connections between notes, similar to links.</p>
  <h3>Uses</h3>
  <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>
  <ul>
  <li><strong>Event-based Relations</strong>: Such as <code>runOnNoteCreation</code> or <code>runOnNoteChange</code>, which trigger scripts on specific actions</li>
  <li><strong>Other Relations</strong>: Include <code>template</code>, <code>renderNote</code>, <code>widget</code>, and sharing-related relations</li>
  </ul>
  <h2>Multiplicity</h2>
  <p>Attributes in Trilium can be "multivalued", meaning multiple attributes with the same name can coexist.</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 <a href="#root/OFXdgB2nNk1F">Promoted attributes</a>.</p>
  <h2>Attribute Inheritance</h2>
  <p>Trilium supports attribute inheritance, allowing child notes to inherit attributes from their parents. For more information, see <a href="#root/bwZpz2ajCEwO">Attribute inheritance</a>.</p>


blobId: 9qhTZ1OJXWRwk3kvL3pY
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:07.795Z
content:
  <h2>Backup</h2>
  <p>Trilium supports simple backup scheme where it saves copy of the <a href="#root/xjSsCcvVZf6H">document</a> on these events:</p>
  <ul>
  <li>once a day</li>
  <li>once a week</li>
  <li>once a month</li>
  <li>before DB migration to newer version</li>
  </ul>
  <p>So in total you'll have at most 4 backups from different points in time which should protect you from various problems. These backups are stored by default in <code>backup</code> directory placed in the <a href="#root/tAassRL4RSQL">data directory</a>.</p>
  <p>This is only very basic backup solution, and you're encouraged to add some better backup solution - e.g. backing up the <a href="#root/xjSsCcvVZf6H">document</a> to cloud / different computer etc.</p>
  <p>Note that <a href="#root/cbkrhQjrkKrh">synchronization</a> provides also some backup capabilities by its nature of distributing the data to other computers.</p>
  <h2>Restoring backup</h2>
  <p>Let's assume you want to restore the weekly backup, here's how to do it:</p>
  <ul>
  <li>find <a href="#root/tAassRL4RSQL">data directory</a> Trilium uses - easy way is to open "About Trilium Notes" from "Menu" in upper left corner and looking at "data directory"<ul>
  <li>I'll refer to <code>~/trilium-data</code> as data directory from now on</li>
  </ul>
  </li>
  <li>find <code>~/trilium-data/backup/backup-weekly.db</code> - this is the <a href="#root/xjSsCcvVZf6H">document</a> backup</li>
  <li>at this point stop/kill Trilium</li>
  <li>delete <code>~/trilium-data/document.db</code>, <code>~/trilium-data/document.db-wal</code> and <code>~/trilium-data/document.db-shm</code> (latter two files are auto generated)</li>
  <li>copy and rename this <code>~/trilium-data/backup/backup-weekly.db</code> to <code>~/trilium-data/document.db</code></li>
  <li>make sure that the file is writable, e.g. with <code>chmod 600 document.db</code></li>
  <li>start Trilium again</li>
  </ul>
  <p>If you have configured sync then you need to do it across all members of the sync cluster, otherwise older version (restored backup) of the document will be detected and synced to the newer version.</p>
  <h2>Disabling backup</h2>
  <p>Although this is not recommended, it is possible to disable backup in <code>config.ini</code> in the <a href="#root/tAassRL4RSQL">data directory</a>:</p>
  <pre><code class="language-text-x-trilium-auto">[General]
  ... some other configs
  # set to true to disable backups (e.g. because of limited space on server)
  noBackup=true</code></pre><p>You can also review the <a href="#root/Gzjqa934BdH4">configuration</a> file to provide all <code>config.ini</code> values as environment variables instead. </p>
  <p>See <a href="https://github.com/TriliumNext/Notes/blob/master/config-sample.ini">sample config</a>. %%{WARNING}%%</p>


blobId: 2lMFA7BzkXKiwqk0Hu4F
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:07.798Z
content:
  <h2>Book Notes in Trilium</h2>
  <p>A <strong>Book Note</strong> in Trilium is a special type of <a href="#root/BFs8mudNFgCS">note</a> designed to display the contents of its child notes sequentially, creating a linear, book-like reading experience. This format is particularly useful for viewing multiple smaller notes in a cohesive, continuous manner.</p>
  <p><img src="api/images/kLoEdvFsjOqB/book-note.png" alt="Book Note Example" /></p>
  <p>In the example above, the "node.js" note on the left panel contains several child notes. The right panel displays the content of these child notes as a single continuous document.</p>
  <h2>Features</h2>
  <h3>Linear Display</h3>
  <p>The Book Note format compiles the contents of all child notes into one continuous view. This makes it ideal for reading extensive information broken into smaller, manageable segments.</p>
  <h3>Grid View Option</h3>
  <p>Trilium also offers a "Grid View" option within the Book Note properties. This view presents the child notes in a grid format, allowing for a more visual navigation experience.</p>
  <p><img src="api/images/DF89NW1ZLkX0/book-note-pictures.png" alt="Grid View Example" /></p>
  <p>Switching between these views can be easily managed through the Book Note's settings (or <code>viewType</code> attribu), allowing users to choose the format that best suits their reading or navigation preferences.</p>


blobId: vgCwSYJRyjJEWdqd82xa
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:07.801Z
content:
  <h2>Bookmarks</h2>
  <p>To easily access selected notes, you can bookmark them. See demo:</p>
  <p><img src="api/images/sag6ww9q4pgW/bookmarks.gif" alt="" /></p>
  <h2>Bookmark folder</h2>
  <p>Space in the left panel is limited, and you might want to bookmark many items. One possible solution is to bookmark a folder, so it shows its children:</p>
  <p><img src="api/images/HEtnpiQrEvjl/bookmark-folder.png" alt="" /></p>
  <p>To do this, you need to add a <code>#bookmarkFolder</code> label to the note.</p>


blobId: XTz8cgAowvFG5udJHyO4
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:07.803Z
content:
  <h2>Canvas-note</h2>
  <p>(Since trilium v0.52)</p>
  <p>Canvas note use the excalidraw library to allow handwritten notes with mouse, pen or touch on an infinite canvas. It also supports basic diagramming, text and garphics input.</p>
  <p><img src="api/images/IYMnSG4HrC1K/Canvas-note image.png" alt="grafik" /></p>


blobId: XqeoJkg4WMeJCAFumIUw
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:07.809Z
content:
  <h2>Cloning notes</h2>
  <h2>Motivation</h2>
  <p>Trilium's core feature is the ability to structure your notes into hierarchical tree-like structure.</p>
  <p>It is expected then that you'll have an elaborate and deep note hierarchy - each subtree will represent a more refined and specialized view of your knowledge base.</p>
  <p>This is a pretty powerful approach, but it also carries a hidden assumption that each "subtopic" is "owned" by one parent. I'll illustrate this with an example - let's say my basic structure is this:</p>
  <ul>
  <li>Technology<ul>
  <li>Programming<ul>
  <li>Kotlin</li>
  <li>JavaScript</li>
  </ul>
  </li>
  <li>Operating systems<ul>
  <li>Linux</li>
  <li>Windows</li>
  </ul>
  </li>
  </ul>
  </li>
  </ul>
  <p>Now, I'm starting to learn about <a href="https://en.wikipedia.org/wiki/Bash_(Unix_shell)">Bash</a> and would like to create notes related to this topic. But now I'm facing a problem of where to categorize this. The issue here is that Bash is both a programming language and a tool (shell) very much tied into Linux. It seems it belongs to both of these, I can't (and don't want to) choose one over the other.</p>
  <h2>Solution</h2>
  <p>The solution to the problem shown above is to allow notes to have multiple parents.</p>
  <p>I call these "clones", but that is a bit misleading - there's no original and cloned note - the notes in both of the parents categories are identical.</p>
  <p>Another misleading thing about "cloning" is that it suggests that a copy of the note has been made. That's not really true, the note itself stays in just one original, it is just referenced in multiple places in the tree hierarchy. So changing it in one category changes it in all the others, because they're all the same note.</p>
  <p>Here's the final structure with cloning:</p>
  <ul>
  <li>Technology<ul>
  <li>Programming<ul>
  <li>Kotlin</li>
  <li>JavaScript</li>
  <li>Bash<ul>
  <li>some sub-notes ...</li>
  </ul>
  </li>
  </ul>
  </li>
  <li>Operating systems<ul>
  <li>Linux<ul>
  <li>Bash<ul>
  <li>some sub-notes ...</li>
  </ul>
  </li>
  </ul>
  </li>
  <li>Windows</li>
  </ul>
  </li>
  </ul>
  </li>
  </ul>
  <p>So now the "Bash" subtree appears on multiple locations in the hierarchy. Both the Bash subtrees are the same and contain the same sub-categories and notes.</p>
  <h3>Demo</h3>
  <p><img src="api/images/BqvIJUHkWrvH/create-clone.gif" alt="" /></p>
  <p>In the demo, you can see how a clone can be created using the context menu. It's possible to do this also using the Add Link dialog or with CTRL+C and CTRL+V <a href="#root/A9Oc6YKKc65v">keyboard shortcuts</a>.</p>
  <p>As seen in the demo, you can view the list of all available clones in the "Note Paths" tab in the Ribbon toolbar.</p>
  <p>Titles of cloned notes in the tree view have an asterisk to the right to easily see that the note is also placed into some other location.</p>
  <h2>Prefix</h2>
  <p>Since notes can be categorized into multiple places, it's recommended to choose a generalized name that fits into all locations instead of something more specific to avoid confusion. In some cases this isn't possible so Trilium provides "branch prefixes", which is shown before the note name in the tree and as such provides a specific kind of context. The prefix is location specific, so it's displayed only in the tree pane.</p>
  <h2>Deleting notes/clones</h2>
  <p>With clones, it might not be immediately obvious how deleting works.</p>
  <p>If you try to delete a note, it works like this:</p>
  <ol>
  <li>if the note has multiple clones, delete just this clone and leave the actual note (and its other clones) as it is.</li>
  <li>if this note doesn't have any other clones, delete the note<ul>
  <li>Run the whole process starting with 1. on all note's children notes</li>
  </ul>
  </li>
  </ol>


blobId: iDTYmXAetlaYy7kXAj0m
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:07.812Z
content:
  <h2>Code-notes</h2>
  <p>Trilium supports creating "code" notes, i.e. notes which contain some sort of formal code - be it programming language (C++, JavaScript), structured data (JSON, XML) or other types of codes (CSS etc.).</p>
  <p>This can be useful for a few things:</p>
  <ul>
  <li>computer programmers can store code snippets as notes with syntax highlighting</li>
  <li>JavaScript code notes can be executed inside Trilium for some extra functionality<ul>
  <li>we call such JavaScript code notes "scripts" - see <a href="#root/CdNpE2pqjmI6">Scripts</a></li>
  </ul>
  </li>
  <li>JSON, XML etc. can be used as storage for structured data (typically used in conjunction with scripting)</li>
  </ul>
  <p><img src="api/images/8jgXl1RUGL4H/code-note.png" alt="" /></p>
  <h2>Extra languages</h2>
  <p>Trilium supports syntax highlighting for many languages, but by default displays only some of them (to reduce the number of items). You can add extra languages in Options -&gt; Code notes.</p>
  <h2>Code blocks</h2>
  <p>An alternative to the code note is a "code block" - feature of a text note which can add short snippets of code to the text editor. Starting with TriliumNext v0.90.12, the code blocks also support syntax highlighting.</p>
  <p><img src="api/images/Y7RLSw20haCB/code-block.png" alt="" /></p>


blobId: 3sXHrUe27XgXffiySPJX
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:07.816Z
content:
  <h2>Configuration</h2>
  <p>Trilium supports configuration via a file named <code>config.ini</code> and environment variables. Please review the file named <a href="https://github.com/TriliumNext/Notes/blob/develop/config-sample.ini">config-sample.ini</a> in the <a href="https://github.com/TriliumNext/Notes">Notes</a> repository to see what values are supported.</p>
  <p>You can provide the same values via environment variables instead of the <code>config.ini</code> file, and these environment variables use the following format:</p>
  <ol>
  <li>Environment variables should be prefixed with <code>TRILIUM_</code> and use underscores to represent the INI section structure.</li>
  <li>The format is: <code>TRILIUM_&lt;SECTION&gt;_&lt;KEY&gt;=&lt;VALUE&gt;</code></li>
  <li>The environment variables will override any matching values from config.ini</li>
  </ol>
  <p>For example, if you have this in your config.ini:</p>
  <pre><code class="language-text-x-toml">[Network]
  host=localhost
  port=8080</code></pre><p>You can override these values using environment variables:</p>
  <pre><code class="language-text-x-sh">TRILIUM_NETWORK_HOST=0.0.0.0
  TRILIUM_NETWORK_PORT=9000</code></pre><p>The code will:</p>
  <ol>
  <li>First load the config.ini file as before</li>
  <li>Then scan all environment variables for ones starting with <code>TRILIUM_</code></li>
  <li>Parse these variables into section/key pairs</li>
  <li>Merge them with the config from the file, with environment variables taking precedence</li>
  </ol>


blobId: 9mmKNrNpm0t6kEHLDHRU
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:07.821Z
content:
  <h2>Custom request handler</h2>
  <p>Trilium provides a mechanism for <a href="#root/CdNpE2pqjmI6">scripts</a> to open a public REST endpoint. This opens a way for various integrations with other services - a simple example would be creating new note from Slack by issuing a slash command (e.g. <code>/trilium buy milk</code>).</p>
  <h2>Create note from outside Trilium</h2>
  <p>Let's take a look at an example. The goal is to provide a REST endpoint to which we can send title and content and Trilium will create a note.</p>
  <p>We'll start with creating a JavaScript backend <a href="#root/6f9hih2hXXZk">code note</a> containing:</p>
  <pre><code class="language-text-x-trilium-auto">const {req, res} = api;
  const {secret, title, content} = req.body;

  if (req.method == 'POST' &amp;&amp; secret === 'secret-password') {
      // notes must be saved somewhere in the tree hierarchy specified by a parent note. 
      // This is defined by a relation from this code note to the "target" parent note
      // alternetively you can just use constant noteId for simplicity (get that from "Note Info" dialog of the desired parent note)
      const targetParentNoteId = api.currentNote.getRelationValue('targetNote');
      
      const {note} = api.createTextNote(targetParentNoteId, title, content);
      const notePojo = note.getPojo();

      res.status(201).json(notePojo);
  }
  else {
      res.send(400);
  }</code></pre><p>This script note has also following two attributes:</p>
  <ul>
  <li>label <code>#customRequestHandler</code> with value <code>create-note</code></li>
  <li>relation <code>~targetNote</code> pointing to a note where new notes should be saved</li>
  </ul>
  <h3>Explanation</h3>
  <p>Let's test this by using an HTTP client to send a request:</p>
  <pre><code class="language-text-x-trilium-auto">POST http://my.trilium.org/custom/create-note
  Content-Type: application/json

  {
    "secret": "secret-password",
    "title": "hello",
    "content": "world"
  }+++++++++++++++++++++++++++++++++++++++++++++++</code></pre><p>Notice the <code>/custom</code> part in the request path - Trilium considers any request with this prefix as "custom" and tries to find a matching handler by looking at all notes which have <code>customRequestHandler</code> <a href="#root/zEY4DaJG4YT5">label</a>. Value of this label then contains a regular expression which will match the request path (in our case trivial regex "create-note").</p>
  <p>Trilium will then find our code note created above and execute it. <code>api.req</code>, <code>api.res</code> are set to <a href="https://expressjs.com/en/api.html#req">request</a> and <a href="https://expressjs.com/en/api.html#res">response</a> objects from which we can get details of the request and also respond.</p>
  <p>In the code note we check the request method and then use trivial authentication - keep in mind that these endpoints are by default totally unauthenticated, and you need to take care of this yourself.</p>
  <p>Once we pass these checks we will just create the desired note using <a href="#root/GLks18SNjxmC">Script API</a>.</p>
  <h2>Custom resource provider</h2>
  <p>Another common use case is that you want to just expose a file note - in such case you create label <code>customResourceProvider</code> (value is again path regex).</p>
  <p>Note: The file that is supposed to be exposed needs to have a label <code>#customResourceProvider="fonts/myFont.woff</code></p>
  <p>For example, your file is in custom/fonts, you can call it via <code>custom/fonts/myFont.woff</code>.</p>
  <h2>Advanced concepts</h2>
  <p><code>api.req</code> and <code>api.res</code> are Express.js objects - you can always look into its <a href="https://expressjs.com/en/api.html">documentation</a> for details.</p>
  <h3>Parameters</h3>
  <p>REST request paths often contain parameters in the URL, e.g.:</p>
  <pre><code class="language-text-x-trilium-auto">http://my.trilium.org/custom/notes/123</code></pre><p>The last part is dynamic so the matching of the URL must also be dynamic - for this reason the matching is done with regular expressions. Following <code>customRequestHandler</code> value would match it:</p>
  <pre><code class="language-text-x-trilium-auto">notes/([0-9]+)</code></pre><p>Additionally, this also defines a matching group with the use of parenthesis which then makes it easier to extract the value. The matched groups are available in <code>api.pathParams</code>:</p>
  <pre><code class="language-text-x-trilium-auto">const noteId = api.pathParams[0];</code></pre><p>Often you also need query params (as in e.g. <code>http://my.trilium.org/custom/notes?noteId=123</code>), you can get those with standard express <code>req.query.noteId</code>.</p>


blobId: qTdDzY1CdEzTYL832UyN
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:07.826Z
content:
  <h2>Custom-widget</h2>
  <p>It's possible to create custom widget in three possible locations where you can display your custom content.</p>
  <p>Positions are:</p>
  <ul>
  <li><code>left-pane</code></li>
  <li><code>center-pane</code></li>
  <li><code>note-detail-pane</code> - located within <code>center-pane</code>, but specific to note (split)</li>
  <li><code>right-pane</code></li>
  </ul>
  <h2>Example - word count widget</h2>
  <p>Create a code note of type JS frontend and <strong>give it a</strong> <code>**#widget**</code> <strong>label</strong>.</p>
  <pre><code class="language-text-x-trilium-auto">/*
   * This defines a custom widget which displays number of words and characters in a current text note.
   * To be activated for a given note, add label 'wordCount' to the note, you can also make it inheritable and thus activate it for the whole subtree.
   * 
   * See it in action in "Books" and its subtree.
   */
  const TPL = `<div>
      <strong>Word count: </strong>
      <span class="word-count"></span>

       

      <strong>Character count: </strong>
      <span class="character-count"></span>
  </div>`;

  class WordCountWidget extends api.NoteContextAwareWidget {
      static get parentWidget() { return 'center-pane'; }

      get position() { return 100; } // higher value means position towards the bottom/right

      isEnabled() {
          return super.isEnabled()
              &amp;&amp; this.note.type === 'text'
              &amp;&amp; this.note.hasLabel('wordCount');
      }

      doRender() {
          this.$widget = $(TPL);
          this.$wordCount = this.$widget.find('.word-count');
          this.$characterCount = this.$widget.find('.character-count');
          return this.$widget;
      }

      async refreshWithNote(note) {
          const {content} = await note.getNoteComplement();

          const text = $(content).text(); // get plain text only

          const counts = this.getCounts(text);

          this.$wordCount.text(counts.words);
          this.$characterCount.text(counts.characters);
      }

      getCounts(text) {
          const chunks = text
              .split(/[\s-+:,/\\]+/)
              .filter(chunk =&gt; chunk !== '');

          let words;

          if (chunks.length === 1 &amp;&amp; chunks[0] === '') {
              words = 0;
          }
          else {
              words = chunks.length;
          }

          const characters = chunks.join('').length;

          return {words, characters};
      }

      async entitiesReloadedEvent({loadResults}) {
          if (loadResults.isNoteContentReloaded(this.noteId)) {
              this.refresh();
          }
      }
  }

  module.exports = WordCountWidget;</code></pre><p>After you make changes it is necessary to restart Trilium so that the layout can be rebuilt.</p>
  <h3>Example screenshot</h3>
  <p>On the bottom you can see the resulting widget:</p>
  <p><img src="api/images/3sCPPL0LEC1S/Custom-widget image.png" alt="" /></p>


blobId: DrDYlUIJKnAWSpYmyYhE
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:07.832Z
content:
  <h2>Data-directory</h2>
  <p>Data directory contains:</p>
  <ul>
  <li><code>document.db</code> - <a href="#root/wX4HbRucYSDD">database</a></li>
  <li><code>config.ini</code> - instance level settings like port on which the Trilium application runs</li>
  <li><code>backup</code> - contains automatically <a href="#root/ODY7qQn5m2FT">backup</a> of documents</li>
  <li><code>log</code> - contains application log files</li>
  </ul>
  <h2>Location</h2>
  <p>Easy way how to find out which data directory Trilium uses is to look at the "About Trilium Notes" dialog (from "Menu" in upper left corner):</p>
  <p><img src="api/images/0QpFiijcbMem/about-trilium-data-dir.png" alt="" /></p>
  <p>Here's how the location is decided:</p>
  <p>Data directory is normally named <code>trilium-data</code> and it is stored in:</p>
  <ul>
  <li><code>/home/[user]/.local/share</code> for Linux</li>
  <li><code>C:\Users\[user]\AppData\Roaming</code> for Windows Vista and up</li>
  <li><code>/Users/[user]/Library/Application Support</code> for Mac OS</li>
  <li>user's home is a fallback if some of the paths above don't exist</li>
  <li>user's home is also a default setup for [[docker|Docker server installation]]</li>
  </ul>
  <p>If you want to back up your Trilium data, just backup this single directory - it contains everything you need.</p>
  <h3>Changing the location of data directory</h3>
  <p>If you want to use some other location for the data directory than the default one, you may change it via TRILIUM_DATA_DIR environment variable to some other location:</p>
  <h4>Linux</h4>
  <pre><code class="language-text-x-trilium-auto">export TRILIUM_DATA_DIR=/home/myuser/data/my-trilium-data</code></pre><h4>Mac OS X</h4>
  <p>You need to create a .plist file under <code>~/Library/LaunchAgents</code> to load it properly each login.</p>
  <p>To load it manually, u need to use <code>launchctl setenv TRILIUM_DATA_DIR &lt;yourpath&gt;</code></p>
  <p>Here is a pre-defined template, where you just need to add your path to:</p>
  <pre><code class="language-text-x-trilium-auto">



      
          Label
          set.trilium.env
          RunAtLoad
          
          ProgramArguments
          
              launchctl
              setenv
              TRILIUM_DATA_DIR
              /Users/YourUserName/Library/Application Support/trilium-data
          
      
  </code></pre><h3>Create a script to run with specific data directory</h3>
  <p>An alternative to globally setting environment variable is to run only the Trilium Notes with this environment variable. This then allows for different setup styles like two <a href="#root/wX4HbRucYSDD">database</a> instances or "portable" installation.</p>
  <p>To do this in unix based systems simply run trilium like this:</p>
  <pre><code class="language-text-x-trilium-auto">TRILIUM_DATA_DIR=/home/myuser/data/my-trilium-data trilium</code></pre><p>You can then save the above command as a shell script on your path for convenience.</p>
  <h3>Fine-grained directory/path location</h3>
  <p>It's possible to configure e.g. backup and log directories separately, with following env. variables:</p>
  <ul>
  <li><code>TRILIUM_DOCUMENT_PATH</code></li>
  <li><code>TRILIUM_BACKUP_DIR</code></li>
  <li><code>TRILIUM_LOG_DIR</code></li>
  <li><code>TRILIUM_ANONYMIZED_DB_DIR</code></li>
  <li><code>TRILIUM_CONFIG_INI_PATH</code></li>
  </ul>
  <p>If these are not set, default paths within the data directory will be used.</p>


blobId: mBmeNlPE8iHibTl9HOId
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:07.837Z
content:
  <h2>Database</h2>
  <p>Your Trilium data is stored in a <a href="https://www.sqlite.org">SQLite</a> database which contains all notes, tree structure, metadata, and most of the configuration. The database file is named <code>document.db</code> and is stored in the application's default <a href="#root/tAassRL4RSQL">data directory</a>.</p>
  <h2>Demo Notes</h2>
  <p>When you run Trilium for the first time, it will generate a new database containing demo notes. These notes showcase its many features, such as:</p>
  <ul>
  <li><a href="#root/iRwzGnHPzonm">Relation Map</a></li>
  <li><a href="#root/l0tKav7yLHGF">Day Notes</a></li>
  <li><a href="#root/R7abl2fc6Mxi">Weight Tracker</a></li>
  <li><a href="#root/xYjQUYhpbUEW">Task Manager</a></li>
  <li><a href="#root/Wy267RK4M69c">Custom CSS Themes</a></li>
  </ul>
  <h3>Restoring Demo Notes</h3>
  <p>There are some cases in which you may want to restore the original demo notes. For example, if you experimented with some of the more advanced features and want to see the original reference, or if you simply want to explore the latest version of the demo notes, which might showcase new features.</p>
  <p>You can easily restore the demo notes by using Trilium's built-in import feature by importing them:</p>
  <ul>
  <li>Download <a href="https://github.com/TriliumNext/Notes/raw/develop/db/demo.zip">this .zip archive</a> with the latest version of the demo notes</li>
  <li>Right click on any note in your tree under which you would like the demo notes to be imported</li>
  <li>Click "Import into note"</li>
  <li>Select the .zip archive to import it</li>
  </ul>
  <h2>Manually Modifying the Database</h2>
  <p>Trilium provides a lot of flexibility, and with it, opportunities for advanced users to tweak it. If you need to explore or modify the database directly, you can use a tool such as <a href="https://sqlitebrowser.org/">SQLite Browser</a> to work directly on the database file.</p>
  <p>If you are doing any advanced development or troubleshooting where you manually modify the database, you might want to consider creating backups of your <code>document.db</code> file.</p>
  <h2>How to Reset the Database</h2>
  <p>If you are experimenting with Trilium and want to return it to its original state, you can do that by deleting the current database. When you restart the application, it will generate a new database containing the original demo notes.</p>
  <p>To delete the database, simply go to the <a href="#root/tAassRL4RSQL">data directory</a> and delete the <code>document.db</code> file (and any other files starting with <code>document.db</code>).</p>
  <p>If you do not need to preserve any configurations that might be stored in the <code>config.ini</code> file, you can just delete all of the <a href="#root/tAassRL4RSQL">data directory's</a> contents to fully restore the application to its original state. You can also review the <a href="#root/Gzjqa934BdH4">configuration</a> file to provide all <code>config.ini</code> values as environment variables instead. </p>


blobId: JGXvzdoW8WqiBmNRXin6
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:07.844Z
content:
  <h2>Day-notes</h2>
  <p>A common pattern in note-taking is that a lot of notes will be centered around a certain date - e.g. you have some tasks which needs to be done on a certain date, you have meeting minutes from a certain date, you have your thoughts etc. and it all revolves around a date on which they occurred. For this reason, it makes sense to create a certain "day workspace" which will centralize all those notes relevant for a certain date.</p>
  <p>For this, Trilium provides a concept of "day note". Trilium semi-automatically generates a single note for each day. Under this note you can save all those relevant notes.</p>
  <p>Select an existing day note, and the menubar contains a calendar widget. Select any day to create a note for that day. <img src="api/images/BvoF8mgyC7OD/Day-notes image.png" alt="image" /></p>
  <p>This pattern works well also because of [[cloning|Cloning notes]] functionality - note can appear in multiple places in the note tree, so besides appearing under day note, it can also be categorized into other notes.</p>
  <h2>Demo</h2>
  <p><img src="api/images/nQf1irAyZrZl/day-notes.png" alt="" /></p>
  <p>You can see the structure of day notes appearing under "Journal" note - there's a note for the whole year 2017, under it, you have "12 - December" which then contains "18 - Monday". This is our "day note" which contains some text in its content and also has some child notes (some of them are from <a href="#root/xYjQUYhpbUEW">Task manager</a>).</p>
  <p>You can also notice how this day note has <a href="#root/OFXdgB2nNk1F">promoted attribute</a> "weight" where you can track your daily weight. This data is then used in <a href="#root/R7abl2fc6Mxi">Weight tracker</a>.</p>
  <h2>Templates</h2>
  <p>Trilium provides <a href="#root/KC1HB96bqqHX">template</a> functionality, and it could be used together with day notes.</p>
  <p>You can define one of the following relations on the root of the journal (identified by <code>#calendarRoot</code> label):</p>
  <ul>
  <li>yearTemplate</li>
  <li>monthTemplate</li>
  <li>dateTemplate</li>
  </ul>
  <p>All of these are relations. When Trilium creates a new note for year or month or date, it will take a look at the root and attach a corresponding <code>~template</code> relation to the newly created role. Using this, you can e.g. create your daily template with e.g. checkboxes for daily routine etc.</p>
  <h2>Date pattern</h2>
  <p>It's possible to customize the title of generated date notes by defining a <code>#datePattern</code> label on a root calendar note (identified by <code>#calendarRoot</code> label). Following are possible values:</p>
  <ul>
  <li><code>{dayInMonthPadded} - {weekDay}</code> day notes are named e.g. "24 - Monday"</li>
  <li><code>{dayInMonthPadded}: {weekDay3}</code> day notes are named e.g. "24: Mon"</li>
  <li><code>{dayInMonthPadded}: {weekDay2}</code> day notes are named e.g. "24: Mo"</li>
  <li><code>{isoDate} - {weekDay}</code> day notes are named e.g. "2020-12-24 - Monday"</li>
  <li><code>{ordinal}</code> is replaced with the ordinal date (e.g. 1st, 2nd, 3rd) etc.</li>
  </ul>
  <h2>Month pattern</h2>
  <p>It is also possible to customize the title of generated month notes through the <code>#monthPattern</code> attribute, much like <code>#datePattern</code>. The options are:</p>
  <ul>
  <li><code>{monthNumberPadded}</code> results in a number like <code>09</code> for September, and <code>11</code> for November</li>
  <li><code>{month}</code> results in the full month name (e.g. <code>September</code> or <code>October</code>)</li>
  <li><code>{shortMonth3}</code> is replaced with the first 3 letters of the month, e.g. Jan, Feb, etc.</li>
  <li><code>{shortMonth4}</code> is replaced with the first 4 letters of the month, e.g. Sept, Octo, etc.</li>
  </ul>
  <p>The default is <code>{monthNumberPadded} - {month}</code></p>
  <h2>Implementation</h2>
  <p>Trilium has some special support for day notes in the form of <a href="https://triliumnext.github.io/Notes/backend_api/BackendScriptApi.html">backend Script API</a> - see e.g. getDayNote() function.</p>
  <p>Day (and year, month) notes are created with a label - e.g. <code>#dateNote="2018-08-16"</code> this can then be used by other scripts to add new notes to day note etc.</p>
  <p>Journal also has relation <code>child:child:child:template=Day template</code> (see [[attribute inheritance]]) which effectively adds [[template]] to day notes (grand-grand-grand children of Journal).</p>


blobId: pMPi6XA9HBDmYbkNXczQ
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:07.848Z
content:
  <h2>Default-note-title</h2>
  <p>When a new note is created, its name is by default "new note". In some cases, it can be desirable to have a different or even a dynamic default note title.</p>
  <p>For this use case, Trilium (since v0.52) supports <code>#titleTemplate</code> <a href="#root/zEY4DaJG4YT5">label</a>. You can create such a label for a given note, assign it a value, and this value will be used as a default title when creating child notes. As with other labels, you can make it inheritable to apply recursively, and you can even place it on the root note to have it applied globally everywhere.</p>
  <p>As an example use case, imagine you collect books you've read in a given year like this:</p>
  <ul>
  <li>2022 Books<ul>
  <li>Neal Stephenson: Anathem, 2008</li>
  <li>Franz Kafka: Die Verwandlung, 1915</li>
  </ul>
  </li>
  </ul>
  <p>Now, to the parent note "2022 Books" you can assign label <code>#titleTemplate="[Author name]: [Book title], [Publication year]"</code>.</p>
  <p>And all children of "2022 Books" will be created with initial title "[Author name]: [Book title], [Publication year]". There's no artificial intelligence here, the idea is to just prompt you to manually fill in the pieces of information into the note title by yourself.</p>
  <h2>Dynamic value</h2>
  <p>The value of <code>#titleTemplate</code> is evaluated at the point of note's creation as a JavaScript string, which means it can be enriched with the help of JS string interpolation with dynamic data.</p>
  <p>As an example, imagine you collect server outage incidents and write some notes. It looks like this:</p>
  <ul>
  <li>Incidents<ul>
  <li>2022-05-09: System crash</li>
  <li>2022-05-15: Backup delay</li>
  </ul>
  </li>
  </ul>
  <p>You can automatize the date assignment by assigning a label <code>#titleTemplate="${now.format('YYYY-MM-DD')}: "</code> to the parent note "Incidents". Whenever a new child note is created, the title template is evaluated with the injected <a href="https://day.js.org/docs/en/display/format">now</a> object.</p>
  <p>Second variable injected is <a href="https://triliumnext.github.io/Notes/backend_api/BNote.html">parentNote</a>, an example could be <code>#titleTemplate="${parentNote.getLabelValue('authorName')}'s literary works"</code>.</p>
  <p>See also [[<a href="#root/KC1HB96bqqHX">template</a>]] which provides similar capabilities, including default note's content.</p>


blobId: Yo6R2pMkyeX6XXRAXu8h
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:07.851Z
content:
  <h2>Desktop Installation Guide for Trilium</h2>
  <p>To install Trilium on your desktop, follow these steps:</p>
  <ol>
  <li><strong>Download the Latest Release</strong>: Obtain the appropriate binary release for your operating system from the <a href="https://github.com/TriliumNext/Notes/releases/latest">latest release page</a> on GitHub.</li>
  <li><strong>Extract the Package</strong>: Unzip the downloaded package to a location of your choice.</li>
  <li><strong>Run the Application</strong>: Launch Trilium by executing the <code>trilium</code> executable found within the unzipped folder.</li>
  </ol>
  <h2>Startup Scripts</h2>
  <p>Trilium offers various startup scripts to customize your experience:</p>
  <ul>
  <li><p><strong><code>trilium-no-cert-check</code></strong>: Starts Trilium without validating <a href="#root/l2VkvOwUNfZj">TLS certificates</a>, useful if connecting to a server with a self-signed certificate.</p>
  <ul>
  <li>Alternatively, set the <code>NODE_TLS_REJECT_UNAUTHORIZED=0</code> environment variable before starting Trilium.</li>
  </ul>
  </li>
  <li><p><strong><code>trilium-portable</code></strong>: Launches Trilium in portable mode, where the <a href="#root/tAassRL4RSQL">data directory</a> is created within the application's directory, making it easy to move the entire setup.</p>
  </li>
  <li><p><strong><code>trilium-safe-mode</code></strong>: Boots Trilium in "safe mode," disabling any startup scripts that might cause the application to crash.</p>
  </li>
  </ul>
  <h2>Synchronization</h2>
  <p>For Trilium desktp users who wish to synchronize their data with a server instance, refer to the <a href="#root/cbkrhQjrkKrh">Synchronization Guide</a> for detailed instructions.</p>


blobId: GDuu85FipANahqEbPCTY
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:07.858Z
content:
  <h2>Docker Server Installation for Trilium</h2>
  <p>Official docker images are published on docker hub for <strong>AMD64</strong>, <strong>ARMv7</strong> and <strong>ARM64/v8</strong>: <a href="https://hub.docker.com/r/triliumnext/notes/">https://hub.docker.com/r/triliumnext/notes/</a></p>
  <h2>Prerequisites</h2>
  <p>Ensure Docker is installed on your system.</p>
  <p>If you need help installing Docker, reference the <a href="https://docs.docker.com/engine/install/">Docker Installation Docs</a></p>
  <p><strong>Note:</strong> Trilium's Docker container requires root privileges to operate correctly.</p>
  <blockquote>
  <p>[!WARNING]
  If you're using a SMB/CIFS share or folder as your Trilium data directory, <a href="https://github.com/TriliumNext/Notes/issues/415#issuecomment-2344824400">you'll need</a> to add the mount options of <code>nobrl</code> and <code>noperm</code> when mounting your SMB share. </p>
  </blockquote>
  <h2>Running with Docker Compose</h2>
  <h3>Grab the latest docker-compose.yml:</h3>
  <pre><code class="language-text-x-trilium-auto">wget https://raw.githubusercontent.com/TriliumNext/Notes/master/docker-compose.yml</code></pre><p>Optionally, edit the <code>docker-compose.yml</code> file to configure the container settings prior to starting it. Unless configured otherwise, the data directory will be <code>~/trilium-data</code> and the container will be accessible at port 8080.</p>
  <h3>Start the container:</h3>
  <p>Run the following command to start the container in the background:</p>
  <pre><code class="language-text-x-trilium-auto">docker compose up -d</code></pre><h2>Running without Docker Compose / Further Configuration</h2>
  <h3>Pulling the Docker Image</h3>
  <p>To pull the image, use the following command, replacing <code>[VERSION]</code> with the desired version or tag, such as <code>v0.91.6</code> or just <code>latest</code>. (See published tag names at <a href="https://hub.docker.com/r/triliumnext/notes/tags">https://hub.docker.com/r/triliumnext/notes/tags</a>.):</p>
  <pre><code class="language-text-x-trilium-auto">docker pull triliumnext/notes:v0.91.6</code></pre><p><strong>Warning:</strong> Avoid using the "latest" tag, as it may automatically upgrade your instance to a new minor version, potentially disrupting sync setups or causing other issues.</p>
  <h3>Preparing the Data Directory</h3>
  <p>Trilium requires a directory on the host system to store its data. This directory must be mounted into the Docker container with write permissions.</p>
  <h3>Running the Docker Container</h3>
  <h4>Local Access Only</h4>
  <p>Run the container to make it accessible only from the localhost. This setup is suitable for testing or when using a proxy server like Nginx or Apache.</p>
  <pre><code class="language-text-x-trilium-auto">sudo docker run -t -i -p 127.0.0.1:8080:8080 -v ~/trilium-data:/home/node/trilium-data triliumnext/notes:[VERSION]</code></pre><ol>
  <li>Verify the container is running using <code>docker ps</code>.</li>
  <li>Access Trilium via a web browser at <code>127.0.0.1:8080</code>.</li>
  </ol>
  <h4>Local Network Access</h4>
  <p>To make the container accessible only on your local network, first create a new Docker network:</p>
  <pre><code class="language-text-x-trilium-auto">docker network create -d macvlan -o parent=eth0 --subnet 192.168.2.0/24 --gateway 192.168.2.254 --ip-range 192.168.2.252/27 mynet</code></pre><p>Then, run the container with the network settings:</p>
  <pre><code class="language-text-x-trilium-auto">docker run --net=mynet -d -p 127.0.0.1:8080:8080 -v ~/trilium-data:/home/node/trilium-data triliumnext/notes:-latest</code></pre><p>To set a different user ID (UID) and group ID (GID) for the saved data, use the <code>USER_UID</code> and <code>USER_GID</code> environment variables:</p>
  <pre><code class="language-text-x-trilium-auto">docker run --net=mynet -d -p 127.0.0.1:8080:8080 -e "USER_UID=1001" -e "USER_GID=1001" -v ~/trilium-data:/home/node/trilium-data triliumnext/notes:-latest</code></pre><p>Find the local IP address using <code>docker inspect [container_name]</code> and access the service from devices on the local network.</p>
  <pre><code class="language-text-x-trilium-auto">docker ps
  docker inspect [container_name]</code></pre><h4>Global Access</h4>
  <p>To allow access from any IP address, run the container as follows:</p>
  <pre><code class="language-text-x-trilium-auto">docker run -d -p 0.0.0.0:8080:8080 -v ~/trilium-data:/home/node/trilium-data triliumnext/notes:[VERSION]</code></pre><p>Stop the container with <code>docker stop &lt;CONTAINER ID&gt;</code>, where the container ID is obtained from <code>docker ps</code>.</p>
  <h3>Custom Data Directory</h3>
  <p>For a custom data directory, use:</p>
  <pre><code class="language-text-x-trilium-auto">-v ~/YourOwnDirectory:/home/node/trilium-data triliumnext/notes:[VERSION]</code></pre><p>If you want to run your instance in a non-default way, please use the volume switch as follows: <code>-v ~/YourOwnDirectory:/home/node/trilium-data triliumnext/notes:&lt;VERSION&gt;</code>. It is important to be aware of how Docker works for volumes, with the first path being your own and the second the one to virtually bind to. <a href="https://docs.docker.com/storage/volumes/">https://docs.docker.com/storage/volumes/</a>
  The path before the colon is the host directory, and the path after the colon is the container's path. More details can be found in the <a href="https://docs.docker.com/storage/volumes/">Docker Volumes Documentation</a>.</p>
  <h2>Reverse Proxy</h2>
  <ol>
  <li><a href="#root/ud6MShXL4WpO">Nginx</a></li>
  <li><a href="#root/fDLvzOx29Pfg">Apache</a></li>
  </ol>
  <h3>Note on --user Directive</h3>
  <p>The <code>--user</code> directive is unsupported. Instead, use the <code>USER_UID</code> and <code>USER_GID</code> environment variables to set the appropriate user and group IDs.</p>
  <h3>Note on timezones</h3>
  <p>If you are having timezone issues and you are not using docker-compose, you may need to add a <code>TZ</code> environment variable with the <a href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones">TZ identifier</a> of your local timezone. </p>


blobId: W5TQDAXpwy5XoEc27vuu
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:07.862Z
content:
  <h2>Error-logs</h2>
  <p>It's important to provide all available error logs together with bug reports. This page will show you how to do it.</p>
  <h2>Backend logs</h2>
  <p>Open <a href="#root/tAassRL4RSQL">data directory</a>, go to <code>log</code> subdirectory and find the latest log file, e.g. <code>trilium-2022-12-14.log</code>. You can attach the whole file to the bug report (preferable) or open it and copy-paste only the last lines / lines you believe are relevant.</p>
  <p>If you have trouble finding it the log files, there's also an in-app option in top-left menu button -&gt; Advanced -&gt; Show backend log.</p>
  <h2>Frontend logs</h2>
  <p>To provide frontend logs, we need to open the Developer Console. Often the easiest way is to press <code>CTRL-SHIFT-I</code> which should work in most browsers (and desktop app). Make sure that the error producing action happened right before you copy&amp;paste the errors, the console is cleared on app restart.</p>
  <p>If that doesn't work, then:</p>
  <ul>
  <li>in Trilium desktop app, go to top-left menu button -&gt; Advanced -&gt; Open Dev Tools</li>
  <li>In Firefox/Chrome right-click anywhere in the page and click Inspect:</li>
  </ul>
  <p><img src="api/images/zIQ1XGaUbB7i/error-logs-firefox-context-men.png" alt="" /></p>
  <p>Once you have Dev Tools open, click on "Console" tab:</p>
  <p><img src="api/images/UPZGQ7wKiLIn/error-logs-dev-tools.png" alt="" /></p>
  <p>Copy-paste (or screenshot) the logs. It's better to provide not just errors, but the whole log, which might provide context while analyzing the bug.</p>
  <h2>Providing sensitive data</h2>
  <p>If you don't feel comfortable attaching the logs or anything sensitive to the public GitHub issues, feel free to contact the devs in our Matrix <a href="https://github.com/TriliumNext/Notes#-discuss-with-us">support channel</a>.</p>
  <p>Use this email to also provide anything which could assist in analysing the bug - e.g. files/images/ZIPs being imported or <a href="#root/x59R8J8KV5Bp">anonymized database</a>.</p>
  <h3>Exporting note subtree for reproduction</h3>
  <p>Often times, bugs manifest themselves in specific notes and having them would greatly ease reproduction and fixing.</p>
  <p>In such case, please export the relevant note subtree by right-clicking it on the left tree, choosing Export - HTML as ZIP:</p>
  <p><img src="api/images/v8H3fXMFPki0/error-logs-export-subtree.png" alt="" /></p>


blobId: AXg8jSvLTZG6Oq2ryRyF
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:07.866Z
content:
  <h2>ETAPI</h2>
  <p>ETAPI is Trilium's public/external REST API. It is available since Trilium v0.50.</p>
  <p>The documentation is in OpenAPI format, available <a href="https://github.com/TriliumNext/Notes/blob/master/src/etapi/etapi.openapi.yaml">here</a>.</p>
  <p><a href="https://github.com/Nriver/trilium-py">trilium-py</a> is a third-party Python implementation for ETAPI client, you can use Python to communicate with Trilium.</p>
  <h2>Authentication</h2>
  <p>All operations have to be authenticated using a token. You can get this token either from Options -&gt; ETAPI or programmatically using the <code>/auth/login</code> REST call (see the <a href="https://github.com/TriliumNext/Notes/blob/master/src/etapi/etapi.openapi.yaml">spec</a>):</p>
  <pre><code class="language-text-x-trilium-auto">GET https://myserver.com/etapi/app-info
  Authorization: ETAPITOKEN</code></pre><p>Alternatively, since 0.56 you can also use basic auth format:</p>
  <pre><code class="language-text-x-trilium-auto">GET https://myserver.com/etapi/app-info
  Authorization: Basic BATOKEN</code></pre><ul>
  <li>Where <code>BATOKEN = BASE64(username + ':' + password)</code> - this is a standard Basic Auth serialization</li>
  <li>Where <code>username</code> is "etapi"</li>
  <li>And <code>password</code> is the generated ETAPI token described above.</li>
  </ul>
  <p>Basic Auth is meant to be used with tools which support only basic auth.</p>


blobId: sREe23kBV0hgSWQqqn2G
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:07.870Z
content:
  <h2>Events</h2>
  <p><a href="#root/CdNpE2pqjmI6">Script</a> notes can be triggered by events. Note that these are backend events and thus relation need to point to the "JS backend" code note.</p>
  <h2>Global events</h2>
  <p>Global events are attached to the script note via label. Simply create e.g. "run" label with some of these values and script note will be executed once the event occurs.</p>
  <ul>
  <li><code>run</code><ul>
  <li><code>frontendStartup</code> - executes on frontend upon startup</li>
  <li><code>mobileStartup</code> - executes on mobile frontend upon startup</li>
  <li><code>backendStartup</code> - executes on backend upon startup</li>
  <li><code>hourly</code> - executes once an hour on backend</li>
  <li><code>daily</code> - executes once a day on backend</li>
  </ul>
  </li>
  </ul>
  <h2>Entity events</h2>
  <p>Other events are bound to some entity, these are defined as <a href="#root/zEY4DaJG4YT5">relations</a> - meaning that script is triggered only if note has this script attached to it through relations (or it can inherit it).</p>
  <ul>
  <li><code>runOnNoteCreation</code> - executes when note is created on backend</li>
  <li><code>runOnNoteTitleChange</code> - executes when note title is changed (includes note creation as well)</li>
  <li><code>runOnNoteContentChange</code> - executes when note content is changed (includes note creation as well).</li>
  <li><code>runOnNoteChange</code> - executes when note is changed (includes note creation as well)</li>
  <li><code>runOnNoteDeletion</code> - executes when note is being deleted</li>
  <li><code>runOnBranchCreation</code> - executes when a branch is created. Branch is a link between parent note and child note and is created e.g. when cloning or moving note.</li>
  <li><code>runOnBranchChange</code> (since v0.62) - executes when a branch is changed - either expanded status or prefix are changed.</li>
  <li><code>runOnBranchDeletion</code> - executes when a branch is delete. Branch is a link between parent note and child note and is deleted e.g. when moving note (old branch/link is deleted).</li>
  <li><code>runOnChildNoteCreation</code> - executes when new note is created under <em>this</em> note</li>
  <li><code>runOnAttributeCreation</code> - executes when new attribute is created under <em>this</em> note</li>
  <li><code>runOnAttributeChange</code> - executes when attribute is changed under <em>this</em> note</li>
  </ul>


blobId: 7xpVNe1zMX0lik2Zcxav
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:07.873Z
content:
  <h2>Evernote-import</h2>
  <p>Trilium can import ENEX files which are used by Evernote for backup/export. One ENEX file represents content (notes and resources) of one notebook.</p>
  <h2>Export ENEX from Evernote</h2>
  <p>To export ENEX file, you need to have a <em>legacy</em> desktop version of Evernote (i.e. not web/mobile). Right click on notebook and select export and follow the wizard.</p>
  <h2>Import ENEX in Trilium</h2>
  <p>Once you have ENEX file, you can import it to Trilium. Right click on some note (to which you want to import the file), click on "Import" and select the ENEX file.</p>
  <p>After importing the ENEX file, go over the imported notes and resources to be sure the import went well, and you didn't lose any data.</p>
  <h2>Limitations</h2>
  <p>All resources (except for images) are created as note's attachments.</p>
  <p>HTML inside ENEX files is not exactly valid so some formatting maybe broken or lost. You can report major problems into <a href="https://github.com/TriliumNext/Notes/issues">Trilium issue tracker</a>. %%{WARNING}%%</p>


blobId: 4dsEetYQU8ZRroEKhRB6
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:07.878Z
content:
  <h2>FAQ</h2>
  <h2>Mac OS support</h2>
  <p>Originally, desktop builds of Trilium Notes has been available for Windows &amp; Linux, but there has been a considerable demand for macOS build.</p>
  <p>So I made one, but I underestimated the differences and specifics of Mac platform which seems to require special handling in several places. My lack of knowledge and frankly willingness to learn &amp; code Mac specific functionality resulted in a current state where <a href="https://github.com/TriliumNext/Notes/issues/511">Trilium does not integrate well into the OS</a> %%{WARNING}%%.</p>
  <p>macOS build is from now on considered "unsupported". I will strive to keep it fundamentally functional, but I won't work on Mac specific features or integrations. Note that this is more of an acknowledgment of an existing state rather than sudden change of direction.</p>
  <p>Of course, PRs are welcome.</p>
  <h2>Translation / localization support</h2>
  <p>Trilium is currently available only in English. Translation to other languages is not planned in the near/medium term because it brings a significant maintenance overhead. This decision might be revisited once Trilium stabilizes into a more mature product.</p>
  <p>For Chinese, there's an unofficial fork <a href="https://github.com/Nriver/trilium-translation">here</a>. Use at your own risk.</p>
  <h2>Multi user support</h2>
  <p>Common request is to allow multiple users collaborate, share notes etc. So far I'm resisting this because of these reasons:</p>
  <ul>
  <li>it's a huge feature, or rather a Pandora's box of collaboration features like user management, permissions, conflict resolution, real-time editing of a note by multiple people etc. This would be a huge amount of work. Trilium Notes is project made mostly by one person in free time and that's unlikely to change in the future.</li>
  <li>given its size it would probably pivot the attention away from my main focus which is a personal note-taking</li>
  <li>the assumption that only single person has access to the app simplifies many things, or just outright makes them possible. In multi-user app, our <a href="#root/CdNpE2pqjmI6">scripting</a> support would be a XSS security hole, while with the single user assumption it's an endless customizable tool.</li>
  </ul>
  <h2>How to open multiple documents in one Trilium instance</h2>
  <p>This is normally not supported - one Trilium process can open only a single instance of a <a href="#root/wX4HbRucYSDD">database</a>. However, you can run two Trilium processes (from one installation), each connected to a separate document. To achieve this, you need to set a location for the <a href="#root/tAassRL4RSQL">data directory</a> in the <code>TRILIUM_DATA_DIR</code> environment variable and separate port on <code>TRILIUM_PORT</code> environment variable. How to do that depends on the platform, in Unix-based systems you can achieve that by running command such as this:</p>
  <pre><code class="language-text-x-trilium-auto">TRILIUM_DATA_DIR=/home/me/path/to/data/dir TRILIUM_PORT=12345 trilium </code></pre><p>You can save this command into a <code>.sh</code> script file or make an alias. Do this similarly for a second instance with different data directory and port.</p>
  <h2>Can I use Dropbox / Google Drive / OneDrive to sync data across multiple computers.</h2>
  <p>No.</p>
  <p>These general purpose sync apps are not suitable to sync database files which are open and being worked on by another application. The result is that they will corrupt the database file, resulting in data loss and this message in the Trilium logs:</p>
  <blockquote>
  <p>SqliteError: database disk image is malformed</p>
  </blockquote>
  <p>The only supported way to sync Trilium's data across the network is to use a <a href="#root/cbkrhQjrkKrh">sync/web server</a>.</p>
  <h2>Why database instead of flat files?</h2>
  <p>Trilium stores notes in a <a href="#root/wX4HbRucYSDD">database</a> which is an SQLite database. People often ask why doesn't Trilium rather use flat files for note storage - it's fair question since flat files are easily interoperable, work with SCM/git etc.</p>
  <p>Short answer is that file systems are simply not powerful enough for what we want to achieve with Trilium. Using filesystem would mean fewer features with probably more problems.</p>
  <p>More detailed answer:</p>
  <ul>
  <li><a href="#root/IakOLONlIfGI">clones</a> are what you might call "hard directory link" in filesystem lingo, but this concept is not implemented in any filesystem</li>
  <li>filesystems make a distinction between directory and file while there's intentionally no such difference in Trilium</li>
  <li>files are stored in no particular order and user can't change this</li>
  <li>Trilium allows storing note <a href="#root/zEY4DaJG4YT5">attributes</a> which could be represented in extended user attributes but their support differs greatly among different filesystems / operating systems</li>
  <li>Trilium makes links / relations between different notes which can be quickly retrieved / navigated (e.g. for <a href="#root/BCkXAVs63Ttv">note map</a>). There's no such support in file systems which means these would have to be stored in some kind of side-car files (mini-databases).</li>
  <li>Filesystems are generally not transactional. While this is not completely required for a note-taking application, having transactions make it way easier to keep notes and their metadata in predictable and consistent state.</li>
  </ul>


blobId: QqNbc94AgCh6jO0XsTW1
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:07.898Z
content:
  <h2>Frontend-Basics</h2>
  <h2>Frontend API</h2>
  <p>The frontend api supports two styles, regular scripts that are run with the current app and note context, and widgets that export an object to Trilium to be used in the UI. In both cases, the frontend api of Trilium is available to scripts running in the frontend context as global variable <code>api</code>. The members and methods of the api can be seen on the <a href="#root/GLks18SNjxmC">Script API</a> page.</p>
  <h2>Scripts</h2>
  <p>Scripts don't have any special requirements. They can be run at will using the execute button in the UI or they can be configured to run at certain times using <a href="#root/zEY4DaJG4YT5">Attributes</a> on the note containing the script.</p>
  <h3>Global Events</h3>
  <p>This attribute is called <code>#run</code> and it can have any of the following values:</p>
  <ul>
  <li><code>frontendStartup</code> - executes on frontend upon startup.</li>
  <li><code>mobileStartup</code> - executes on mobile frontend upon startup.</li>
  <li><code>backendStartup</code> - executes on backend upon startup.</li>
  <li><code>hourly</code> - executes once an hour on backend.</li>
  <li><code>daily</code> - executes once a day on backend.</li>
  </ul>
  <h3>Entity Events</h3>
  <p>These events are triggered by certain <a href="#root/zEY4DaJG4YT5">relations</a> to other notes. Meaning that the script is triggered only if the note has this script attached to it through relations (or it can inherit it).</p>
  <ul>
  <li><code>runOnNoteCreation</code> - executes when note is created on backend.</li>
  <li><code>runOnNoteTitleChange</code> - executes when note title is changed (includes note creation as well).</li>
  <li><code>runOnNoteContentChange</code> - executes when note content is changed (includes note creation as well).</li>
  <li><code>runOnNoteChange</code> - executes when note is changed (includes note creation as well).</li>
  <li><code>runOnNoteDeletion</code> - executes when note is being deleted.</li>
  <li><code>runOnBranchCreation</code> - executes when a branch is created. Branch is a link between parent note and child note and is created e.g. when cloning or moving note.</li>
  <li><code>runOnBranchDeletion</code> - executes when a branch is delete. Branch is a link between parent note and child note and is deleted e.g. when moving note (old branch/link is deleted).</li>
  <li><code>runOnChildNoteCreation</code> - executes when new note is created under this note.</li>
  <li><code>runOnAttributeCreation</code> - executes when new attribute is created under this note.</li>
  <li><code>runOnAttributeChange</code> - executes when attribute is changed under this note.</li>
  </ul>
  <h2>Widgets</h2>
  <p>Conversely to scripts, widgets do have some specific requirements in order to work. A widget must:</p>
  <ul>
  <li>Extend <a href="https://triliumnext.github.io/Notes/frontend_api/BasicWidget.html">BasicWidget</a> or one of it's subclasses.</li>
  <li>Create a new instance and assign it to <code>module.exports</code>.</li>
  <li>Define a <code>parentWidget</code> member to determine where it should be displayed.</li>
  <li>Define a <code>position</code> (integer) that determines the location via sort order.</li>
  <li>Have a <code>#widget</code> attribute on the containing note.</li>
  <li>Create, render, and return your element in the render function.<ul>
  <li>For <a href="https://triliumnext.github.io/Notes/frontend_api/BasicWidget.html">BasicWidget</a> and <a href="https://triliumnext.github.io/Notes/frontend_api/NoteContextAwareWidget.html">NoteContextAwareWidget</a> you should create <code>this.$widget</code> and render it in <code>doRender()</code>.</li>
  <li>For <a href="https://triliumnext.github.io/Notes/frontend_api/RightPanelWidget.html">RightPanelWidget</a> the <code>this.$widget</code> and <code>doRender()</code> are already handled and you should instead return the value in <code>doRenderBody()</code>.</li>
  </ul>
  </li>
  </ul>
  <h3>parentWidget</h3>
  <ul>
  <li><code>left-pane</code> - This renders the widget on the left side of the screen where the note tree lives.</li>
  <li><code>center-pane</code> - This renders the widget in the center of the layout in the same location that notes and splits appear.</li>
  <li><code>note-detail-pane</code> - This renders the widget <em>with</em> the note in the center pane. This means it can appear multiple times with splits.</li>
  <li><code>right-pane</code> - This renders the widget to the right of any opened notes.</li>
  </ul>
  <h3>Tutorial</h3>
  <p>For more information on building widgets, take a look at <a href="#root/SynTBQiBsdYJ">Widget Basics</a>.</p>


blobId: 582L65fXh2080vLuCJxD
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:07.904Z
content:
  <h2>Home</h2>
  <h2>Overview</h2>
  <p>Basic overview of the Trilium project is available at project homepage - <a href="https://github.com/triliumnext/notes#trilium-notes">https://github.com/triliumnext/notes#trilium-notes</a></p>
  <p>Inspiration for the name "Trilium":</p>
  <blockquote>
  <p>Naming software is hard. I lived in Ontario when I first started the project and Trillium (the flower) is sort of a provincial logo, many institutions in Ontario are named "Trillium [something]". So I kept hearing/reading it almost everyday, I liked the sound of it and its nature motif, so I just reused it.</p>
  </blockquote>
  <blockquote>
  <p>~ Zadam (Trilium Developer)</p>
  </blockquote>
  <h2>Documentation</h2>
  <p>This <a href="https://github.com/TriliumNext/Notes/wiki">wiki</a> %%{WARNING}%% contains additional and more in-depth information on some topics. See the sidebar for listing of all available pages.</p>
  <h2>Quick Start</h2>
  <h2>Choose the setup</h2>
  <p><strong>Local only desktop/laptop</strong> - Allows a single instance on a desktop and will save the notes locally on that desktop.</p>
  <ol>
  <li><a href="#root/poXkQfguuA0U">Desktop installation</a></li>
  </ol>
  <p><strong>Server with web only access</strong> - Installs the application on the server and allows access from any web browser on any device, including mobile.</p>
  <ol>
  <li><a href="#root/WOcw2SLH6tbX">Server installation</a></li>
  <li><a href="#root/RDslemsQ6gCp">Mobile frontend</a> (optional)</li>
  <li><a href="https://heroku.com/deploy?template=https://github.com/feilongfl/trilium-heroku"><img src="api/images/B0kIDkK5rnIf/Home button.svg" alt="Deploy" /></a></li>
  <li><a href="https://www.pikapods.com/pods?run=trilium-next">PikaPods managed hosting</a></li>
  </ol>
  <p><strong>Combination of server and desktop/laptop</strong> - Install the application on both a server, for web access and data synchronization, and desktop instance(s). This allows all the data to be stored on the server and either accessed from the web browser, or the desktop application. The desktop application will sync and store the data locally so that it can be used when offline.</p>
  <ol>
  <li><a href="#root/WOcw2SLH6tbX">Server installation</a></li>
  <li><a href="#root/RDslemsQ6gCp">Mobile frontend</a> (optional)</li>
  <li><a href="#root/poXkQfguuA0U">Desktop installation</a></li>
  <li><a href="#root/cbkrhQjrkKrh">Synchronization</a></li>
  </ol>
  <h2>Basic concepts</h2>
  <ol>
  <li>Understand <a href="#root/BFs8mudNFgCS">Note</a></li>
  <li>Watch the <a href="#root/lD2Qh6zp8k4d">Screenshot tour</a></li>
  </ol>


blobId: hv9ljYgP87YPAt2HBpYW
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:08.302Z
content:
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19.045 7.401c.378-.378.586-.88.586-1.414s-.208-1.036-.586-1.414l-1.586-1.586c-.378-.378-.88-.586-1.414-.586s-1.036.208-1.413.585L4 13.585V18h4.413L19.045 7.401zm-3-3 1.587 1.585-1.59 1.584-1.586-1.585 1.589-1.584zM6 16v-1.585l7.04-7.018 1.586 1.586L7.587 16H6zm-2 4h16v2H4z"/></svg>


blobId: lJlzvedaXaXlMOHPD85c
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:08.576Z
content:
  <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  <svg width="147px" height="32px" viewBox="0 0 147 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
      <!-- Generator: Sketch 3.0.4 (8053) - http://www.bohemiancoding.com/sketch -->
      <title>button</title>
      <desc>Created with Sketch.</desc>
      <defs></defs>
      <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
          <g id="button" sketch:type="MSLayerGroup">
              <rect id="Background" fill="#7056BF" sketch:type="MSShapeGroup" x="0" y="0" width="147" height="32" rx="4"></rect>
              <g id="Icon" transform="translate(10.000000, 8.000000)" fill="#FFFFFF" sketch:type="MSShapeGroup">
                  <path d="M14.819,3.216 L9.103,0.25 C8.464,-0.082 7.536,-0.081 6.898,0.25 L1.181,3.216 C0.496,3.571 0,4.365 0,5.102 L0,11.035 C0,11.774 0.497,12.566 1.181,12.921 L4.039,14.404 C4.529,14.656 5.134,14.467 5.388,13.978 C5.642,13.487 5.451,12.884 4.961,12.629 L2.106,11.148 C2.068,11.124 2.008,11.039 2,11.035 L1.996,5.143 C2.008,5.098 2.068,5.013 2.103,4.991 L7.816,2.026 C7.897,1.991 8.106,1.992 8.181,2.025 L13.894,4.989 C13.932,5.013 13.992,5.098 14,5.102 L14.003,10.995 C13.992,11.039 13.932,11.124 13.898,11.146 L11.039,12.629 C10.549,12.884 10.358,13.487 10.612,13.978 C10.79,14.32 11.14,14.517 11.501,14.517 C11.656,14.517 11.814,14.481 11.961,14.404 L14.818,12.921 C15.503,12.566 16,11.774 16,11.035 L16,5.102 C16,4.365 15.504,3.571 14.819,3.216" id="App"></path>
                  <path d="M11.707,9.707 C12.098,9.316 12.098,8.684 11.707,8.293 L8.708,5.294 C8.616,5.201 8.505,5.128 8.382,5.077 C8.138,4.976 7.862,4.976 7.618,5.077 C7.495,5.128 7.385,5.201 7.292,5.294 L4.293,8.293 C3.902,8.684 3.902,9.316 4.293,9.707 C4.488,9.902 4.744,10 5,10 C5.256,10 5.512,9.902 5.707,9.707 L7,8.414 L7,15 C7,15.553 7.447,16 8,16 C8.553,16 9,15.553 9,15 L9,8.414 L10.293,9.707 C10.488,9.902 10.744,10 11,10 C11.256,10 11.512,9.902 11.707,9.707" id="Arrow"></path>
              </g>
              <path d="M81.393,21.091 C81.744,21.091 82.173,21.052 82.368,21.013 L82.368,20.09 C82.186,20.142 81.913,20.181 81.666,20.181 C80.834,20.181 80.6,19.817 80.6,19.089 L80.6,15.059 L82.381,15.059 L82.381,14.136 L80.6,14.136 L80.6,11.692 L79.482,11.692 L79.482,14.136 L78.286,14.136 L78.286,15.059 L79.482,15.059 L79.482,19.336 C79.482,20.532 79.95,21.091 81.393,21.091 Z M86.697,21.143 C88.374,21.143 89.882,19.921 89.882,17.568 C89.882,15.202 88.374,13.993 86.697,13.993 C85.007,13.993 83.499,15.202 83.499,17.568 C83.499,19.921 85.02,21.143 86.697,21.143 Z M86.697,20.194 C85.306,20.194 84.63,19.024 84.63,17.568 C84.63,16.021 85.384,14.955 86.697,14.955 C88.062,14.955 88.751,16.138 88.751,17.568 C88.751,19.141 87.997,20.194 86.697,20.194 Z M94.705,21 L95.849,21 L95.849,16.463 L100.802,16.463 L100.802,21 L101.946,21 L101.946,11.38 L100.802,11.38 L100.802,15.41 L95.849,15.41 L95.849,11.38 L94.705,11.38 L94.705,21 Z M106.834,21.143 C108.121,21.143 108.992,20.597 109.629,19.687 L108.979,19.115 C108.459,19.83 107.9,20.233 106.912,20.233 C105.781,20.233 104.884,19.401 104.845,17.854 L109.694,17.854 L109.694,17.62 C109.694,15.137 108.459,13.993 106.834,13.993 C105.391,13.993 103.727,15.072 103.727,17.568 C103.727,19.96 105.209,21.143 106.834,21.143 Z M104.871,16.983 C105.027,15.566 105.898,14.929 106.821,14.929 C107.952,14.929 108.537,15.761 108.628,16.983 L104.871,16.983 Z M111.293,21 L112.411,21 L112.411,16.567 C112.918,15.592 113.737,15.02 114.829,15.02 C114.868,15.02 115.115,15.02 115.154,15.033 L115.232,13.993 L115.089,13.993 C113.75,13.993 112.944,14.617 112.437,15.41 L112.411,15.41 L112.411,14.136 L111.293,14.136 L111.293,21 Z M119.301,21.143 C120.978,21.143 122.486,19.921 122.486,17.568 C122.486,15.202 120.978,13.993 119.301,13.993 C117.611,13.993 116.103,15.202 116.103,17.568 C116.103,19.921 117.624,21.143 119.301,21.143 Z M119.301,20.194 C117.91,20.194 117.234,19.024 117.234,17.568 C117.234,16.021 117.988,14.955 119.301,14.955 C120.666,14.955 121.355,16.138 121.355,17.568 C121.355,19.141 120.601,20.194 119.301,20.194 Z M124.072,21 L125.19,21 L125.19,18.894 L126.555,17.425 L128.583,21 L129.779,21 L127.283,16.593 L129.532,14.136 L128.258,14.136 L125.19,17.568 L125.19,11.38 L124.072,11.38 L124.072,21 Z M133.055,21.13 C134.173,21.13 135.031,20.558 135.629,19.973 L135.629,21 L136.76,21 L136.76,14.136 L135.629,14.136 L135.629,19.089 C134.914,19.765 134.238,20.194 133.406,20.194 C132.535,20.194 132.145,19.765 132.145,18.855 L132.145,14.136 L131.027,14.136 L131.027,19.089 C131.027,20.389 131.742,21.13 133.055,21.13 L133.055,21.13 Z" id="to-Heroku" fill="#B7A7D5" sketch:type="MSShapeGroup"></path>
              <path d="M34.183,21 L36.718,21 C39.773,21 41.567,19.427 41.567,16.164 C41.567,12.94 39.812,11.38 36.718,11.38 L34.183,11.38 L34.183,21 Z M35.327,19.973 L35.327,12.433 L36.835,12.433 C39.175,12.433 40.423,13.577 40.423,16.164 C40.423,18.842 39.188,19.973 36.861,19.973 L35.327,19.973 Z M46,21.143 C47.287,21.143 48.158,20.597 48.795,19.687 L48.145,19.115 C47.625,19.83 47.066,20.233 46.078,20.233 C44.947,20.233 44.05,19.401 44.011,17.854 L48.86,17.854 L48.86,17.62 C48.86,15.137 47.625,13.993 46,13.993 C44.557,13.993 42.893,15.072 42.893,17.568 C42.893,19.96 44.375,21.143 46,21.143 Z M44.037,16.983 C44.193,15.566 45.064,14.929 45.987,14.929 C47.118,14.929 47.703,15.761 47.794,16.983 L44.037,16.983 Z M50.459,23.6 L51.577,23.6 L51.577,20.116 C52.162,20.727 52.877,21.104 53.722,21.104 C55.399,21.104 56.634,19.947 56.634,17.555 C56.634,15.163 55.412,13.993 53.839,13.993 C52.812,13.993 52.097,14.513 51.577,15.085 L51.577,14.136 L50.459,14.136 L50.459,23.6 Z M53.566,20.194 C52.838,20.194 52.175,19.83 51.577,19.154 L51.577,16.008 C52.149,15.384 52.786,14.955 53.579,14.955 C54.684,14.955 55.516,15.813 55.516,17.568 C55.516,19.388 54.762,20.194 53.566,20.194 Z M58.324,21 L59.442,21 L59.442,11.38 L58.324,11.38 L58.324,21 Z M64.304,21.143 C65.981,21.143 67.489,19.921 67.489,17.568 C67.489,15.202 65.981,13.993 64.304,13.993 C62.614,13.993 61.106,15.202 61.106,17.568 C61.106,19.921 62.627,21.143 64.304,21.143 Z M64.304,20.194 C62.913,20.194 62.237,19.024 62.237,17.568 C62.237,16.021 62.991,14.955 64.304,14.955 C65.669,14.955 66.358,16.138 66.358,17.568 C66.358,19.141 65.604,20.194 64.304,20.194 Z M69.465,23.639 C70.804,23.639 71.337,22.989 71.805,21.78 L74.743,14.136 L73.612,14.136 L71.597,19.687 L71.571,19.687 L69.556,14.136 L68.373,14.136 L71.025,21.039 L70.765,21.715 C70.492,22.391 70.154,22.69 69.452,22.69 C68.971,22.69 68.633,22.625 68.438,22.573 L68.178,23.47 C68.477,23.561 68.854,23.639 69.465,23.639 L69.465,23.639 Z" id="Deploy" fill="#FFFFFF" sketch:type="MSShapeGroup"></path>
          </g>
      </g>
  </svg>


blobId: 9kTT7tVcnhcC0nUC2fq1
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.329Z
content:
  <h2>Images</h2>
  <p>Trilium supports storing and displaying images. Supported formats are JPEG, PNG and GIF.</p>
  <p>An image can be uploaded in the form of note's <a href="#root/0vhv7lsOLy82">attachment</a> or as a standalone <a href="#root/kBrnXNG3Hplm">note</a> placed into the <a href="#root/kBrnXNG3Hplm">note tree</a>. Its reference can be copied into a text note, in order to display it in the text itself.</p>
  <h2>Uploading images</h2>
  <p>To add an image to the note, simply drag it from file explorer onto the note editor inside Trilium and the image will be uploaded.</p>
  <p><img src="api/images/SxZpSLC90own/upload-image.gif" alt="" /></p>
  <p>Alternatively you can click on block toolbar and then on "Insert image":</p>
  <p><img src="api/images/d4wRI6N1Eolr/block-toolbar-insert-image.png" alt="" /></p>
  <p>You can also copy and paste an image from web - the image will be (asynchronously) downloaded and embedded.</p>
  <h2>Compression</h2>
  <p>Since Trilium isn't really meant to be primary storage for image data, it attempts to compress and resize (with pretty aggressive settings) uploaded images before storing them to the database. You may then notice some quality degradation. Basic quality settings is available in Options -&gt; Other.</p>
  <p>If you want to save images in their original resolution, it is recommended to save them as attachment to note (top-right "Note actions -&gt; Import files").</p>


blobId: lzXe9SXKofT3BQC2GwEI
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.334Z
content:
  <h2>Importing Documentation</h2>
  <p>To import these docs into your own Trilium instance:</p>
  <ol>
  <li>Download archive from main branch of this repo:
  <a href="https://github.com/TriliumNext/Docs/archive/refs/heads/main.zip">https://github.com/TriliumNext/Docs/archive/refs/heads/main.zip</a></li>
  <li>In Trilim create a new note to act as branch for the docs</li>
  <li>Right-click on the note, select "Import into note" and select downloaded <code>Docs-main.zip</code> file.<ul>
  <li>Optionally uncheck "Shrink images"</li>
  </ul>
  </li>
  </ol>
  <h2>Optional cleanup</h2>
  <ul>
  <li>delete <code>!!!meta.json</code></li>
  <li>Move <code>images</code> node down to the bottom (instead of dragging, it's easier to move out to parent node than back into Wiki. It will go to end of list automatically).</li>
  </ul>
  <p>For new releases delete the old docs note tree and start fresh, or you'll get duplicates.</p>


blobId: wzNPvAY184zCsh3SzEaK
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.341Z
content:
  <h2>Keyboard-shortcuts</h2>
  <p>This is supposed to be a complete list of keyboard shortcuts. Note that some of these may work only in certain contexts (e.g. in tree pane or note editor).</p>
  <p>It is also possible to configure most keyboard shortcuts in Options -&gt; Keyboard shortcuts. Using <code>global:</code> prefix, you can assign a shortcut which will work even without Trilium being in focus (requires app restart to take effect).</p>
  <h2>Note navigation</h2>
  <ul>
  <li><code>UP</code>, <code>DOWN</code> - go up/down in the list of notes, <code>CTRL-SHIFT-UP</code> and <code>CTRL-SHIFT-DOWN</code> work also from editor</li>
  <li><code>LEFT</code>, <code>RIGHT</code> - collapse/expand node</li>
  <li><code>ALT+LEFT</code>, <code>ALT+RIGHT</code> - go back / forwards in the history</li>
  <li><code>CTRL+J</code> - show <a href="#root/MMiBEQljMQh2">"Jump to" dialog</a></li>
  <li><code>CTRL+.</code> - scroll to current note (useful when you scroll away from your note or your focus is currently in the editor)</li>
  <li><code>BACKSPACE</code> - jumps to parent note</li>
  <li><code>ALT+C</code> - collapse whole note tree</li>
  <li><code>ALT+-</code> (alt with minus sign) - collapse subtree (if some subtree takes too much space on tree pane you can collapse it)</li>
  <li>you can define a <a href="#root/zEY4DaJG4YT5">label</a> <code>#keyboardShortcut</code> with e.g. value <code>Ctrl+I</code>. Pressing this keyboard combination will then bring you to the note on which it is defined. Note that Trilium must be reloaded/restarted (Ctrl+R) for changes to be in effect.</li>
  </ul>
  <p>See demo of some of these features in <a href="#root/MMiBEQljMQh2">note navigation</a>.</p>
  <h2>Tabs</h2>
  <ul>
  <li><code>CTRL+click</code> - (or middle mouse click) on note link opens note in a new tab</li>
  </ul>
  <p>Only in desktop (electron build):</p>
  <ul>
  <li><code>CTRL+T</code> - opens empty tab</li>
  <li><code>CTRL+W</code> - closes active tab</li>
  <li><code>CTRL+Tab</code> - activates next tab</li>
  <li><code>CTRL+Shift+Tab</code> - activates previous tab</li>
  </ul>
  <h2>Creating notes</h2>
  <ul>
  <li><code>CTRL+O</code> - creates new note after the current note</li>
  <li><code>CTRL+P</code> - creates new sub-note into current note</li>
  <li><code>F2</code> - edit <a href="#root/MMiBEQljMQh2">prefix</a> of current note clone</li>
  </ul>
  <h2>Moving / cloning notes</h2>
  <ul>
  <li><code>CTRL+UP</code>, <code>CTRL+DOWN</code> - move note up/down in the note list</li>
  <li><code>CTRL+LEFT</code> - move note up in the note tree</li>
  <li><code>CTRL+RIGHT</code> - move note down in the note tree</li>
  <li><code>SHIFT+UP</code>, <code>SHIFT+DOWN</code> - multi-select note above/below</li>
  <li><code>CTRL+A</code> - select all notes in the current level</li>
  <li><code>SHIFT+click</code> - multi select note which you clicked on</li>
  <li><code>CTRL+C</code> - copies current note (or current selection) into clipboard (used for <a href="#root/IakOLONlIfGI">cloning</a></li>
  <li><code>CTRL+X</code> - cuts current (or current selection) note into clipboard (used for moving notes)</li>
  <li><code>CTRL+V</code> - pastes note(s) as sub-note into current note (which is either move or clone depending on whether it was copied or cut into clipboard)</li>
  <li><code>DEL</code> - delete note / sub-tree</li>
  </ul>
  <h2>Editing notes</h2>
  <p>Trilium uses CKEditor 5 for the <a href="#root/iPIMuisry3hd">text notes</a> and CodeMirror 5 for <a href="#root/6f9hih2hXXZk">code notes</a>. Check the documentation of these projects to see all their built-in keyboard shortcuts.</p>
  <ul>
  <li><p><code>ALT-F10</code> - bring up inline formatting toolbar (arrow keys <code>&lt;-</code>,<code>-&gt;</code> to navigate, <code>ENTER</code> to apply)</p>
  </li>
  <li><p><code>ALT-F10</code> - again to bring up block formatting toolbar</p>
  </li>
  <li><p><code>ENTER</code> in tree pane switches from tree pane into note title. Enter from note title switches focus to text editor. <code>CTRL+.</code> switches back from editor to tree pane.</p>
  </li>
  <li><p><code>CTRL+K</code> - create / edit <a href="#root/QEAPj01N5f7w">external link</a></p>
  </li>
  <li><p><code>CTRL+L</code> - create <a href="#root/QEAPj01N5f7w">internal (note) link</a></p>
  </li>
  <li><p><code>ALT+T</code> - inserts current date and time at caret position</p>
  </li>
  <li><p><code>CTRL+.</code> - jump away from the editor to tree pane and scroll to current note</p>
  </li>
  </ul>
  <h2>Runtime shortcuts</h2>
  <p>These are hooked in Electron to be similar to native browser keyboard shortcuts.</p>
  <ul>
  <li><code>F5</code>, <code>CTRL-R</code> - reloads trilium frontend</li>
  <li><code>CTRL+SHIFT+I</code> - show developer tools</li>
  <li><code>CTRL+F</code> - show search dialog</li>
  <li><code>CTRL+-</code> - zoom out</li>
  <li><code>CTRL+=</code> - zoom in</li>
  </ul>
  <h2>Other</h2>
  <ul>
  <li><code>ALT+O</code> - show SQL console (use only if you know what you're doing)</li>
  <li><code>ALT+M</code> - distraction-free mode - display only note editor, everything else is hidden</li>
  <li><code>F11</code> - toggle full screen</li>
  <li><code>CTRL+S</code> - toggle <a href="#root/eIg8jdvaoNNd">search</a> form in tree pane</li>
  <li><code>ALT+A</code> - show note <a href="#root/zEY4DaJG4YT5">attributes</a> dialog</li>
  </ul>


blobId: 70Ceixh0yvZLMHFQWBdE
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.347Z
content:
  <h2>Kubernetes-server-installation</h2>
  <p>As Trilium can be run in Docker it also can be deployed in Kubernetes. You can either use our Helm chart, a community Helm chart, or roll your own Kubernetes deployment.</p>
  <p>The recommended way is to use a Helm chart.</p>
  <h2>Root privileges</h2>
  <blockquote>
  <p>[!NOTE]<br />The Trilium container at this time needs to be run with root privileges. It will swap to UID and GID <code>1000:1000</code> to run the <code>node</code> process after execution though, so the main process doesn't run with root privileges. </p>
  </blockquote>
  <p>The Trilium docker container needs to be run with root privileges. The node process inside the container will be started with reduced privileges (uid:gid 1000:1000) after some initialization logic. Please make sure that you don't use a security context (PodSecurityContext) which changes the user ID. To use a different uid:gid for file storage and the application, please use the <code>USER_UID</code> &amp; <code>USER_GID</code> environment variables.</p>
  <p>The docker image will also fix the permissions of <code>/home/node</code> so you don't have to use an init container.</p>
  <h2>Helm Charts</h2>
  <p><a href="https://github.com/TriliumNext/helm-charts">Official Helm chart</a> from TriliumNext 
  Unofficial helm chart by <a href="https://github.com/ohdearaugustin">ohdearaugustin</a>: <a href="https://github.com/ohdearaugustin/charts">https://github.com/ohdearaugustin/charts</a></p>
  <h2>Adding a Helm repository</h2>
  <p>Below is an example of how </p>
  <pre><code class="language-text-x-trilium-auto">helm repo add trilium https://triliumnext.github.io/helm-charts
  "trilium" has been added to your repositories</code></pre><h2>How to install a chart</h2>
  <p>After reviewing the <a href="https://github.com/TriliumNext/helm-charts/blob/main/charts/trilium/values.yaml"><code>values.yaml</code></a> from the Helm chart, modifying as required and then creating your own:</p>
  <pre><code class="language-text-x-trilium-auto">helm install --create-namespace --namespace trilium trilium trilium/trilium -f values.yaml</code></pre><p>For more information on using Helm, please refer to the Helm documentation, or create a Discussion in the TriliumNext GitHub Organization.</p>


blobId: xyKRJujrYakUDX0G37yq
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.354Z
content:
  <h2>Links</h2>
  <h2>External links</h2>
  <p>External link is general web link targeting some external web resource - e.g. <a href="https://en.wikipedia.org/wiki/South_China_Sea">https://en.wikipedia.org/wiki/South_China_Sea</a> is an external link to one Wikipedia page.</p>
  <p>External links are done through CKEditor native links. To create an external link, select text and press <code>CTRL-K</code> or wait for the "balloon" to appear and click link icon there.</p>
  <p><img src="api/images/N6O1qfBGcbFH/create-external-link.gif" alt="" /></p>
  <p>You can follow external link by either double clicking (will open new tab/window) it or right clicking on them and choosing "Open in new tab".</p>
  <h2>Internal links to notes</h2>
  <p>Links to internal notes are created a bit differently. To create link to note at current cursor position, press <code>CTRL-L</code>.</p>
  <p>In the dialog you can see radio button to choose from different types of linking:</p>
  <ul>
  <li>link title mirrors the note's current title - this is sometimes also called "reference link". Title of such links cannot be changed, instead it is always mirroring the title of linked note. This way the link title is never outdated</li>
  <li>link title can be changed arbitrarily - this is the traditional hyperlink - you link to a particular note and can choose the link title</li>
  </ul>
  <p><img src="api/images/dPcRcDZwyGAO/create-link-to-note.gif" alt="" /></p>
  <p>You can follow the note link by double clicking it.</p>
  <p>Alternatively if you only wish to quickly preview the content, you can hover over the link and will see read only preview.</p>
  <h3>In-place linking</h3>
  <p>Trilium also provides "inline" linking - type <code>@</code> and you'll see an autocomplete, just type few characters from the desired note title, press enter and you have a link.</p>
  <h2>Note map</h2>
  <p>Trilium provides a visualisation of incoming and outgoing links for a particular note. See <a href="#root/BCkXAVs63Ttv">note map</a> for details.</p>


blobId: 7IMfEhON3TLPA8smsHXJ
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.359Z
content:
  <h2>Manual-server-installation</h2>
  <p>This page describes manually installing Trilium on your server. <strong>Note that this is a not well supported way to install Trilium, problems may appear, information laid out here is quite out of date. It is recommended to use either Docker or packaged build installation.</strong></p>
  <h2>Requirements</h2>
  <p>Trilium is a node.js application. Supported (tested) version of node.js is latest 14.X.X and 16.X.X. Trilium might work with older versions as well.</p>
  <p>You can check your node version with this command (node.js needs to be installed):</p>
  <pre><code class="language-text-x-trilium-auto">node --version</code></pre><p>If your Linux distribution has only an outdated version of node.js, you can take a look at the installation instruction on node.js website, which covers most popular distributions.</p>
  <h3>Dependencies</h3>
  <p>There are some dependencies required. You can see command for Debian and its derivatives (like Ubuntu) below:</p>
  <pre><code class="language-text-x-trilium-auto">sudo apt install libpng16-16 libpng-dev pkg-config autoconf libtool build-essential nasm libx11-dev libxkbfile-dev</code></pre><h2>Installation</h2>
  <h3>Download</h3>
  <p>You can either download source code zip/tar from <a href="https://github.com/TriliumNext/Notes/releases/latest%5D%5D">https://github.com/TriliumNext/Notes/releases/latest]]</a> %%{WARNING}%%or clone git repository <strong>from stable branch</strong> with</p>
  <pre><code class="language-text-x-trilium-auto">git clone -b stable https://github.com/triliumnext/notes.git %%{WARNING}%%</code></pre><h2>Installation</h2>
  <pre><code class="language-text-x-trilium-auto">cd trilium

  # download all node dependencies
  npm install

  # make sure the better-sqlite3 binary is there
  npm rebuild

  # bundles &amp; minifies frontend JavaScript
  npm run webpack</code></pre><h2>Run</h2>
  <pre><code class="language-text-x-trilium-auto">cd trilium

  # using nohup to make sure trilium keeps running after user logs out
  nohup TRILIUM_ENV=dev node src/www &amp;</code></pre><p>The application by default starts up on port 8080, so you can open your browser and navigate to <a href="http://localhost:8080">http://localhost:8080</a> to access Trilium (replace "localhost" with your hostname).</p>
  <h2>TLS</h2>
  <p>Don't forget to <a href="#root/l2VkvOwUNfZj">configure TLS</a> which is required for secure usage!</p>


blobId: 3T35Ac6ApCHoxeYC9dPm
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.364Z
content:
  <h2>Markdown</h2>
  <p>Trilium Notes supports importing Markdown restricted to the <a href="https://spec.commonmark.org/current/">CommonMark specification</a> (where <a href="https://github.com/TriliumNext/Notes/issues/2026">tables are not supported</a> )</p>
  <h2>Import</h2>
  <h3>Clipboard import</h3>
  <p>If you want to import just a chunk of markdown from clipboard, you can do it from editor block menu:</p>
  <p><img src="api/images/Y9mwMwSGAaSb/markdown-inline-import.gif" alt="" /></p>
  <h3>File import</h3>
  <p>You can also import Markdown files from files:</p>
  <ul>
  <li>single markdown file (with .md extension)</li>
  <li>whole tree of markdown files (packaged into <a href="https://en.wikipedia.org/wiki/Tar_(computing)">.zip</a> archive)<ul>
  <li>Markdown files need to be packaged into ZIP archive because browser can't read directories, only single files.</li>
  <li>You can use e.g. <a href="https://www.7-zip.org">7-zip</a> to package directory of markdown files into the ZIP file</li>
  </ul>
  </li>
  </ul>
  <p>[[gifs/markdown-file-import.gif]]</p>
  <p><img src="api/images/xMQSqWySvWBZ/markdown-file-import.gif" alt="" /></p>
  <h2>Export</h2>
  <h3>Subtree export</h3>
  <p>You can export whole subtree to ZIP archive which will have directory structured modelled after subtree structure:</p>
  <p><img src="api/images/QUqKzK4LHMVA/markdown-export-subtree.gif" alt="" /></p>
  <h3>Single note export</h3>
  <p>If you want to export just single note without its subtree, you can do it from Note actions menu:</p>
  <p><img src="api/images/e3qPZSsTbUZP/markdown-export-note.gif" alt="" /></p>
  <h3>Exporting protected notes</h3>
  <p>If you want to export protected notes, enter a protected session first! This will export the notes in an unencrypted form, so if you reimport into Trilium, make sure to re-protect these notes.</p>


blobId: JUPTOXlVBw7fM1Grbhd3
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.376Z
content:
  <h2>Mobile-frontend</h2>
  <p>Trilium (<a href="#root/WOcw2SLH6tbX">server edition</a>) has a mobile web frontend which is optimized for touch based devices - smartphones and tablets. It is activated automatically during login process based on browser detection.</p>
  <p>Mobile frontend is limited in features compared to full desktop frontend. See below for more details on this.</p>
  <p>Note that this is not an Android/iOS app, this is just mobile friendly web page served on the <a href="#root/WOcw2SLH6tbX">server edition</a>.</p>
  <h2>Screenshots</h2>
  <h3>Mobile phone</h3>
  <p><img src="api/images/TFAiJIXJFfqv/mobile-smartphone.png" alt="" /></p>
  <h3>Tablet</h3>
  <p><img src="api/images/fi37V32TNyzm/mobile-tablet.png" alt="" /></p>
  <h2>Limitations</h2>
  <p>Mobile frontend provides only some of the features of the full desktop frontend:</p>
  <ul>
  <li>it is possible to browse the whole note tree, read and edit all types of notes, but you can create only text notes</li>
  <li>reading and editing <a href="#root/bwg0e8ewQMak">protected notes</a> is possible, but creating them is not supported</li>
  <li>editing options is not supported</li>
  <li>cloning notes is not supported</li>
  <li>uploading file attachments is not supported</li>
  </ul>
  <h2>Forcing mobile/desktop frontend</h2>
  <p>Trilium decides automatically whether to use mobile or desktop frontend. If this is not appropriate, you can use <code>?mobile</code> or <code>?desktop</code> query param on <strong>login</strong> page (Note: you might need to log out).</p>
  <h2>Scripting</h2>
  <p>You can alter the behavior with <a href="#root/CdNpE2pqjmI6">scripts</a> just like for normal frontend. For script notes to be executed, they need to have labeled <code>#run=mobileStartup</code>.</p>


blobId: s9S0hHMcRb802NzQjD8H
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.384Z
content:
  <h2>Multi-Factor Authentication</h2>
  <p>Multi-factor authentication (MFA) is a security process that requires users to provide two or more verification factors to gain access to a system, application, or account. This adds an extra layer of protection beyond just using a password.</p>
  <p>By requiring more than one verification method, MFA helps reduce the risk of unauthorized access, even if someone has obtained your password. It’s highly recommended for securing sensitive information stored in your notes.</p>
  <p>Warning! OpenID and TOTP cannot be both used at the same time!</p>
  <h2>Log in with your Google Account with OpenID!</h2>
  <p>OpenID is a standardized way to let you log into websites using an account from another service, like Google, to verify your identity.</p>
  <h2>Why Time-based One Time Passwords?</h2>
  <p>TOTP (Time-Based One-Time Password) is a security feature that generates a unique, temporary code on your device, like a smartphone, which changes every 30 seconds. You use this code, along with your password, to log into your account, making it much harder for anyone else to access them.</p>
  <h2>Setup</h2>
  <h3>TOTP</h3>
  <ol>
  <li>Start Trilium Notes normally.</li>
  <li>Go to "Menu" -&gt; "Options" -&gt; "MFA"</li>
  <li>Click the "Generate TOTP Secret" button</li>
  <li>Copy the generated secret to your authentication app/extension</li>
  <li>Set an environment variable "TOTP_SECRET" as the generated secret. Environment variables can be set with a .env file in the root directory, by defining them in the command line, or with a docker container.<pre><code class="language-text-x-trilium-auto"># .env in the project root directory
  TOTP_ENABLED="true"
  TOTP_SECRET="secret"</code></pre><pre><code class="language-text-x-trilium-auto"># Terminal/CLI
  export TOTP_ENABLED="true"
  export TOTP_SECRET="secret"</code></pre><pre><code class="language-text-x-trilium-auto"># Docker
  docker run -p 8080:8080 -v ~/trilium-data:/home/node/trilium-data -e TOTP_ENABLED="true" -e TOTP_SECRET="secret" triliumnext/notes:[VERSION]</code></pre></li>
  <li>Restart Trilium</li>
  <li>Go to "Options" -&gt; "MFA"</li>
  <li>Click the "Generate Recovery Codes" button</li>
  <li>Save the recovery codes. Recovery codes can be used once in place of the TOTP if you loose access to your authenticator. After a rerecovery code is used, it will show the unix timestamp when it was used in the MFA options tab.</li>
  <li>Load the secret into an authentication app like google authenticator</li>
  </ol>
  <h3>OpenID</h3>
  <p><em>Currently only compatible with Google. Other services like Authentik and Auth0 are planned on being added.</em></p>
  <p>In order to setup OpenID, you will need to setup a authentication provider. This requires a bit of extra setup. Follow <a href="https://developers.google.com/identity/openid-connect/openid-connect">these instructions</a> to setup an OpenID service through google.</p>
  <p>Set an environment variable "SSO_ENABLED" to true and add the client ID and secret you obtained from google. Environment variables can be set with a .env file in the root directory, by defining them in the command line, or with a docker container.</p>
  <h4>.env File</h4>
  <pre><code class="language-text-x-trilium-auto"># .env in the project root directory
  SSO_ENABLED="true"
  BASE_URL="http://localhost:8080"
  CLIENT_ID=
  SECRET=</code></pre><h4>Environment variable (linux)</h4>
  <pre><code class="language-text-x-trilium-auto">export SSO_ENABLED="true"
  export BASE_URL="http://localhost:8080"
  export CLIENT_ID=
  export SECRET=</code></pre><h4>Docker</h4>
  <pre><code class="language-text-x-trilium-auto">docker run -d -p 8080:8080 -v ~/trilium-data:/home/node/trilium-data -e SSO_ENABLED="true" -e BASE_URL="http://localhost:8080" -e CLIENT_ID= -e SECRET= triliumnext/notes:[VERSION]</code></pre><p>After you restart Trilium Notes, you will be redirected to Google's account selection page. Login to an account and Trilium Next will bind to that account, allowing you to login with it. </p>
  <p>You can now login using your google account. </p>


blobId: WeBcLUElEiS0ghr1NUfE
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.388Z
content:
  <h2>Nginx-proxy-setup</h2>
  <p>Configure Nginx proxy and HTTPS. The operating system here is Ubuntu 18.04.</p>
  <ol>
  <li>Download Nginx and remove Apache2</li>
  </ol>
  <pre><code class="language-text-x-trilium-auto">sudo apt-get install nginx
  sudo apt-get remove apache2</code></pre><ol>
  <li>Create configure file</li>
  </ol>
  <pre><code class="language-text-x-trilium-auto">cd /etc/nginx/conf.d
  vim default.conf</code></pre><ol>
  <li>Fill the file with the context shown below, part of the setting show be changed. Then you can enjoy your web with HTTPS forced and proxy.</li>
  </ol>
  <pre><code class="language-text-x-trilium-auto"># This part is for proxy and HTTPS configure
  server {
      listen 443 ssl;
      server_name trilium.example.net; #change trilium.example.net to your domain without HTTPS or HTTP.
      ssl_certificate /etc/ssl/note/example.crt; #change /etc/ssl/note/example.crt to your path of crt file.
      ssl_certificate_key /etc/ssl/note/example.net.key; #change /etc/ssl/note/example.net.key to your path of key file.
      ssl_session_cache builtin:1000 shared:SSL:10m;
      ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
      ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
      ssl_prefer_server_ciphers on;
      access_log /var/log/nginx/access.log; #check the path of access.log, if it doesn't fit your file, change it
      
      location / {
          proxy_set_header Host $host;
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header X-Forwarded-Proto $scheme;
          proxy_set_header Upgrade $http_upgrade;
          proxy_set_header Connection "upgrade";
          proxy_pass http://127.0.0.1:8080; # change it to a different port if non-default is used
          proxy_read_timeout 90;
          proxy_redirect http://127.0.0.1:8080 https://trilium.example.net; # change them based on your IP, port and domain
      }
  }
  # This part is for HTTPS forced
  server {
              listen 80;
              server_name trilium.example.net; # change to your domain
              return 301 https://$server_name$request_uri;
  }</code></pre>


blobId: RP3bMPj6ENJSyjX79CZe
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.391Z
content:
  <h2>NixOS-server-installation</h2>
  <p>This page describes configuring the Trilium module included in NixOS.</p>
  <h2>Requirements</h2>
  <p><a href="https://nixos.org/">NixOS</a> installation.</p>
  <h2>Configuration</h2>
  <p>Add this to your <code>configuration.nix</code>:</p>
  <pre><code class="language-text-x-trilium-auto">services.trilium-server.enable = true;

  # default data directory: /var/lib/trilium
  #services.trilium-server.dataDir = "/var/lib/trilium-sync-server";

  # default bind address: 127.0.0.1, port 8080
  #services.trilium-server.host = "0.0.0.0";
  #services.trilium-server.port = 12783;</code></pre><p>Uncomment any option you would like to change.</p>
  <p>See the <a href="https://search.nixos.org/options?channel=unstable&amp;from=0&amp;size=50&amp;sort=relevance&amp;type=packages&amp;query=trilium-server">NixOS options list</a> for more options (including nginx reverse proxy configuration).</p>


blobId: UV5QqBSKTpMJ1QEPqNpX
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.393Z
content:
  <h2>Note hoisting</h2>
  <p>Hoisting is a standard outliner feature which allows you to focus on (or "zoom into") a specific note and its subtree by hiding all parent and sibling notes. Demo:</p>
  <p><img src="api/images/AiBOf1LIykMC/note-hoisting.gif" alt="" /></p>
  <p>In addition to showing only this subtree, this also narrows both full text search and <a href="#root/MMiBEQljMQh2">“jump to note”</a> to just notes present in hoisted subtree.</p>
  <p>See also <a href="#root/9sRHySam5fXb">Workspace</a> which extends this feature.</p>


blobId: 4C2oZDjXoD70MCkYviUj
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.396Z
content:
  <h2>Note Icons</h2>
  <p>Icons are useful for distinguishing notes. At the technical level, they are set by the <strong><code>iconClass</code></strong> attribute which adds a CSS class to the note. For example <code>#iconClass="bx bx-calendar"</code> will show a calendar instead of the default page or folder icon. Looking up and remembering the css class names is not necessary. While editing a note, click on the icon next to the title to bring up a chooser gallery:</p>
  <p><img src="api/images/iuAfnapzpRCB/note-icon-change.png" alt="change note icon" /></p>
  <p><img src="api/images/R1L2vUshJD82/note-icon-gallery.png" alt="note icon gallery" /></p>


blobId: xMKHQzpohVkcWWAiGWOf
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.399Z
content:
  <h2>Note map</h2>
  <p>Note map is a visualization of connections between notes.</p>
  <p>This provides an insight into a structure ("web") of notes.</p>
  <p>There are two types of note map:</p>
  <h2>Link Map</h2>
  <p>Shows <a href="#root/zEY4DaJG4YT5">relations</a> between notes:</p>
  <p><img src="api/images/5nE2aM3crNI6/link-map.png" alt="" /></p>
  <h2>Tree Map</h2>
  <p>Shows hierarchical map of notes:</p>
  <p><img src="api/images/9ypFh2kQ6bKC/tree-map.png" alt="" /></p>
  <h2>See also</h2>
  <p><a href="#root/iRwzGnHPzonm">Relation map</a> is a similar concept, with some differences:</p>
  <ul>
  <li>note map is automatically generated while relation map must be created manually</li>
  <li>relation map is a type of note while a link map is just virtual visualization</li>
  </ul>


blobId: uruFrY6kRyHWOdJaWuS5
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.402Z
content:
  <h2>Note navigation</h2>
  <p>One of the Trilium's goals is to provide fast and comfortable navigation between notes.</p>
  <h2>Backwards and forward</h2>
  <p>You can use alt-left and alt-right to move back and forward in history of viewed pages.</p>
  <p>This works identically to browser backwards / forwards, it's actually using built-in browser support for this.</p>
  <p><img src="api/images/TNwG60mH2Foe/back-and-forwards.gif" alt="" /></p>
  <h2>Jump to note</h2>
  <p>This is useful to quickly find and view arbitrary note - click on <code>Jump to</code> button on the top or press <code>CTRL-J</code>. Then type part of the note name and autocomplete will help you pick the desired note.</p>
  <p><img src="api/images/snfWRIih71MM/jump-to.gif" alt="" /></p>
  <h3>Recent notes</h3>
  <p>Jump to note also has the ability to show the list of recently viewed / edited notes and quickly jump to it.</p>
  <p>To access this functionality, click on <code>Jump to</code> button on the top. By default, (when nothing is entered into autocomplete), this dialog will show the list of recent notes.</p>
  <p>Alternatively you can click on the "time" icon on the right.</p>
  <p><img src="api/images/wpFu8PhUu7e7/recent-notes.gif" alt="" /></p>


blobId: kvVEvY32nl8A327yN8KQ
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.405Z
content:
  <h2>Note revisions</h2>
  <p>Trilium supports seamless versioning of notes by storing snapshots ("revisions") of notes at regular intervals.</p>
  <h2>Note Revisions Snapshot Interval</h2>
  <p>Time interval of taking note snapshot is configurable in the Options -&gt; Other dialog. This provides a tradeoff between more revisions and more data to store.</p>
  <p>To turn off note versioning for a particular note (or subtree), add <code>disableVersioning</code> <a href="#root/zEY4DaJG4YT5">label</a> to the note.</p>
  <h2>Note Revision Snapshots Limit</h2>
  <p>The limit on the number of note snapshots can be configured in the Options -&gt; Other dialog. 
  The note revision snapshot number limit refers to the maximum number of revisions that can be saved for each note. Where -1 means no limit, 0 means delete all revisions. You can set the maximum revisions for a single note through the <code>versioningLimit=X</code> label.</p>
  <p>The note limit will not take effect immediately; it will only apply when the note is modified.</p>
  <p>You can click the <strong>Erase excess revision snapshots now</strong> button to apply the changes immediately.</p>
  <p>Note revisions can be accessed through the button on the right of ribbon toolbar.</p>
  <p><img src="api/images/MA2uvkVloWXl/note-revisions.png" alt="" /></p>


blobId: pcYXUKRHAaLftYMOYe1V
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.410Z
content:
  <h2>Note</h2>
  <p>Note is a central entity in Trilium. Main attributes of note are title and content.</p>
  <h3>Note types</h3>
  <ul>
  <li><a href="#root/iPIMuisry3hd">text note</a> - this is default note type which allows you to put rich text, images etc.</li>
  <li><a href="#root/6f9hih2hXXZk">code note</a> - some kind of formal code, typically programming language (e.g. JavaScript) or data structure (e.g. JSON)</li>
  <li><a href="https://github.com/TriliumNext/Notes/wiki/Images">image note</a> - represents single image</li>
  <li>file note - represents uploaded file (e.g. docx MS Word document).</li>
  <li>render HTML note - this works as an output screen of attached <a href="#root/CdNpE2pqjmI6">scripts</a></li>
  <li><a href="#root/m523cpzocqaD">saved search</a> note - contains saved search query and dynamically displays result of the search as its sub-notes</li>
  <li><a href="#root/iRwzGnHPzonm">relation map</a> note - visualizes notes and their relations</li>
  <li><a href="#root/GTwFsgaA0lCt">book note</a> - displays its children notes, useful for reading many short notes</li>
  <li>mermaid - create diagrams and flowcharts using <a href="https://github.com/mermaid-js/mermaid">mermaid.js ↗</a></li>
  <li><a href="#root/fKYGY3OOo5d1">canvas note</a> - allows hand drawn notes and basic diagraming on an infinite canvas using <a href="https://github.com/excalidraw/excalidraw">excalidraw ↗</a></li>
  </ul>
  <p>In Trilium there's no specific "folder" note type. Any note can have children and thus be a folder.</p>
  <h3>Root note</h3>
  <p>There's one special note called "root note" which is root of the note tree. All other notes are placed below it in the structure.</p>
  <h3>Tree structure</h3>
  <p>Importantly, note itself doesn't carry information on its placement in note tree. See <a href="#root/IakOLONlIfGI">cloning</a> for details.</p>
  <p>Tree structure of notes can resemble file system - but compared to that notes in Trilium can act as both file and directory - meaning that note can both have its own content and have children. "Leaf note" is a note which doesn't have any children.</p>
  <h3>Deleting / undeleting notes</h3>
  <p>When you delete a note in Trilium, it is actually only marked for deletion (soft-delete) - the actual content, title, attributes etc. are not deleted, only hidden.</p>
  <p>Within (by default) 7 days, it is possible to undelete these soft-deleted notes - open Recent Changes dialog, and you will see a list of all modified notes including the deleted ones. Notes available for undeletion have a link to do so. This is kind of "trash can" functionality known from e.g. Windows.</p>
  <p>Clicking an undelete will recover the note, it's content and attributes - note should be just as before being deleted. This action will also undelete note's children which have been deleted in the same action.</p>
  <p>To be able to undelete a note, it is necessary that deleted note's parent must be undeleted (otherwise there's no place where we can undelete it to). This might become a problem when you delete more notes in succession - the solution is then undelete in the reverse order of your deletion.</p>
  <p>After the 7 days (configurable) the notes will be "erased" - their title, content, revisions and attributes will be erased, and it will not be possible anymore to recover them (unless you restore <a href="#root/ODY7qQn5m2FT">backup</a>).</p>
  <h2>See also</h2>
  <ul>
  <li><a href="#root/CoFPLs3dRlXc">Read-only note</a></li>
  </ul>


blobId: OYKfGEYyaslkoA9tsKZX
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.416Z
content:
  <h2>Onenote</h2>
  <h2>Migrating from OneNote (user contributed)</h2>
  <p><strong>This page describes a method to migrate via EverNote Legacy, but this app is no longer available/working.</strong></p>
  <h2>Prep Onenote notes for best compatibility</h2>
  <ul>
  <li>Remove Onenote Tags and replace with Emoji if possible (Onenote Tags will get imported into trilium as an image which clutters the Trilium tree somewhat)</li>
  <li>Make sure to use Onenote headings where applicable (These will be carried over correctly into Trilium)</li>
  <li>Remove extra whitespace in Onenote (Whitespace seems to be more noticible in Trilium, so removing it now will make it look nicer in trilium)</li>
  <li>If possible, try to avoid very long Onenote pages. Trilium works best with shorter concise pages with any number of sub or (sub-sub...) pages.</li>
  <li>Make sure numbered lists don't have unusual spaces between items in the list (Sometimes the numbered list will start at 1 again in Trilum if there is an extra space in the list in OneNote).</li>
  </ul>
  <h2>Migration Procedure</h2>
  <h3>Import into Evernote from OneNote:</h3>
  <ul>
  <li>Install <a href="https://web.archive.org/web/20230327110646/https://help.evernote.com/hc/en-us/articles/360052560314">Evernote Legacy</a>. Current versions of Evernote do not have this functionality. (Requires Evernote account, but import works without internet connection - be sure to NOT sync notes to Evernote!).</li>
  <li>In evernote navigate to File &gt; Import &gt; Onenote &gt; Notebook &gt; Section &gt; OK</li>
  </ul>
  <p>If exporting all sections at a time, they will not be grouped in folders - they will all be added to a single folder, but the order will be kept, so you can re-group into folders after importing to Trilium</p>
  <h3>Export from Evernote</h3>
  <ul>
  <li>Right click on the created notebook in Evernote and choose "Export Notes…"</li>
  <li>Use the default export format of .enex</li>
  </ul>
  <h3>Cleanup enex file (optional)</h3>
  <ul>
  <li><p>If the Onenote header (that is at the top of each Onenote page) is not desired, you can use the following regex to remove them in a text editor like VsCode:</p>
  <p>Find (using regex): <code>.&lt;div.*&gt;&lt;h1</code> Replace with: <code>&lt;h1</code></p>
  </li>
  </ul>
  <h3>Import into Trilium</h3>
  <ul>
  <li>In Trilium, right click on the root node and choose Import (all default options should be fine).</li>
  <li>Select the .enex file exported from Evernote</li>
  <li>Be patient. Large .enex files may take a few minutes to process</li>
  <li>Repeat import for each .enex file</li>
  </ul>
  <h2>Other importing notes:</h2>
  <ul>
  <li>Centered text in Onenote will be left-justified after importing into Trilium</li>
  <li>Internal onenote links will obviously be broken, but the link still exists so you can do a search in Trilium to find all onenote:// links and then re-link to the proper Trilium page (there is no way to link to a paragraph in trilium, so it's good to keep trilium pages short so links point to a small chunk of information instead of a massive note)</li>
  <li>Text colors, highlights, and formatting generally carries over well</li>
  <li>Revision history will be lost, but any new revisions will be tracked in Trilium</li>
  <li>The structure of notes are not maintained exactly, so if you had sub-notes in Onenote, you may have to re-arrange the notes accordingly (This is easy since the order of the notes is preserved).</li>
  <li>Evernote tags are created for each "section" in OneNote and these tags are carried over to Trilium as attributes<ul>
  <li>If the tags are not desired, you can turn them off in the Evernote export options.</li>
  </ul>
  </li>
  <li>If the "Created with OneNote" text is not desired, do a find/replace in the enex files before importing to Trilium</li>
  <li>Some links will be disabled (not clickable) when importing from enex.</li>
  <li>Files, screenshots, and attachments are all preserved (This is the only one-note export option that seems to preserve all of these).</li>
  </ul>


blobId: RF8gVnYuIvLR80TveEIS
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.420Z
content:
  <h2>Packaged server installation</h2>
  <p>This is essentially Trilium sources + node modules + node.js runtime packaged into one 7z file.</p>
  <h2>Steps</h2>
  <ul>
  <li>ssh into your server</li>
  <li>use <code>wget</code> (or <code>curl</code> or whatever) to download latest <a href="https://github.com/TriliumNext/Notes/releases/latest">trilium-linux-x64-server-[VERSION].xz</a> %%{WARNING}%% (notice -server suffix) on your server</li>
  <li>unpack the archive, e.g. using <code>tar -xf -d trilium-linux-x64-server-[VERSION].tar.xz</code></li>
  <li><code>cd trilium-linux-x64-server</code></li>
  <li><code>./trilium.sh</code></li>
  <li>you can open the browser and open http://[your-server-hostname]:8080 and you should see Trilium initialization page</li>
  </ul>
  <p>The problem with above steps is that once you close the SSH connection, the Trilium process is terminated. To avoid that, you have two options:</p>
  <ul>
  <li>Kill it (with e.g. <code>CTRL-C</code>) and run again like this: <code>nohup ./trilium &amp;</code>.</li>
  <li>Configure systemd to automatically run Trilium in the background on every boot</li>
  </ul>
  <h2>Configure Trilium to auto-run on boot with systemd</h2>
  <ul>
  <li>After downloading, extract and move Trilium:</li>
  </ul>
  <pre><code class="language-text-x-trilium-auto">tar -xvf trilium-linux-x64-server-[VERSION].tar.xz
  sudo mv trilium-linux-x64-server /opt/trilium</code></pre><ul>
  <li>Create the service:</li>
  </ul>
  <pre><code class="language-text-x-trilium-auto">sudo nano /etc/systemd/system/trilium.service</code></pre><ul>
  <li>Paste this into the file (replace the user and group as needed):</li>
  </ul>
  <pre><code class="language-text-x-trilium-auto">[Unit]
  Description=Trilium Daemon
  After=syslog.target network.target

  [Service]
  User=xxx
  Group=xxx
  Type=simple
  ExecStart=/opt/trilium/trilium.sh
  WorkingDirectory=/opt/trilium/

  TimeoutStopSec=20
  # KillMode=process leads to error, according to https://www.freedesktop.org/software/systemd/man/systemd.kill.html
  Restart=always

  [Install]
  WantedBy=multi-user.target</code></pre><ul>
  <li>Save the file (CTRL-S) and exit (CTRL-X)</li>
  <li>Enable and launch the service:</li>
  </ul>
  <pre><code class="language-text-x-trilium-auto">sudo systemctl enable --now -q trilium</code></pre><ul>
  <li>You can now open a browser to http://[your-server-hostname]:8080 and you should see the Trilium initialization page.</li>
  </ul>
  <h2>Common issues</h2>
  <h3>Outdated glibc</h3>
  <pre><code class="language-text-x-trilium-auto">Error: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /var/www/virtual/.../node_modules/@mlink/scrypt/build/Release/scrypt.node)
      at Object.Module._extensions..node (module.js:681:18)
      at Module.load (module.js:565:32)
      at tryModuleLoad (module.js:505:12)</code></pre><p>If you get an error like this, you need to either upgrade your glibc (typically by upgrading to up-to-date distribution version) or use some other <a href="#root/WOcw2SLH6tbX">server installation</a> method.</p>
  <h2>TLS</h2>
  <p>Don't forget to <a href="#root/l2VkvOwUNfZj">configure TLS</a>, which is required for secure usage!</p>


blobId: xFRauqR2DDCvaACOXBqB
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.460Z
content:
  <h2>Patterns-of-personal-knowledge</h2>
  <h2>Patterns-of-personal-knowledge-base</h2>
  <p>This page contains description of some of the patterns I use to organize information in my knowledge base. This is meant to give some inspiration of how one might create and structure their knowledge base in general and also specifically in <a href="https://github.com/triliumnext/notes">Trilium Notes</a>. It also gives some background and justification for some of the design decisions.</p>
  <h2>Meta patterns</h2>
  <p>Just to be clear, meta patterns are "patterns of patterns", i.e. patterns appearing in other patterns.</p>
  <h3>Hierarchical organization of information</h3>
  <p>Basic meta pattern is that I sort notes (units of information) into a hierarchy - I have some "top level" notes which represent coarse grained organization, these then split into sub-notes defining finer grained organization and so on. I consider this hierarchical (tree) organization very efficient for organization of large amounts of information. A lot of note taking software (such as Evernote) are frustratingly limited in this regard which limits scalability of the software to large amounts of notes.</p>
  <h4>Scalability</h4>
  <p>It's important to frame the following (meta) patterns with some idea of how large amount of data are we talking about.</p>
  <p>My rule of thumb for estimation of size of personal knowledge base is that you can reasonably produce around 10 notes a day, which is 3650 in a year. I plan to use my knowledge base long term (with or without Trilium Notes), probably decades so you can easily get to number 100 000 or even more. Right now, my personal knowledge base has around 10 000 notes.</p>
  <p>100 000 is a number to which most note taking software doesn't scale well (in both performance and UI). Yet I don't think it's really very much considering a lifetime of knowledge.</p>
  <h4>Lazy hierarchy</h4>
  <p>My approach to creating the hierarchy is being lazy - I don't create the structure first and then fill it with notes, instead I create single note for some specific topic and start using this one note. Once the content starts to grow, and I see how <em>some</em> parts could be split out, I move them out into separate sub notes. As an example I have a book review for <em>The Fellowship of the Ring</em>:</p>
  <ul>
  <li>Book reviews<ul>
  <li>The Fellowship of the Ring</li>
  </ul>
  </li>
  </ul>
  <p>The note contains basic book info (author, publisher etc.), book highlights with the comments and then overall review. Now it turns out there's far too many book highlights and overall review is also rather long, so I want to change the structure to the following:</p>
  <ul>
  <li>Book reviews<ul>
  <li>The Fellowship of the Ring       <em>(still contains basic info)</em><ul>
  <li>Highlights</li>
  <li>Review</li>
  </ul>
  </li>
  </ul>
  </li>
  </ul>
  <p>If I used standard text file stored in a filesystem I would soon run into an annoying problem that in order to split out the Highlights and Review into sub-notes I would also have to convert <em>The Fellowship of the Ring</em> from text file into directory and split out all sections of the note into sub-notes. Instead, Trilium treats all notes as equal - both leaf notes and inner notes can have both text content which allows me to sub-structure only content which needs it.</p>
  <h3>Sorting notes into multiple places in the hierarchy</h3>
  <p>While organizing the notes into the hierarchy, you very quickly run into a dilemma - your note seem to belong to two places in the hierarchy equally. As an example - you want to make a note about <a href="https://en.wikipedia.org/wiki/Bash_(Unix_shell)">bash</a> - does it belong to "OS / Linux" or "Programming / Scripting languages"? This is actually a false dichotomy forced down by the limits of the basic tree hierarchy - the answer is <em>of course it belongs to both</em>. This is the reason why Trilium doesn't use standard tree structure (which requires every note to have exactly one parent), but an extension which allows every note to have several parents, thus effectively allowing it to appear in multiple places in the hierarchy. For lack of better term I call this "<a href="https://github.com/TriliumNext/Notes/wiki/Cloning_notes">cloning</a>". The main problem with this term is that it suggests that each clone must have an original, but here all clones are completely equal - effectively there's no original.</p>
  <p>In tech lingo, it might be better to describe it as a <a href="https://en.wikipedia.org/wiki/Hard_link">hard link</a> with an important difference that it is possible to hard link (clone) a directory (inner note).</p>
  <h3>Protected notes</h3>
  <p>I have Trilium Notes opened non-stop. Sometimes I forget to lock my computer when going to the bathroom. Sometimes I let a friend or family member to use my computer for a minute without supervision. They might click on (running) Trilium and inadvertently see a note I really don't want anybody to see (personal diary, credentials). To cover this, Trilium has a concept of "<a href="https://github.com/TriliumNext/Notes/wiki/Protected-notes">protected notes</a>" - protected note is encrypted and on top of that requires the user to enter the password every 5 minutes which guarantees that such note can be in a readable state only for small amount of time. Working with ordinary (not protected) notes don't require password so you're not bothered by extra security when it's not needed.</p>
  <h3>Archiving notes</h3>
  <p>Notes can lose relevancy with time - let's say I switch jobs - all the notes specific to the former employer immediately lose most of its import. This doesn't mean I want to delete these notes though - typically I just want them to somehow deprioritize - in Trilium I would do that by assigning an <a href="https://github.com/TriliumNext/Notes/wiki/Attribute-inheritance">inherited</a> <a href="https://github.com/TriliumNext/Notes/wiki/Attributes">label</a> <code>archived</code> to the company root note. The main effect of this label is that all the notes from this sub-tree are filtered out from search results (fast search via note autocomplete is my main <a href="https://github.com/TriliumNext/Notes/wiki/Note-navigation">navigation approach</a>). Apart from this, I also typically move such outdated notes to some less prominent place in the hierarchy.</p>
  <p>I use archivation also for notes which are not very relevant from their creation - an example might be automatically imported reddit comments.</p>
  <p>Sometimes there's no clear <em>category</em> split between relevant and non-relevant notes, in that case I just create "<em>OLD</em>" note with <code>archived</code> label and move all irrelevant notes there. So my credentials note might look something like this:</p>
  <ul>
  <li>Credentials<ul>
  <li>Personal<ul>
  <li>OLD       <em>(contains a bunch of notes with credentials for services I don't use anymore)</em></li>
  <li>Gmail</li>
  <li>Github</li>
  <li>...</li>
  </ul>
  </li>
  </ul>
  </li>
  </ul>
  <h2>Patterns</h2>
  <h3>Day note</h3>
  <p>Every day has its note which contains or references everything related to the given day. Structure looks like this:</p>
  <ul>
  <li>2018<ul>
  <li>11 - November<ul>
  <li>26 - Monday</li>
  <li>27 - Tuesday<ul>
  <li>subnote 1</li>
  </ul>
  </li>
  </ul>
  </li>
  </ul>
  </li>
  </ul>
  <p>Day note serves as a workspace and note inbox at the same time - it's the default location to create a note when I don't have time to think about proper placement. At the end of the day I typically review my day note and clone the notes into suitable locations in the hierarchy.</p>
  <p>Trilium has this pattern partly built-in - Trilium understands and can create this Year / Month / Day structure semi-automatically (on API call). There's also global keyboard shortcut <code>CTRL-ALT-P</code> which will create new note in the day note.</p>
  <p>What notes do I keep under this day note?</p>
  <ul>
  <li>TODO list for given day (this can be automated - see <a href="https://github.com/TriliumNext/Notes/wiki/Task-manager">Task Manager</a>)</li>
  <li>Personal diary</li>
  <li><a href="https://github.com/TriliumNext/Notes/wiki/Cloning-notes">clones</a> of notes I created during this day (which kind of represents what I've been working on).</li>
  <li>I often clone notes (or sub-trees) of e.g. projects I'm working on at given day so they are at hand</li>
  <li>I have some <a href="https://github.com/TriliumNext/Notes/wiki/Scripts">scripts</a> which allow me to track certain daily metrics (like weight). These are saved into one daily "data note" (actually JSON <a href="https://github.com/TriliumNext/Notes/wiki/Code-notes">code note</a>).<ul>
  <li>I have other scripts which then help me to visualize these data (see a <a href="https://github.com/TriliumNext/Notes/wiki/Weight%20tracker">Weight Tracker</a> example)</li>
  <li>I have a script which automatically imports all my comments from reddit into the day note.<ul>
  <li>People are sometimes wondering why. The answer is that I usually put some effort and thought into a comment and that's why I feel it's worth preserving, especially if it can be done automatically.</li>
  </ul>
  </li>
  </ul>
  </li>
  </ul>
  <p>For most notes, this day note placement is <em>secondary</em> and their primary location is somewhere else (e.g. for a book review I've been working on it's <em>Book / Reviews</em>, not the day note). So for this pattern to work, ability to <a href="https://github.com/TriliumNext/Notes/wiki/Cloning-notes">clone</a> notes into multiple places is pretty fundamental.</p>
  <h3>Projects</h3>
  <p><em>Project</em> is pretty self-explanatory, for me specifically it also means being long term (years) - an example of a project might be Trilium Notes or university studies. Given their longevity, projects can be large and deep, but their structure is very domain specific, and I don't see any common patterns. What's pretty clear is they are often widely interconnected with other parts of the knowledge base - e.g. university credentials are cloned from "Credentials / University" top level notes and Trilium related blog posts are in "Blog / [Name of the blog] / Trilium".</p>
  <p><em>Epics</em> are the same thing as projects, but differ in scope - they are typically several months long and as such are usually placed into a year note (e.g. <em>2018 / Epics</em>). Epics are often of work nature (also cloned into work note) and personal (e.g. currently I have large epic for moving to a different city).</p>
  <p>I don't have a term for short term projects (typically several days long), but continuing the scrum analogy I might call them <em>story</em>. These are often placed directly into day notes and manually moved from one day to another (or place into a month note, e.g. <em>2018 / 11 - November</em>).</p>
  <h3>Credentials</h3>
  <p>I keep all my credentials in the knowledge base, they are sorted into categories - work related, project related, personal per country etc. These notes are of course <a href="https://github.com/TriliumNext/Notes/wiki/Protected-notes">protected</a> and are often cloned into other places (e.g. project credentials are cloned into the project itself). This is a pretty important advantage compared to traditional tools like KeePass - all the relevant information is centralized into one place without compromising security.</p>
  <h3>People profiles</h3>
  <p>This might seem creepy to some, but I keep a profile on most people. It contains pretty standard things like date of birth, contacts, address, but also current and previous employments, their hobbies and worldviews and sometimes even important (IM/mail/meatspace) conversations. Just about everything I find notable. It helps to refresh some basic info before meeting people, especially if you haven't been in touch in a while. It gets pretty awkward to ask for the tenth time where do they work for example, because you keep forgetting it.</p>
  <p>Naturally I have a lot of (extended) family members, friends, acquaintances etc. so I need some way to sort them. My main method is to sort them by social circle (work, high school, sports club etc.), sometimes also by their town of residence. Family <em>circle</em> is still too large so the further organization is by <em>clan</em> (as in "Smiths"). Some people are members of several such circles, so they are just cloned into multiple places.</p>
  <p>For family specifically it's pretty useful to create <a href="https://github.com/TriliumNext/Notes/wiki/Relation-map">relation map</a> to visualize relationships:</p>
  <p><img src="api/images/xeZPrfi77XPu/relation-map-family.png" alt="" /></p>
  <h3>Books</h3>
  <p>Of course, I keep standard "To read" list. I also keep a record on the books I've read - typically one book has one subtree where the root has some basic info like author, page count, publication date, date started, date finished (in the form of <a href="https://github.com/TriliumNext/Notes/wiki/Promoted-attributes">promoted labels</a>). I also write a (private) review and keep list of highlights from Kindle, optionally with some commentary, these are usually stored in sub notes (unless they are pretty short).</p>
  <p>To keep the list of books manageable, I sort them per year (of reading them), this also gives me some basic overview of "reading performance" for given year. I plan to create a <a href="https://github.com/TriliumNext/Notes/wiki/Scripts">script</a> which would show some timeline chart visualizing book attributes <code>dateStarted</code> - <code>dateFinished</code> to have nicer view of my reading sprints and trends.</p>
  <p>Some specific authors also have their own note which contains cloned book reviews, links to interviews and other related resources.</p>
  <p>I have similar system for movies and TV shows, but not as sophisticated.</p>
  <h3>Personal diary</h3>
  <p>This is a place to reflect on events, experiences, new findings etc. This can help you get deeper understanding of your inner self, clarify your thinking and make better decisions as a result.</p>
  <p>I sort personal diary notes directly under <em>day note</em> (explained above), but it can be cloned also to e.g. "trip note" (if the diary note is about given trip) or to person's profile (if the person plays a role in the diary note). All my diary notes are <a href="https://github.com/TriliumNext/Notes/wiki/Protected-notes">protected</a> since they are usually pretty sensitive.</p>
  <h3>Documents</h3>
  <p>I keep all my personal documents (ID, passport, education certificates ...) scanned in the knowledge base. They are <a href="https://github.com/TriliumNext/Notes/wiki/Synchronization">synchronized</a> across every PC which provides decent backup and makes them available everywhere.</p>
  <p>Advantage compared to e.g. keeping them in Dropbox or Google Drive is that they are not stored on some 3rd party server and they can be encrypted (<a href="https://github.com/TriliumNext/Notes/wiki/Protected-notes">protected</a>).</p>
  <h3>Inventory</h3>
  <p>Inventory contains documents and other relevant importation for my important belongings - e.g. for car you can keep the registration card, maintenance record, related costs etc. I also keep inventory for some items personally important to me - mainly computers, phones, cameras and similar electronics. This can be practical at times but also provides sentimental value.</p>
  <h3>Topic knowledge base</h3>
  <p>This where I store hard "knowledge" - summarized topics and findings from different domains. Topics can range from traditional sciences - physics, history, economy to philosophy, mental models, apps (notes about specific apps I use) etc. Of course this is very subjective - given what I do, my Physics sub-tree is pretty sparse compared to my Programming subtree.</p>
  <h3>Work knowledge base</h3>
  <p>I usually keep top level note for the company I currently work at (past jobs are moved elsewhere). I track basic organization of the company (divisions, business units), who is who (<a href="https://github.com/TriliumNext/Notes/wiki/Relation-map">relation maps</a>) are again useful for visualization), projects I work at etc.</p>
  <p>There's a number of credentials to various company services I need to use. Companies usually have a bunch of complex processes and tools. I record meeting minutes, link to the company wiki (which is usually difficult to find relevant info). In general there's a lot of company specific information I need to know or need have them at hand in a nice structure I can understand. Often it's just copy pasting and reshuffling of existing information into something more understandable for me.</p>
  <p>From my experience, keeping this makes me more productive and even more importantly dramatically reduces frustration and stress.</p>
  <h2>Conclusion</h2>
  <p>I could probably go on with more patterns (e.g. study notes, travelling), but I think you get the idea. Whatever is important in your life, it probably makes sense to document and track it.</p>


blobId: mIaQ4QAg7W3FArnp2QYf
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.466Z
content:
  <h2>Privacy-policy</h2>
  <h3>Trilium Notes</h3>
  <p>Trilium Notes does not collect/send any data from the user's installation, i.e. no analytics, no telemetry etc. The data flows only between user controlled / installed applications, without any intermediary.</p>
  <p>Automatic network activity consists of:</p>
  <ul>
  <li>Trilium periodically queries URL <a href="https://github.com/TriliumNext/Notes/releases">https://github.com/TriliumNext/Notes/releases</a> to see if there's a new stable version released. (check only, there's no automatic download and/or installation).</li>
  <li>Trilium will download spelling dictionaries automatically as needed based on language settings</li>
  </ul>
  <h3>Trilium Web Clipper</h3>
  <p>Trilium Web Clipper does not collect/send any data from the user's installation, i.e. no analytics, no telemetry etc. The data flows only between user controlled / installed applications, without any intermediary.</p>
  <h3>Trilium Sender for Android</h3>
  <p>Trilium Sender for Android does not collect/send any data from the user's installation, i.e. no analytics, no telemetry etc. The data flows only between user controlled / installed applications, without any intermediary.</p>


blobId: gD0yG4sJwARCiDEoX4DM
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.470Z
content:
  <h2>Promoted attributes</h2>
  <p>Promoted attributes are <a href="#root/zEY4DaJG4YT5">attributes</a> which are considered important and thus are "promoted" onto the main note UI. See example below:</p>
  <p><img src="api/images/rxH2Dm1jn6YT/promoted-attributes.png" alt="" /></p>
  <p>You can see the note having kind of form with several fields. Each of these is just regular attribute, the only difference is that they appear on the note itself.</p>
  <p>Attributes can be pretty useful since they allow for querying and script automation etc. but they are also inconveniently hidden. This allows you to select few of the important ones and push them to the front of the user.</p>
  <p>Now, how do we make attribute to appear on the UI?</p>
  <h2>Attribute definition</h2>
  <p>Attribute is always name-value pair where both name and value are strings.</p>
  <p><em>Attribute definition</em> specifies how should this value be interpreted - is it just string, or is it a date? Should we allow multiple values or note? And importantly, should we <em>promote</em> the attribute or not?</p>
  <p><img src="api/images/l42VG6hOjJ40/attribute-definitions.png" alt="" /></p>
  <p>You can notice tag attribute definition. These "definition" attributes define how the "value" attributes should behave.</p>
  <p>So there's one attribute for value and one for definition. But notice how definition attribute is <a href="#root/bwZpz2ajCEwO">Inheritable</a>, meaning that it's also applied to all descendant note. So in a way, this definition is used for the whole subtree while "value" attributes are applied only for this note.</p>
  <h3>Inverse relation</h3>
  <p>Some relations always occur in pairs - my favorite example is on the family. If you have a note representing husband and note representing wife, then there might be a relation between those two of <code>isPartnerOf</code>. This is bidirectional relationship - meaning that if a relation is pointing from husband to wife then there should be always another relation pointing from wife to husband.</p>
  <p>Another example is with parent - child relationship. Again these always occur in pairs, but in this case it's not exact same relation - the one going from parent to child might be called <code>isParentOf</code> and the other one going from child to parent might be called <code>isChildOf</code>.</p>
  <p>Relation definition allows you to specify such "inverse relation" - for the relation you just define you specify which is the inverse relation. Note that in the second example we should have two relation definitions - one for <code>isParentOf</code> which defines <code>isChildOf</code> as inverse relation and then second relation definition for <code>isChildOf</code> which defines <code>isParentOf</code> as inverse relation.</p>
  <p>What this does internally is that whenever we save a relation which has defined inverse relation, we check that this inverse relation exists on the relation target note. Similarly, when we delete relation, we also delete inverse relation on the target note.</p>


blobId: iXeWPFugM0kXpubHgKV1
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.476Z
content:
  <h2>Protected Notes</h2>
  <p>Trilium is designed to store a wide variety of data, including sensitive information such as personal journals, credentials, or confidential documents. To safeguard this type of content, Trilium offers the option to protect notes, which involves the following measures:</p>
  <ul>
  <li><p><strong>Encryption:</strong> Protected notes are encrypted using a key derived from your password. This ensures that without the correct password, protected notes remain indecipherable. Even if someone gains access to your Trilium <a href="#root/wX4HbRucYSDD">database</a>, they won't be able to read your encrypted notes.</p>
  </li>
  <li><p><strong>Time-limited access:</strong> To access protected notes, you must first enter your password, which decrypts the note for reading and writing. However, after a specified period of inactivity (10 minutes by default), the note is unloaded from memory, requiring you to re-enter your password to access it again.</p>
  <ul>
  <li>The session timeout is extended automatically while you're interacting with the protected note, so if you're actively editing, the session remains open. However, if you switch to an unprotected note, the session timer starts, and the session expires after 10 minutes of inactivity unless you return to the protected notes.</li>
  </ul>
  </li>
  <li><p><strong>Protection scope:</strong> Protected notes ensure the confidentiality of their content and partially their integrity. While unauthorized users cannot read or edit protected notes, they can still delete or move them outside of the protected session.</p>
  </li>
  </ul>
  <h2>Using Protected Notes</h2>
  <p>By default, notes are unprotected. To protect a note, simply click on the shield icon next to the note's title, as shown here:</p>
  <p><img src="api/images/zaUtPWl8NcCt/protecting-note.gif" alt="example animation of unlocking protected notes" /></p>
  <h2>What is Encrypted?</h2>
  <p>Trilium encrypts the data within protected notes but not their metadata. Specifically:</p>
  <p><strong>Encrypted:</strong></p>
  <ul>
  <li>Note title</li>
  <li>Note content</li>
  <li>Images</li>
  <li>File attachments</li>
  </ul>
  <p><strong>Not encrypted:</strong></p>
  <ul>
  <li>Note structure (i.e., it remains visible that there are protected notes)</li>
  <li>Metadata, such as the last modified date</li>
  <li><a href="#root/zEY4DaJG4YT5">Attributes</a></li>
  </ul>
  <h2>Encryption Details</h2>
  <p>The following steps outline how encryption and decryption work in Trilium:</p>
  <ol>
  <li>The user enters a password.</li>
  <li>The password is passed through the <a href="https://en.wikipedia.org/wiki/Scrypt">scrypt</a> algorithm along with a "password verification" <a href="https://en.wikipedia.org/wiki/Salt_(cryptography)">salt</a> to confirm that the password is correct.</li>
  <li>The password is then processed again through scrypt with an "encryption" salt, which generates a hash.<ul>
  <li>Scrypt is used for <a href="https://en.wikipedia.org/wiki/Key_stretching">key stretching</a> to make the password harder to guess.</li>
  </ul>
  </li>
  <li>The generated hash is used to decrypt the actual <em>data encryption key</em>.<ul>
  <li>The data encryption key is encrypted using <a href="https://en.wikipedia.org/wiki/Advanced_Encryption_Standard">AES-128</a> with a random <a href="https://en.wikipedia.org/wiki/Initialization_vector">IV</a>.</li>
  <li>The data encryption key is randomly generated during the <a href="#root/wX4HbRucYSDD">database</a> initialization and remains constant throughout the document’s lifetime. When the password is changed, only this key is re-encrypted.</li>
  </ul>
  </li>
  <li>The data encryption key is then used to decrypt the actual content of the note, including its title and body.<ul>
  <li>The encryption algorithm used is AES-128 with <a href="https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation">CBC mode</a>, where a unique IV is generated for each encryption operation and stored with the cipher text.</li>
  </ul>
  </li>
  </ol>
  <h2>Sharing Protected Notes</h2>
  <p>Protected notes cannot be shared in the same way as regular notes. Their encryption ensures that only authorized users with the correct password can access them.</p>


blobId: rgvZglqv0Pclf1U0kkpW
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.480Z
content:
  <h2>Quick Start</h2>
  <h2>Choose the setup</h2>
  <p><strong>Local only desktop/laptop</strong> - Allows a single instance on a desktop and will save the notes locally on that desktop.</p>
  <ol>
  <li><a href="#root/poXkQfguuA0U">Desktop installation</a></li>
  </ol>
  <p><strong>Server with web only access</strong> - Installs the application on the server and allows access from any web browser on any device, including mobile.</p>
  <ol>
  <li><a href="#root/WOcw2SLH6tbX">Server installation</a></li>
  <li><a href="#root/RDslemsQ6gCp">Mobile frontend</a> (optional)</li>
  <li><a href="https://heroku.com/deploy?template=https://github.com/feilongfl/trilium-heroku"><img src="api/images/JXFeNgU8Xnp1/home-button.svg" alt="Deploy" /></a> %%{WARNING}%%</li>
  <li><a href="https://www.pikapods.com/pods?run=trilium-next">PikaPods managed hosting</a></li>
  </ol>
  <p><strong>Combination of server and desktop/laptop</strong> - Install the application on both a server, for web access and data synchronization, and desktop instance(s). This allows all the data to be stored on the server and either accessed from the web browser, or the desktop application. The desktop application will sync and store the data locally so that it can be used when offline.</p>
  <ol>
  <li><a href="#root/WOcw2SLH6tbX">Server installation</a></li>
  <li><a href="#root/RDslemsQ6gCp">Mobile frontend</a> (optional)</li>
  <li><a href="#root/poXkQfguuA0U">Desktop installation</a></li>
  <li><a href="#root/cbkrhQjrkKrh">Synchronization</a></li>
  </ol>
  <h2>Basic concepts</h2>
  <ol>
  <li>Understand <a href="#root/BFs8mudNFgCS">Note</a></li>
  <li>Watch the <a href="#root/lD2Qh6zp8k4d">Screenshot tour</a></li>
  </ol>


blobId: Yaf0VKJS0z3Hx1TyXY9W
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.483Z
content:
  <h2>Read-Only Notes</h2>
  <p>Both <a href="#root/iPIMuisry3hd">text</a> and <a href="#root/6f9hih2hXXZk">code</a> notes in Trilium can be set to read-only. When a note is in read-only mode, it is presented to the user in a non-editable view, with the option to switch to editing mode if needed.</p>
  <h2>Setting Read-Only Mode with a Label</h2>
  <p>To set a note as read-only, add the <code>readOnly</code> <a href="#root/zEY4DaJG4YT5">label</a> to the note.</p>
  <h2>Automatic Read-Only Mode</h2>
  <p>For optimization purposes, Trilium will automatically set very large notes to read-only. Displaying such lengthy notes in editing mode can slow down performance, especially when editing is unnecessary.</p>
  <p>If you want to ensure that a specific note remains editable regardless of its size, you can add the <code>autoReadOnlyDisabled</code> <a href="#root/zEY4DaJG4YT5">label</a> to the note.</p>


blobId: hJBSNXejbEPLe1kYcKes
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.488Z
content:
  <h2>Relation-map</h2>
  <p>Relation map is a type of <a href="#root/kBrnXNG3Hplm">note</a> which visualizes notes and their <a href="#root/zEY4DaJG4YT5">relations</a>. See an example:</p>
  <h2>Development process demo</h2>
  <p>This is a basic example how you can create simple diagram using relation maps:</p>
  <p><img src="api/images/EH6qNioOHeyT/relation-map-dev-process.png" alt="" /></p>
  <p>And this is how you can create it:</p>
  <p><img src="api/images/SC6fYfv2NV3q/relation-map-dev-process-demo." alt="" /></p>
  <p>We start completely from scratch by first creating new note called "Development process" and changing its type to "Relation map". After that we create new notes one by one and place them by clicking into the map. We also drag <a href="#root/zEY4DaJG4YT5">relations</a> between notes and name them. That's all!</p>
  <p>Items on the map - "Specification", "Development", "Testing" and "Demo" are actually notes which have been created under "Development process" note - you can click on them and write some content. Connections between notes are called "<a href="#root/zEY4DaJG4YT5">relations</a>".</p>
  <h2>Family demo</h2>
  <p>This is more complicated demo using some advanced concepts. Resulting diagram is here:</p>
  <p><img src="api/images/xeZPrfi77XPu/relation-map-family.png" alt="" /></p>
  <p>This is how you get to it:</p>
  <p><img src="api/images/N98UhifxrVpZ/relation-map-family-demo.gif" alt="" /></p>
  <p>There are several steps here:</p>
  <ul>
  <li>we start with empty relation map and two existing notes representing Prince Philip and Queen Elizabeth II. These two notes already have "isPartnerOf" <a href="#root/zEY4DaJG4YT5">relations</a> defined.<ul>
  <li>There are actually two "inverse" relations (one from Philip to Elizabeth and one from Elizabeth to Philip)</li>
  </ul>
  </li>
  <li>we drag both notes to relation map and place to suitable position. Notice how the existing "isPartnerOf" relations are displayed.</li>
  <li>now we create new note - we name it "Prince Charles" and place it on the relation map by clicking on the desired position. The note is by default created under the relation map note (visible in the note tree on the left).</li>
  <li>we create two new relations "isChildOf" targeting both Philip and Elizabeth<ul>
  <li>now there's something unexpected - we can also see the relation to display another "hasChild" relation. This is because there's a <a href="#root/OFXdgB2nNk1F">relation definition</a> which puts "isChildOf" as an "<a href="#root/OFXdgB2nNk1F">inverse</a>" relation of "hasChildOf" (and vice versa) and thus it is created automatically.</li>
  </ul>
  </li>
  <li>we create another note for Princess Diana and create "isPartnerOf" relation from Charles. Again notice how the relation has arrows both ways - this is because "isPartnerOf" definition specifies its inverse relation as again "isPartnerOf" so the opposite relation is created automatically.</li>
  <li>as the last step we pan &amp; zoom the map to fit better to window dimensions.</li>
  </ul>
  <p>Relation definitions mentioned above come from "Person template" note which is assigned to any child of "My Family Tree" relation note. You can play with the whole thing in the <a href="#root/wX4HbRucYSDD">demo notes</a>.</p>
  <h2>Details</h2>
  <p>You can specify which relations should be displayed with comma delimited names of relations in <code>displayRelations</code> label.</p>
  <p>Alternatively, you can specify comma delimited list of relation names in <code>hideRelations</code> which will display all relations, except for the ones defined in the label.</p>
  <h2>See also</h2>
  <ul>
  <li><a href="#root/BCkXAVs63Ttv">Note map</a> is a similar concept</li>
  </ul>


blobId: MMICYDany1CSYl6HYfME
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.492Z
content:
  <h2>Saved Searches</h2>
  <p>Trilium allows you to save common searches as notes within the note tree. The search results will appear as sub-notes under these "saved search" notes. Here is an example of how it works:</p>
  <p><img src="api/images/rVtYANyVhE9U/saved-search-image.gif" alt="save-search" /></p>
  <h2>Location</h2>
  <p>By default, saved searches are stored in the day note. However, you can designate a different note to store saved searches by marking it with the <code>#searchHome</code> label. Additionally, for <a href="#root/9sRHySam5fXb">workspaces</a>, you can use the <code>#workspaceSearchHome</code> label to specify a storage location for saved searches within that workspace.</p>


blobId: MFoS3W6YFhVq4XPQcPSd
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.495Z
content:
  <h2>Screenshot tour</h2>
  <p>Sometimes the fastest way to assess the software is just through screenshots so here they are:</p>
  <p><img src="api/images/V01a3OdC9O06/screenshot.png" alt="" /></p>
  <p><img src="api/images/zaQnUsJTbvjr/dark-theme.png" alt="" /></p>
  <p>See <a href="#root/Wy267RK4M69c">Themes</a>.</p>
  <p><img src="api/images/8jgXl1RUGL4H/code-note.png" alt="" /></p>
  <p>This shows <a href="#root/6f9hih2hXXZk">code note</a> editor.</p>
  <p><img src="api/images/umjOUcnZi4z2/promoted-attributes-queen.png" alt="" /></p>
  <p>See <a href="#root/OFXdgB2nNk1F">promoted attributes</a></p>
  <p><img src="api/images/xeZPrfi77XPu/relation-map-family.png" alt="" /></p>
  <p>See <a href="#root/iRwzGnHPzonm">relation map</a>.</p>
  <p><img src="api/images/5nE2aM3crNI6/link-map.png" alt="" /></p>
  <p>See <a href="#root/Hdf1kG6Kvcl1">link map</a>.</p>
  <p><img src="api/images/nQf1irAyZrZl/day-notes.png" alt="" /></p>
  <p>See <a href="#root/l0tKav7yLHGF">Day notes</a>.</p>
  <p><img src="api/images/PFrpANAUte0M/weight-tracker.png" alt="" /></p>
  <p>See <a href="#root/R7abl2fc6Mxi">Weight tracker</a>.</p>
  <p><img src="api/images/92KeXdKh3Ca1/task-manager.png" alt="" /></p>
  <p>See <a href="#root/xYjQUYhpbUEW">Task manager</a>.</p>
  <p><img src="api/images/MA2uvkVloWXl/note-revisions.png" alt="" /></p>
  <p>See <a href="#root/vZWERwf8U3nx">Note revisions</a>.</p>
  <p><img src="api/images/TFAiJIXJFfqv/mobile-smartphone.png" alt="" /></p>
  <p><img src="api/images/fi37V32TNyzm/mobile-tablet.png" alt="" /></p>
  <p>See <a href="#root/RDslemsQ6gCp">Mobile frontend</a>.</p>


blobId: vXpXD3I3YklfMhGol3IL
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.501Z
content:
  <h2>Script API</h2>
  <p>Trilium offers a "Script API" that enables scripts to perform various useful functions. There are two main APIs available:</p>
  <ul>
  <li><a href="https://triliumnext.github.io/Notes/frontend_api/FrontendScriptApi.html">Frontend API</a></li>
  <li><a href="https://triliumnext.github.io/Notes/backend_api/BackendScriptApi.html">Backend API</a></li>
  </ul>
  <p>Please note that the Script API is currently experimental and may undergo changes in future updates.</p>


blobId: oI6fEnP7offuu70wAUN1
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.505Z
content:
  <h2>Scripts</h2>
  <p>Trilium supports creating <a href="#root/6f9hih2hXXZk">code notes</a>, i.e. notes which allow you to store some programming code and highlight it. Special case is JavaScript code notes which can also be executed inside Trilium which can in conjunction with <a href="#root/GLks18SNjxmC">Script API</a> provide extra functionality.</p>
  <h2>Scripting</h2>
  <p>To go further I must explain basic architecture of Trilium - in its essence it is a classic web application - it has these two main components:</p>
  <ul>
  <li>frontend running in the browser (using HTML, CSS, JavaScript) - this is mainly used to interact with the user, display notes etc.</li>
  <li>backend running JavaScript code in node.js runtime - this is responsible for e.g. storing notes, encrypting them etc.</li>
  </ul>
  <p>So we have frontend and backend, each with their own set of responsibilities, but their common feature is that they both run JavaScript code. Add to this the fact, that we're able to create JavaScript [[code notes]] and we're onto something.</p>
  <h2>Button use case</h2>
  <p>Let's take a look at our demo script (shipped with default Trilium <a href="#root/wX4HbRucYSDD">database</a>) - Task manager. One of the things this script does is adding a button to the Trilium interface which will allow user to easily add new Task (TODO item).</p>
  <p><img src="api/images/DVJl4l3T8EG2/button-script.png" alt="" /></p>
  <p>First take a look at the red circle all the way on the top - this what we want to achieve - new button in UI which will create new note representing a task/todo item.</p>
  <p>Red point below the first one marks the note type we have created for this script - it's "JavaScript frontend". It's frontend because adding button to UI is clearly frontend responsibility.</p>
  <p>In the note content you can see the code which calls one of the API methods, this one is specifically meant to add new buttons. Code needs to set few button properties:</p>
  <ul>
  <li>button title</li>
  <li>icon which should appear on the button</li>
  <li>optional shortcut under which you can trigger the button</li>
  <li>most importantly "action" - what must happen when button is clicked</li>
  </ul>
  <h3>Action handler</h3>
  <p>Saving the note to the database is backend's responsibility, so we immediately pass control to the backend and ask it to create a note. Once this is done, we show the newly created note so that the user can set the task title and maybe some attributes.</p>
  <h3>Script execution</h3>
  <p>So we have a script which will add the button to the toolbar. But how can we execute it? One possibility is to click on "play" icon (marked by red circle). The problem with this is that this UI change is time bound by Trilium runtime so when we restart Trilium, button won't be there.</p>
  <p>We need to execute it every time Trilium starts up, but we probably don't want to have to manually click on play button on every start up.</p>
  <p>The solution is marked by red circle at the bottom - this note has <a href="#root/zEY4DaJG4YT5">label</a> <code>#run=frontendStartup</code> - this is one of the "system" labels which Trilium understands. As you might guess, this will cause all such labeled script notes to be executed once Trilium frontend starts up.</p>
  <p>(<code>#run=frontendStartup</code> does not work for <a href="#root/RDslemsQ6gCp">Mobile frontend</a> - if you want to have scripts running there, give the script <code>#run=mobileStartup</code> label)</p>
  <h3>More showcases</h3>
  <p>You can see more scripting with explanation in <a href="#root/5668rwcirq1t">Advanced showcases</a></p>
  <h2>Events</h2>
  <p>See <a href="#root/GPERMystNGTB">Events</a>.</p>
  <h2>Script API</h2>
  <p>See <a href="#root/GLks18SNjxmC">Script API</a>.</p>


blobId: p4lPJaezk6TxJh1g7wom
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.513Z
content:
  <h2>Search Functionality</h2>
  <h2>Local Search</h2>
  <p>Local search allows you to search within the currently displayed note. To initiate a local search, press CTRL-F. If using a web browser, this will be handled by the browser's native search functionality. In the desktop (electron) version, a separate dialog will apear.</p>
  <h2>Note Search</h2>
  <p>Note search enables you to find notes by searching for text in the title, content, or <a href="#root/zEY4DaJG4YT5">attributes</a> of the notes. You also have the option to save your searches, which will create a special search note which is visible on your navigation tree and contains the search results as sub-items.</p>
  <p>To search for notes, click on the magnifying glass icon on the toolbar or press the <code>CTRL-S</code> keyboard <a href="#root/A9Oc6YKKc65v">shortcut</a>.</p>
  <h3>Simple Note Search Examples</h3>
  <ul>
  <li><code>rings tolkien</code>: Full-text search to find notes containing both "rings" and "tolkien".</li>
  <li><code>"The Lord of the Rings" Tolkien</code>: Full-text search where "The Lord of the Rings" must match exactly.</li>
  <li><code>note.content *=* rings OR note.content *=* tolkien</code>: Find notes containing "rings" or "tolkien" in their content.</li>
  <li><code>towers #book</code>: Combine full-text and attribute search to find notes containing "towers" and having the "book" label.</li>
  <li><code>towers #book or #author</code>: Search for notes containing "towers" and having either the "book" or "author" label.</li>
  <li><code>towers #!book</code>: Search for notes containing "towers" and not having the "book" label.</li>
  <li><code>#book #publicationYear = 1954</code>: Find notes with the "book" label and "publicationYear" set to 1954.</li>
  <li><code>#genre *=* fan</code>: Find notes with the "genre" label containing the substring "fan". Additional operators include <code>*=*</code> for "contains", <code>=*</code> for "starts with", <code>*=</code> for "ends with", and <code>!=</code> for "is not equal to".</li>
  <li><code>#book #publicationYear &gt;= 1950 #publicationYear &lt; 1960</code>: Use numeric operators to find all books published in the 1950s.</li>
  <li><code>#dateNote &gt;= TODAY-30</code>: A "smart search" to find notes with the "dateNote" label within the last 30 days. Supported smart values include NOW +- seconds, TODAY +- days, MONTH +- months, YEAR +- years.</li>
  <li><code>~author.title *=* Tolkien</code>: Find notes related to an author whose title contains "Tolkien".</li>
  <li><code>#publicationYear %= '19[0-9]{2}'</code>: Use the '%=' operator to match a regular expression (regex). This feature has been available since Trilium 0.52.</li>
  </ul>
  <h3>Advanced Use Cases</h3>
  <ul>
  <li><code>~author.relations.son.title = 'Christopher Tolkien'</code>: Search for notes with an "author" relation to a note that has a "son" relation to "Christopher Tolkien". This can be modeled with the following note structure:<ul>
  <li>Books<ul>
  <li>Lord of the Rings<ul>
  <li>label: “book”</li>
  <li>relation: “author” points to “J. R. R. Tolkien” note</li>
  </ul>
  </li>
  </ul>
  </li>
  <li>People<ul>
  <li>J. R. R. Tolkien<ul>
  <li>relation: “son” points to "Christopher Tolkien" note</li>
  <li>Christopher Tolkien</li>
  </ul>
  </li>
  </ul>
  </li>
  </ul>
  </li>
  <li><code>~author.title *= Tolkien OR (#publicationDate &gt;= 1954 AND #publicationDate &lt;= 1960)</code>: Use boolean expressions and parentheses to group expressions. Note that expressions starting with a parenthesis need an "expression separator sign" (# or ~) prepended.</li>
  <li><code>note.parents.title = 'Books'</code>: Find notes with a parent named "Books".</li>
  <li><code>note.parents.parents.title = 'Books'</code>: Find notes with a grandparent named "Books".</li>
  <li><code>note.ancestors.title = 'Books'</code>: Find notes with an ancestor named "Books".</li>
  <li><code>note.children.title = 'sub-note'</code>: Find notes with a child named "sub-note".</li>
  </ul>
  <h3>Search with Note Properties</h3>
  <p>Notes have properties that can be used in searches, such as <code>noteId</code>, <code>dateModified</code>, <code>dateCreated</code>, <code>isProtected</code>, <code>type</code>, <code>title</code>, <code>text</code>, <code>content</code>, <code>rawContent</code>, <code>ownedLabelCount</code>, <code>labelCount</code>, <code>ownedRelationCount</code>, <code>relationCount</code>, <code>ownedRelationCountIncludingLinks</code>, <code>relationCountIncludingLinks</code>, <code>ownedAttributeCount</code>, <code>attributeCount</code>, <code>targetRelationCount</code>, <code>targetRelationCountIncludingLinks</code>, <code>parentCount</code>, <code>childrenCount</code>, <code>isArchived</code>, <code>contentSize</code>, <code>noteSize</code>, and <code>revisionCount</code>. </p>
  <p>These properties can be accessed via the <code>note.</code> prefix, e.g., <code>note.type = code AND note.mime = 'application/json'</code>.</p>
  <h3>Order by and Limit</h3>
  <pre><code class="language-text-x-mariadb">#author=Tolkien orderBy #publicationDate desc, note.title limit 10</code></pre><p>This example will:</p>
  <ol>
  <li>Find notes with the author label "Tolkien".</li>
  <li>Order the results by <code>publicationDate</code> in descending order.</li>
  <li>Use <code>note.title</code> as a secondary ordering if publication dates are equal.</li>
  <li>Limit the results to the first 10 notes.</li>
  </ol>
  <h3>Negation</h3>
  <p>Some queries can only be expressed with negation:</p>
  <pre><code class="language-text-x-mariadb">#book AND not(note.ancestor.title = 'Tolkien')</code></pre><p>This query finds all book notes not in the "Tolkien" subtree.</p>
  <h2>Under the Hood</h2>
  <h3>Label and Relation Shortcuts</h3>
  <p>The "full" syntax for searching by labels is:</p>
  <pre><code class="language-text-x-mariadb">note.labels.publicationYear = 1954</code></pre><p>For relations:</p>
  <pre><code class="language-text-x-mariadb">note.relations.author.title *=* Tolkien</code></pre><p>However, common label and relation searches have shortcut syntax:</p>
  <pre><code class="language-text-x-mariadb">#publicationYear = 1954
  #author.title *=* Tolkien</code></pre><h3>Separating Full-Text and Attribute Parts</h3>
  <p>Search syntax allows combining full-text search with attribute-based search seamlessly. For example, <code>tolkien #book</code> contains:</p>
  <ol>
  <li>Full-text tokens - <code>tolkien</code></li>
  <li>Attribute expressions - <code>#book</code></li>
  </ol>
  <p>Trilium detects the separation between full text search and attribute/property search by looking for certain special characters or words that denote attributes and properties (e.g., #, ~, note.). If you need to include these in full-text search, escape them with a backslash so they are processed as regular text:</p>
  <pre><code class="language-text-x-mariadb">"note.txt" 
  \#hash 
  #myLabel = 'Say "Hello World"'</code></pre><h3>Escaping Special Characters</h3>
  <p>Special characters can be enclosed in quotes or escaped with a backslash to be used in full-text search:</p>
  <pre><code class="language-text-x-mariadb">"note.txt"
  \#hash
  #myLabel = 'Say "Hello World"'</code></pre><p>Three types of quotes are supported: single, double, and backtick.</p>
  <h3>Type Coercion</h3>
  <p>Label values are technically strings but can be coerced for numeric comparisons:</p>
  <pre><code class="language-text-x-mariadb">note.dateCreated =* '2019-05'</code></pre><p>This finds notes created in May 2019. Numeric operators like <code>#publicationYear &gt;= 1960</code> convert string values to numbers for comparison.</p>
  <h2>Auto-Trigger Search from URL</h2>
  <p>You can open Trilium and automatically trigger a search by including the search <a href="https://meyerweb.com/eric/tools/dencoder/">url encoded</a> string in the URL:</p>
  <p><code>http://localhost:8080/#?searchString=abc</code></p>


blobId: X7wtAIgWvrm1qXR3avhK
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.518Z
content:
  <h2>Server Installation</h2>
  <p>This guide outlines the steps to install Trilium on your own server. You might consider this option if you want to set up <a href="#root/cbkrhQjrkKrh">synchronization</a> or use Trilium in a browser - accessible from anywhere.</p>
  <h2>Installation Options</h2>
  <p>There are several ways to install Trilium on a server, each with its own advantages:</p>
  <ul>
  <li><strong>Recommended</strong>: <a href="#root/rWX5eY045zbE">Docker Installation</a> - Available for <strong>AMD64</strong> and <strong>ARM</strong> architectures.</li>
  <li><a href="#root/3tW6mORuTHnB">Packaged Server Installation</a></li>
  <li><a href="https://www.pikapods.com/pods?run=trilium-next">PikaPods managed hosting</a></li>
  <li><a href="#root/J1Bb6lVlwU5T">Manual Installation</a></li>
  <li><a href="#root/DCmT6e7clMoP">Kubernetes</a></li>
  <li><a href="https://www.cloudron.io/store/com.github.trilium.cloudronapp.html">Cloudron</a></li>
  <li><a href="https://homelabos.com/docs/software/trilium/">HomelabOS</a></li>
  <li><a href="#root/moVgBcoxE3EK">NixOS Module</a></li>
  </ul>
  <p>The server installation includes both web and <a href="#root/RDslemsQ6gCp">mobile frontends</a>.</p>
  <h2>Configuration</h2>
  <p>After setting up your server installation, you may want to configure settings such as the port or enable <a href="#root/l2VkvOwUNfZj">TLS</a>. Configuration is managed via the Trilium <code>config.ini</code> file, which is located in the <a href="#root/tAassRL4RSQL">data directory</a> by default. To begin customizing your setup, copy the provided <code>config-sample.ini</code> file with default values to <code>config.ini</code>.</p>
  <p>You can also review the <a href="#root/Gzjqa934BdH4">configuration</a> file to provide all <code>config.ini</code> values as environment variables instead.</p>
  <h3>Config Location</h3>
  <p>By default, <code>config.ini</code>, the <a href="#root/wX4HbRucYSDD">database</a>, and other important Trilium data files are stored in the <a href="#root/tAassRL4RSQL">data directory</a>. If you prefer a different location, you can change it by setting the <code>TRILIUM_DATA_DIR</code> environment variable:</p>
  <pre><code class="language-text-x-trilium-auto">export TRILIUM_DATA_DIR=/home/myuser/data/my-trilium-data</code></pre><h3>Disabling Authentication</h3>
  <p>If you are running Trilium on localhost only or if authentication is handled by another component, you can disable Trilium’s authentication by adding the following to <code>config.ini</code>:</p>
  <pre><code class="language-text-x-toml">[General]
  noAuthentication=true</code></pre><h2>Reverse Proxy Setup</h2>
  <p>To configure a reverse proxy for Trilium, you can use either <strong>nginx</strong> or <strong>Apache</strong>.</p>
  <h3>nginx</h3>
  <p>Add the following configuration to your <code>nginx</code> setup to proxy requests to Trilium:</p>
  <pre><code class="language-text-x-nginx-conf">location /trilium/ {
      proxy_pass http://127.0.0.1:8080/;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection 'upgrade';
      proxy_set_header Host $host;
      proxy_cache_bypass $http_upgrade;
  }</code></pre><p>To avoid limiting the size of payloads, include this in the <code>server {}</code> block:</p>
  <pre><code class="language-text-x-nginx-conf"># Set to 0 for unlimited. Default is 1M.
  client_max_body_size 0;</code></pre><h3>Apache</h3>
  <p>For an Apache setup, refer to the <a href="#root/fDLvzOx29Pfg">Apache proxy setup</a> guide.</p>


blobId: mg3Y4muH1iumuNDfAwN8
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.527Z
content:
  <h2>Sharing Notes in Trilium</h2>
  <p>Trilium allows you to share selected notes as <strong>publicly accessible</strong> read-only documents. This feature is particularly useful for publishing content directly from your Trilium notes, making it accessible to others online.</p>
  <h2>Prerequisites</h2>
  <p>To use the sharing feature, you must have a <a href="#root/WOcw2SLH6tbX">server installation</a> of Trilium. This is necessary because the notes will be hosted from the server.</p>
  <h2>How to Share a Note</h2>
  <ol>
  <li><p><strong>Enable Sharing</strong>: To share a note, toggle the <code>Shared</code> switch within the note's interface. Once sharing is enabled, an URL will appear, which you can click to access the shared note.</p>
  <p><img src="api/images/5GcxcE9fP9xX/share-single-note.png" alt="Share Note" /></p>
  </li>
  <li><p><strong>Access the Shared Note</strong>: The link provided will open the note in your browser. If your server is not configured with a public IP, the URL will refer to <code>localhost (127.0.0.1)</code>.</p>
  <p><img src="api/images/Ky3qOJJMZ731/share-single-note-web.png" alt="Shared Note Example" /></p>
  </li>
  </ol>
  <h2>Sharing a Note Subtree</h2>
  <p>When you share a note, you actually share the entire subtree of notes beneath it. If the note has child notes, they will also be included in the shared content. For example, sharing the "Formatting" subtree will display a page with basic navigation for exploring all the notes within that subtree.</p>
  <p><img src="api/images/lCtZz2Z59wPT/share-multiple-notes-web.png" alt="Shared Subtree Example" /></p>
  <h2>Viewing All Shared Notes</h2>
  <p>You can view a list of all shared notes by clicking on "Show Shared Notes Subtree." This allows you to manage and navigate through all the notes you have made public.</p>
  <h2>Security Considerations</h2>
  <p>Shared notes are published on the open internet and can be accessed by anyone with the URL. The URL's randomness does not provide security, so it is crucial not to share sensitive information through this feature.</p>
  <h3>Password Protection</h3>
  <p>To protect shared notes with a username and password, you can use the <code>#shareCredentials</code> attribute. Add this label to the note with the format <code>#shareCredentials="username:password"</code>. To protect an entire subtree, make sure the label is <a href="#root/bwZpz2ajCEwO">inheritable</a>.</p>
  <h2>Advanced Sharing Options</h2>
  <h3>Customizing the Appearance of Shared Notes</h3>
  <p>The default shared page is basic in design, but you can customize it using your own CSS:</p>
  <ul>
  <li><p><strong>Custom CSS</strong>: Link a CSS <a href="#root/6f9hih2hXXZk">code note</a> to the shared page by adding a <code>~shareCss</code> relation to the note. If you want this style to apply to the entire subtree, make the label inheritable. You can hide the CSS code note from the tree navigation by adding the <code>#shareHiddenFromTree</code> label.</p>
  </li>
  <li><p><strong>Omitting Default CSS</strong>: For extensive styling changes, use the <code>#shareOmitDefaultCss</code> label to avoid conflicts with Trilium's <a href="#root/Wy267RK4M69c">default stylesheet</a>.</p>
  </li>
  </ul>
  <h3>Adding JavaScript</h3>
  <p>You can inject custom JavaScript into the shared note using the <code>~shareJs</code> relation. This allows you to access note attributes or traverse the note tree using the <code>fetchNote()</code> API, which retrieves note data based on its ID.</p>
  <p>Example:</p>
  <pre><code class="language-application-javascript-env-backend">const currentNote = await fetchNote();
  const parentNote = await fetchNote(currentNote.parentNoteIds[0]);

  for (const attr of parentNote.attributes) {
      console.log(attr.type, attr.name, attr.value);
  }</code></pre><h3>Creating Human-Readable URL Aliases</h3>
  <p>Shared notes typically have URLs like <code>http://domain.tld/share/knvU8aJy4dJ7</code>, where the last part is the note's ID. You can make these URLs more user-friendly by adding the <code>#shareAlias</code> label to individual notes (e.g., <code>#shareAlias=highlighting</code>). This will change the URL to <code>http://domain.tld/share/highlighting</code>.</p>
  <p><strong>Important</strong>:</p>
  <ol>
  <li>Ensure that aliases are unique.</li>
  <li>Using slashes (<code>/</code>) within aliases to create subpaths is not supported.</li>
  </ol>
  <h3>Viewing and Managing Shared Notes</h3>
  <p>All shared notes are grouped under an automatically managed "Shared Notes" section. From here, you can view, share, or unshare notes by moving or cloning them within this section.</p>
  <p><img src="api/images/jEQNvpyaXIWE/shared-list.png" alt="Shared Notes List" /></p>
  <h3>Setting a Custom Favicon</h3>
  <p>To customize the favicon for your shared pages, create a relation <code>~shareFavicon</code> pointing to a file note containing the favicon (e.g., in <code>.ico</code> format).</p>
  <h3>Sharing a Note as the Root</h3>
  <p>You can designate a specific note or folder as the root of your shared content by adding the <code>#shareRoot</code> label. This note will be linked when visiting <code>[http://domain.tld/share](http://domain/share)</code>, making it easier to use Trilium as a fully-fledged website. Consider combining this with the <code>#shareIndex</code> label, which will display a list of all shared notes.</p>
  <h2>Additional Options</h2>
  <ul>
  <li><strong>Raw Note Sharing</strong>: Use the <code>#shareRaw</code> label to share a note without any HTML wrapper.</li>
  <li><strong>Disallow Robot Indexing</strong>: Add the <code>#shareDisallowRobotIndexing</code> label to prevent search engines from indexing the shared page by including a <code>noindex, follow</code> meta tag and <code>X-Robots-Tag: noindex</code> header.</li>
  <li><strong>Shared Notes Index</strong>: For text notes with the <code>#shareIndex</code> label, the content will display a list of all shared note roots.</li>
  </ul>
  <h2>Limitations</h2>
  <p>While the sharing feature is powerful, it has some limitations:</p>
  <ul>
  <li><strong>No Relation Map Support</strong></li>
  <li><strong>Book Notes</strong>: Only show a list of child notes.</li>
  <li><strong>Code Notes</strong>: No syntax highlighting.</li>
  <li><strong>Static Note Tree</strong></li>
  <li><strong>Protected Notes</strong>: Cannot be shared.</li>
  <li><strong>Include Notes</strong>: Not supported.</li>
  </ul>
  <p>Some of these limitations may be addressed in future updates.</p>


blobId: hQOCOVOvZQlr8QWSbzcE
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.532Z
content:
  <h2>Sorting Notes</h2>
  <p>You can sort notes by right-clicking the parent note in the note tree and selecting Advanced -&gt; Sort notes by ...
  This will sort existing notes, but will not automatically sort future notes added to this parent note</p>
  <h2>Automatic/Permanent Sorting</h2>
  <p>Child notes can be automatically sorted by attaching specific <a href="#root/zEY4DaJG4YT5">labels</a> to the parent note:</p>
  <ul>
  <li><code>#sorted</code>: Enables sorting. Can optionally include the name of the note's property/label for sorting criteria (details below).</li>
  <li><code>#sortDirection</code>: By default, sorting is ascending. Set this to <code>desc</code> to sort in descending order.</li>
  <li><code>#sortFoldersFirst</code>: Notes with children will be sorted to the top.</li>
  </ul>
  <p>Sorting is done by comparing note properties or specific labels on child notes. There are four sorting levels, with the first having the highest priority. Lower priority levels are applied only if higher priority comparisons result in equality.</p>
  <ol>
  <li><strong>Top Label Sorting</strong>: Child notes with the <code>#top</code> label will appear at the top of the folder.</li>
  <li><strong>Bottom Label Sorting</strong>: (Introduced in Trilium 0.62) Child notes with the <code>#bottom</code> label will appear at the bottom of the folder.</li>
  <li><strong>Property/Label-Based Sorting</strong>: Sorting is based on the parent note's <code>#sorted</code> label:<ul>
  <li><strong>Default Sorting</strong>: If <code>#sorted</code> has no value, notes are sorted alphabetically.</li>
  <li><strong>Property Sorting</strong>: If <code>#sorted</code> is set to <code>title</code>, <code>dateModified</code>, or <code>dateCreated</code>, notes are sorted based on the specified property.</li>
  <li><strong>Label Sorting</strong>: If <code>#sorted</code> has any other value, this value is treated as the name of a child note's label, and sorting is based on the values of this label. For example, setting <code>#sorted=myOrder</code> on the parent note and using <code>#myOrder=001</code>, <code>#myOrder=002</code>, etc., on child notes.</li>
  </ul>
  </li>
  <li><strong>Alphabetical Sorting</strong>: Used as a last resort when other criteria result in equality.</li>
  </ol>
  <p>All comparisons are made string-wise (e.g., "1" &lt; "2" or "2020-10-10" &lt; "2021-01-15", but also "2" &gt; "10").</p>


blobId: sIFvu5nYpmYxMCMeFP9y
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.537Z
content:
  <h2>Synchronization</h2>
  <p>Trilium is an offline-first note-taking application that stores all data locally on the desktop client. However, it also offers the option to set up synchronization with a server instance, allowing multiple desktop clients to sync with a central server. This creates a star-shaped topology:</p>
  <p><img src="api/images/bunenMGMmaN6/star-topology.png" alt="topology visualization" /></p>
  <p>In this setup, a central server (referred to as the <em>sync server</em>) and multiple <em>client</em> (or <em>desktop</em>) instances synchronize with the sync server. Once configured, synchronization is automatic and ongoing, requiring no manual intervention.</p>
  <h2>Setting Up Synchronization</h2>
  <h3>Security Considerations</h3>
  <p>Setting up the server securely is critical and can be complex. It is crucial to use a valid <a href="#root/l2VkvOwUNfZj">TLS certificate</a> (HTTPS) rather than an unencrypted HTTP connection to ensure security and avoid potential vulnerabilities.</p>
  <h3>Synchronizing a Desktop Instance with a Sync Server</h3>
  <p>This method is used when you already have a desktop instance of Trilium and want to set up a sync server on your web host.</p>
  <ol>
  <li><strong>Server Deployment</strong>: Ensure your server instance is deployed but uninitialized.</li>
  <li><strong>Desktop Configuration</strong>: Open your desktop instance, navigate to Options -&gt; Sync tab -&gt; Sync configuration, and set the "Server instance address" to your sync server's address. Click Save.</li>
  </ol>
  <p><img src="api/images/676Ekdv73T7I/sync-config.png" alt="screenshot of the sync settings options modal" /></p>
  <ol>
  <li><strong>Testing Sync</strong>: Click the "Test sync" button to verify the connection to the sync server. If successful, the client will start pushing all data to the server instance. This process may take some time, but you can continue using Trilium. Periodically check the server instance to confirm when the sync is complete. Once finished, you should see the login screen on the server.</li>
  </ol>
  <h3>Synchronizing a Desktop Instance from a Sync Server</h3>
  <p>This method is used when you already have a sync server and want to configure a new desktop instance to sync with it.</p>
  <ol>
  <li><strong>Desktop Setup</strong>: Follow the <a href="#root/poXkQfguuA0U">desktop installation page</a>.</li>
  <li><strong>Initial Configuration</strong>: When prompted, choose the option to set up sync with a sync server.</li>
  </ol>
  <p><img src="api/images/SDHWNDsB68aJ/sync-init.png" alt="screenshot of the sync from server setup page" /></p>
  <ol>
  <li><strong>Server Details</strong>: Configure the Trilium server address and enter the correct username and password for authentication.</li>
  <li><strong>Finish Setup</strong>: Click the "Finish setup" button. If successful, you will see the following screen:</li>
  </ol>
  <p><img src="api/images/qGTyyKX4TceE/sync-in-progress.png" alt="screenshot of the sync page" /></p>
  <p>Once synchronization is complete, you will be automatically redirected to the Trilium application.</p>
  <h2>Proxy Configuration</h2>
  <p>Two proxy setups are supported:</p>
  <ul>
  <li><strong>Explicit Proxy Configuration</strong>: Set the proxy server in Options / Sync. Only unauthenticated proxy servers are supported.</li>
  <li><strong>System Proxy Settings</strong>: If no proxy server is explicitly configured, Trilium will use the system proxy settings.</li>
  </ul>
  <h2>Troubleshooting</h2>
  <h3>Date/Time Synchronization</h3>
  <p>For successful synchronization, both client and server must have the same date and time, with a tolerance of up to five minutes.</p>
  <h3>Certificate Issues</h3>
  <p>When using TLS, Trilium will verify the server certificate. If verification fails (e.g., due to self-signed certificates or certain corporate proxies), you can run the Trilium client with the <code>NODE_TLS_REJECT_UNAUTHORIZED</code> environment variable set to <code>0</code>:</p>
  <pre><code class="language-text-x-trilium-auto">export NODE_TLS_REJECT_UNAUTHORIZED=0</code></pre><p>This will disable TLS certificate verification, significantly reducing security and exposing the setup to MITM attacks. It is strongly recommended to use a valid signed server certificate. Newer Trilium versions include a script called <code>trilium-no-cert-check.sh</code> for this purpose.</p>
  <h3>Conflict Resolution</h3>
  <p>If you edit the same note on multiple instances before synchronization, Trilium resolves conflicts by retaining the newer change and discarding the older one. The older version remains accessible in <a href="#root/vZWERwf8U3nx">note revisions</a>, allowing data recovery if needed.</p>
  <h3>Hash Check</h3>
  <p>After each synchronization, Trilium computes a hash of all synced data on both the client and the sync server. If there is a discrepancy, Trilium will automatically initiate a recovery mechanism to resolve the issue.</p>


blobId: WEd4jwU4owu7lsQhTDX2
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.542Z
content:
  <h2>Task-manager</h2>
  <p>Task Manager is a <a href="#root/OFXdgB2nNk1F">promoted attributes</a> and <a href="#root/CdNpE2pqjmI6">scripts</a> showcase present in the <a href="#root/wX4HbRucYSDD">demo notes</a>.</p>
  <h2>Demo</h2>
  <p><img src="api/images/92KeXdKh3Ca1/task-manager.png" alt="" /></p>
  <p>Task Manager manages outstanding (TODO) tasks and finished tasks (non-empty doneDate attribute). Outstanding tasks are further categorized by location and arbitrary tags - whenever you change tag attribute in the task note, this task is then automatically moved to appropriate location.</p>
  <p>Task Manager also integrates with <a href="#root/l0tKav7yLHGF">day notes</a> - notes are <a href="#root/IakOLONlIfGI">cloned</a> into day note to both todoDate note and doneDate note (with <a href="#root/kBrnXNG3Hplm">prefix</a> of either "TODO" or "DONE").</p>
  <h2>Implementation</h2>
  <p>New tasks are created in the TODO note which has <code>~child:template</code> <a href="#root/zEY4DaJG4YT5">relation</a> (see <a href="#root/bwZpz2ajCEwO">attribute inheritance</a>) pointing to the task template.</p>
  <h3>Attributes</h3>
  <p>Task template defines several <a href="#root/OFXdgB2nNk1F">promoted attributes</a> - todoDate, doneDate, tags, location. Importantly it also defines <code>~runOnAttributeChange</code> relation - <a href="#root/GPERMystNGTB">event</a> handler which is run on attribute change. This <a href="#root/CdNpE2pqjmI6">script</a> handles when e.g. we fill out the doneDate attribute - meaning the task is done and should be moved to "Done" note and removed from TODO, locations and tags.</p>
  <h3>New task button</h3>
  <p>There's also "button" note which contains simple script which adds a button to create new note (task) in the TODO note.</p>
  <pre><code class="language-text-x-trilium-auto">api.addButtonToToolbar({
      title: 'New task',
      icon: 'check',
      shortcut: 'alt+n',
      action: async () =&gt; {
          // creating notes is backend (server) responsibility so we need to pass
          // the control there
          const taskNoteId = await api.runOnBackend(async () =&gt; {
              const todoRootNote = await api.getNoteWithLabel('taskTodoRoot');
              const {note} = await api.createNote(todoRootNote.noteId, 'new task', '');

              return note.noteId;
          });

          // we got an ID of newly created note and we want to immediatelly display it
          await api.activateNewNote(taskNoteId);
      }
  });</code></pre><h3>CSS</h3>
  <p>In the demo screenshot above you may notice that TODO tasks are in red color and DONE tasks are green.</p>
  <p>This is done by having this CSS <a href="#root/6f9hih2hXXZk">code note</a> which defines extra CSS classes:</p>
  <pre><code class="language-text-x-trilium-auto">span.fancytree-node.todo .fancytree-title {
      color: red !important;
  }

  span.fancytree-node.done .fancytree-title {
      color: green !important;
  }</code></pre><p>This <a href="#root/6f9hih2hXXZk">code note</a> has <code>#appCss</code> <a href="#root/zEY4DaJG4YT5">label</a> which is recognized by Trilium on startup and loaded as CSS into the application.</p>
  <p>Second part of this functionality is based in event handler described above which assigns <code>#cssClass</code> label to the task to either "done" or "todo" based on the task status.</p>


blobId: lTSpsYQB6AAN6KNEix0P
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.547Z
content:
  <h2>Template</h2>
  <p>A template in Trilium serves as a predefined structure for other notes, referred to as instance notes. Assigning a template to a note brings three main effects:</p>
  <ol>
  <li><strong>Attribute Inheritance</strong>: All attributes from the template note are <a href="#root/bwZpz2ajCEwO">inherited</a> by the instance notes. Even attributes with <code>#isInheritable=false</code> are inherited by the instance notes, although only inheritable attributes are further inherited by the children of the instance notes.</li>
  <li><strong>Content Duplication</strong>: The content of the template note is copied to the instance note, provided the instance note is empty at the time of template assignment.</li>
  <li><strong>Child Note Duplication</strong>: All child notes of the template are deep-duplicated to the instance note.</li>
  </ol>
  <h2>Example</h2>
  <p>A typical example would be a "Book" template note, which might include:</p>
  <ul>
  <li><strong>Promoted Attributes</strong>: Such as publication year, author, etc. (see <a href="#root/OFXdgB2nNk1F">promoted attributes</a>).</li>
  <li><strong>Outline</strong>: An outline for a book review, including sections like themes, conclusion, etc.</li>
  <li><strong>Child Notes</strong>: Additional notes for highlights, summary, etc.</li>
  </ul>
  <p><img src="api/images/Y8kzZ5MSZLCC/template.png" alt="Template Example" /></p>
  <h2>Instance Note</h2>
  <p>An instance note is a note related to a template note.
  This relationship means the instance note's content is initialized from the template, and all attributes from the template are inherited. </p>
  <p>To create an instance note through the UI:</p>
  <p><img src="api/images/uuGrYX41lWN0/template-create-instance-note.png" alt="show child note templates" /></p>
  <p>For the template to appear in the menu, the template note must have the <code>#template</code> label.
  Do not confuse this with the <code>~template</code> relation, which links the instance note to the template note.
  If you use <a href="#root/9sRHySam5fXb">workspaces</a>, you can also mark templates with <code>#workspaceTemplate</code> to display them only in the workspace.</p>
  <p>Templates can also be added or changed after note creation by creating a <code>~template</code> relation pointing to the desired template note.</p>
  <h2>Additional Notes</h2>
  <p>From a visual perspective, templates can define <code>#iconClass</code> and <code>#cssClass</code> attributes, allowing all instance notes (e.g., books) to display a specific icon and CSS style.</p>
  <p>Explore the concept further in the <a href="#root/wX4HbRucYSDD">demo notes</a>, including examples like the <a href="#root/iRwzGnHPzonm">Relation Map</a>, <a href="#root/xYjQUYhpbUEW">Task Manager</a>, and <a href="#root/l0tKav7yLHGF">Day Notes</a>.</p>
  <p>Additionally, see <a href="#root/47ZrP6FNuoG8">default note title</a> for creating title templates. Note templates and title templates can be combined by creating a <code>#titleTemplate</code> for a template note.</p>


blobId: 4Oo9YXxkduXXEFB6eCkv
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.553Z
content:
  <h2>Text Notes</h2>
  <p>Trilium utilizes the powerful <a href="https://ckeditor.com/ckeditor-5/">CKEditor 5</a> as its text editing component.</p>
  <h2>Formatting Options</h2>
  <p>The Trilium text note interface does not display toolbars or formatting options by default. These can be accessed by:</p>
  <p><img src="api/images/FtmPLgGmgZVC/text-notes-formatting-inline.png" alt="inline note formatting" /></p>
  <ol>
  <li>Selecting text to bring up an inline toolbar.</li>
  </ol>
  <p><img src="api/images/oRWfJLUbb7j7/text-notes-formatting-block.png" alt="formating note block" />
  2. Clicking on the block toolbar.</p>
  <h2>Read-Only vs. Editing Mode</h2>
  <p>Text notes are usually opened in edit mode. However, they may open in read-only mode under the following circumstances:</p>
  <ul>
  <li>The note is long and would take time to load, so it is opened in read-only mode by default for quicker access.</li>
  <li>The note has a <code>readOnly</code> <a href="#root/zEY4DaJG4YT5">label</a>.</li>
  </ul>
  <p>In both cases, it is possible to switch back to editable mode using [Edit note] <img src="api/images/hKNMMxsbCuE8/bx-edit-alt.svg" alt="edit-alt icon" /> at top right of page.</p>
  <h2>General Formatting</h2>
  <p>Since Trilium uses CKEditor, all of its formatting options are available here. You may use the graphical toolbar shown above, or enter formatting such as markdown markdown directly in the text. Examples include:</p>
  <ul>
  <li><strong>Bold</strong>: Type <code>**text**</code> or <code>__text__</code></li>
  <li><em>Italic</em>: Type <code>*text*</code> or <code>_text_</code></li>
  <li><code>Code</code>: Type `text`</li>
  <li><del>Strikethrough</del>: Type <code>~~text~~</code></li>
  </ul>
  <h3>Lists</h3>
  <ul>
  <li>Bulleted list: Start a line with <code>*</code> or <code>-</code> followed by a space</li>
  <li>Numbered list: Start a line with <code>1.</code> or <code>1)</code> followed by a space</li>
  <li>To-do list: Start a line with <code>[ ]</code> for an unchecked item or <code>[x]</code> for a checked item</li>
  </ul>
  <h3>Blocks</h3>
  <ul>
  <li>Block quote: Start a line with <code>&gt;</code> followed by a space</li>
  </ul>
  <h3>Multi-Line Code Blocks</h3>
  <p>To create a multi-line code block, start a line with "```[lang]", for example:</p>
  <pre><code class="language-text-x-trilium-auto">if (1 &gt; 2) {
      console.log("Error in the matrix");
  }</code></pre><h3>Headings</h3>
  <p>Create headings by starting a line with <code>##</code> for heading 2, <code>###</code> for heading 3, and so on up to heading 6. Note that <code>#</code> is reserved for the title.</p>
  <h3>Horizontal Line</h3>
  <p>Insert a horizontal line by starting a line with <code>---</code>.</p>
  <h2>Markdown &amp; Autoformat</h2>
  <p>CKEditor supports a markdown-like editing experience, recognizing syntax and automatically converting it to rich text.</p>
  <p>Complete documentation for this feature is available in the <a href="https://ckeditor.com/docs/ckeditor5/latest/features/autoformat.html">CKEditor documentation</a>.</p>
  <p>If autoformatting is not desirable, press <code>CTRL-Z</code> to revert the text to its original form.</p>
  <p>Note: The use of <code>#</code> for Heading 1 is not supported because it is reserved for the title. Start with <code>##</code> for Heading 2. More information is available <a href="https://ckeditor.com/docs/ckeditor5/latest/features/headings.html#heading-levels">here</a>.</p>
  <h2>Math Support</h2>
  <p>Trilium provides math support through <a href="https://katex.org/">KaTeX</a>.</p>
  <h2>Cutting Selection to Sub-Note</h2>
  <p>When editing a document that becomes too large, you can split it into sub-notes:</p>
  <ol>
  <li>Select the desired text and cut it to the clipboard.</li>
  <li>Create a new sub-note and name it.</li>
  <li>Paste the content from the clipboard into the sub-note.</li>
  </ol>
  <p>Trilium can automate this process. Select some text within the note, and in the selection toolbar, click the scissors icon for the "cut &amp; pasted selection to sub-note" action. The heading is automatically detected and the new sub-note is named accordingly. You can also assign a keyboard shortcut for this action.
  This functionality is available through the block toolbar icon.</p>
  <h2>Including a Note</h2>
  <p>Text notes can "include" another note as a read only widget. This can be useful for e.g. including a dynamically generated chart (from scripts &amp; "render HTML" note) or other more advanced use cases.</p>
  <p>This functionality is available in the block toolbar icon.</p>


blobId: WRs9e2wRA89jgGwebbOB
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.560Z
content:
  <h2>Theme-Gallery</h2>
  <h2>Theme Gallery</h2>
  <p>These are user-created themes which were made publicly available:</p>
  <table>
  <thead>
  <tr>
  <th></th>
  <th></th>
  </tr>
  </thead>
  <tbody><tr>
  <td><a href="https://github.com/tobealive/trilium-midnight-theme">Midnight</a>  <br />👤 <a href="https://github.com/tobealive">tobealive</a> <img src="api/images/n8jf8SqQoJX7/Theme-Gallery image.jpg" alt="" /></td>
  <td><a href="https://github.com/tobealive/trilum-eote-theme">EOTE</a>  <br />👤 <a href="https://github.com/tobealive">tobealive</a> <img src="api/images/4TnJ8zOCDGha/Theme-Gallery preview.jpg" alt="" /></td>
  </tr>
  <tr>
  <td><a href="https://github.com/Abourass/TriliumThemes">Trilium Themes</a>  <br />👤 <a href="https://github.com/Abourass">Abourass</a>  <br /><img src="https://camo.githubusercontent.com/ec9eb12d0f9792a93a87ff2d50c8e0ffafd42359878885e9e8d6498ec34510fe/68747470733a2f2f692e696d6775722e636f6d2f3666466e4d75422e706e67" alt="" />  <br /><img src="https://camo.githubusercontent.com/745dd535b982e24b305b35e7ed42d3b4d4dcefac9ae8bd1ed9cceda83b5d1d8a/68747470733a2f2f692e696d6775722e636f6d2f7a4873513363792e706e67" alt="" /> <img src="https://camo.githubusercontent.com/8dfbcc44a82f8780d8e2f4e4621b9447f499db2667dce9a220393def28e384dd/68747470733a2f2f692e696d6775722e636f6d2f444d5437784f702e706e67" alt="" /> <img src="https://camo.githubusercontent.com/461416d49050e9e4415e4fe5315e2ea6987485d01a624c6d23203f78be33864b/68747470733a2f2f692e696d6775722e636f6d2f616852573667682e706e67" alt="" /></td>
  <td><a href="https://github.com/ZMonk91/Material-Dark-Trilium">MaterialDark</a>  <br />👤 <a href="https://github.com/ZMonk91">ZMonk91</a>  <br /><img src="https://camo.githubusercontent.com/3486f3d96d823468163a5f968b4b201254b6fd06164321551880c3de6353eeed/68747470733a2f2f692e696d6775722e636f6d2f5a65584635474c2e706e67" alt="" /></td>
  </tr>
  <tr>
  <td><a href="https://github.com/jaroet/trilium-theme-lightslategray">lightslategray</a>  <br />👤 <a href="https://github.com/jaroet">jaroet</a>  <br /><img src="api/images/M5AfsroPw5fY/Theme-Gallery_lightslategray.p" alt="" /></td>
  <td><a href="https://github.com/raphwriter/trilium-theme-melon">melon-4</a>  <br />👤 <a href="https://github.com/raphwriter">raphwriter</a>  <br /><img src="api/images/TVrD3YF7Gik7/Theme-Gallery scrn4 01.png" alt="" /></td>
  </tr>
  <tr>
  <td><a href="https://github.com/Engr-AllanG/trilium-themes">Neon_Dark</a>  <br />👤 <a href="https://github.com/Engr-AllanG">Engr-AllanG</a>  <br /><img src="api/images/FmjaFiafUjXz/Theme-Gallery Neon Dark Demo v.jpeg" alt="" /></td>
  <td><a href="https://github.com/Engr-AllanG/trilium-themes">Coder_Dark</a>  <br />👤 <a href="https://github.com/Engr-AllanG">Engr-AllanG</a>  <br /><img src="api/images/OuVPMXnRDYKE/Theme-Gallery Trilium theme co.png" alt="" /></td>
  </tr>
  <tr>
  <td><a href="https://github.com/idelem/trilium-theme-velvet">velvet</a>  <br />👤 <a href="https://github.com/idelem">idelem</a>  <br /><img src="api/images/whCBpOQxXKhy/Theme-Gallery_trilium-velvet2." alt="" /></td>
  <td><a href="https://github.com/SADAVA/trilium-notes-theme-dark-plus">Dark Plus</a>  <br />👤 <a href="https://github.com/SADAVA">SADAVA</a>  <br /><img src="api/images/nC3Hg1AJIhTo/Theme-Gallery Screenshot.png" alt="" /></td>
  </tr>
  <tr>
  <td><a href="https://github.com/WKSu/trilium-solarized-theme">Solarized</a>  <br />👤 <a href="https://github.com/WKSu">WKSu</a>  <br /><img src="api/images/15Gf2f3PIMTw/Theme-Gallery image.png" alt="" /></td>
  <td><a href="https://github.com/en3r0/Trilium-Nord-Theme">Nord</a>  <br />👤 <a href="https://github.com/en3r0">en3r0</a>  <br /><img src="api/images/QM1v2wdzWNnE/1 Theme-Gallery image.png" alt="" /></td>
  </tr>
  <tr>
  <td><a href="https://github.com/AllanZyne/trilium-bear-theme">Bear Note Light</a>  <br />👤 <a href="https://github.com/AllanZyne">AllanZyne</a>  <br /><img src="api/images/MVcQzNVmZyFd/Theme-Gallery bear-white.png" alt="" /></td>
  <td><a href="https://github.com/AllanZyne/trilium-bear-theme">Bear Note Dark</a>  <br />👤 <a href="https://github.com/AllanZyne">AllanZyne</a>  <br /><img src="api/images/qdZIFMQZGVQ9/Theme-Gallery bear-dark.png" alt="" /></td>
  </tr>
  <tr>
  <td><a href="https://github.com/Sebiann/miku-hatsune-trilium-theme">Miku Hatsune</a>  <br />👤 <a href="https://github.com/Sebiann">Sebiann</a>  <br /><img src="api/images/Mwzz6lCQC1tg/2 Theme-Gallery image.png" alt="" /></td>
  <td><a href="https://github.com/cwilliams5/Midnight-Trilium-Dark-Mode">Midnight</a>  <br />👤 <a href="https://github.com/cwilliams5">cwilliams5</a>  <br /><img src="api/images/n1cdrxT0ZfDh/Theme-Gallery midnight.png" alt="" /></td>
  </tr>
  <tr>
  <td><a href="https://github.com/SiriusXT/trilium-theme-blue">Blue</a> (light)  <br />👤 <a href="https://github.com/SiriusXT">SiriusXT</a>  <br /><img src="api/images/SeHYoNHYMP1q/Theme-Gallery screenshot1.png" alt="" /></td>
  <td><a href="https://github.com/SiriusXT/trilium-theme-blue">Blue</a> (dark)  <br />👤 <a href="https://github.com/SiriusXT">SiriusXT</a>  <br /><img src="api/images/Gshl6zDUd0YK/Theme-Gallery screenshot2.png" alt="" /></td>
  </tr>
  </tbody></table>
  <p>If you would like to add your theme to this gallery, write a new post in <a href="https://github.com/TriliumNext/Notes/discussions/categories/show-and-tell">👐 Show and tell</a>.</p>


blobId: MdF1PJdabiKHQoD8wnBq
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.569Z
content:
  <h2>Customizing Themes in Trilium</h2>
  <h2>Default Themes</h2>
  <p>Trilium comes with a couple pre-installed color themes, with the default being a light theme. To switch to a dark theme or any other available theme, navigate to the Options menu (accessible via the app icon in the top-left corner), select the Appearance tab, and choose your preferred theme.</p>
  <p><img src="api/images/zaQnUsJTbvjr/dark-theme.png" alt="Dark Theme" /></p>
  <h2>Creating Custom CSS Themes</h2>
  <p>Trilium supports custom user themes, allowing you to personalize the application's appearance. To create a custom theme, follow these steps:</p>
  <ol>
  <li><strong>Create a CSS Code Note</strong>: Start by creating a new <a href="#root/6f9hih2hXXZk">code note</a> with the <code>CSS</code> type.</li>
  <li><strong>Annotate with <code>#appTheme</code></strong>: Add the <a href="#root/zEY4DaJG4YT5">attribute</a> <code>#appTheme=my-theme-name</code> to your note, where <code>my-theme-name</code> is the name of your custom theme.</li>
  <li><strong>Define Your Styles</strong>: Write your custom CSS within the note. Below is an example of a custom theme:</li>
  </ol>
  <pre><code class="language-text-css">@font-face {
    font-family: 'Raleway';
    font-style: normal;
    font-weight: 400;
    src: url('/custom/fonts/raleway.woff2') format('woff2');
  }

  :root {
      --main-font-family: 'Raleway' !important;
      --main-font-size: normal;
      --tree-font-family: inherit;
      --tree-font-size: normal;
      --detail-font-family: inherit;
      --detail-font-size: normal;
      --detail-text-font-family: 'Garamond' !important;

      --main-background-color: #404552;
      --main-text-color: #AFB8C6;
      --main-border-color: #AFB8C6;
      --accented-background-color: #383C4A;
      --more-accented-background-color: #2F343F;
      --header-background-color: #383C4A;
      --button-background-color: #2F343F;
      --button-disabled-background-color: #404552;
      --button-border-color: #333;
      --button-text-color: #AFB8C6;
      --button-border-radius: 2px;
      --primary-button-background-color: #6c757d;
      --primary-button-text-color: white;
      --primary-button-border-color: #6c757d;
      --muted-text-color: #86919F;
      --input-text-color: #AFB8C6;
      --input-background-color: #404552;
      --hover-item-text-color: white;
      --hover-item-background-color: #4877B1;
      --active-item-text-color: white;
      --active-item-background-color: #4877B1;
      --menu-text-color: #AFB8C6;
      --menu-background-color: #383C4A;
      --tooltip-background-color: #383C4A;
      --link-color: lightskyblue;
      --modal-background-color: #404552;
      --modal-backdrop-color: black;
      --scrollbar-border-color: rgba(175, 184, 198, 0.5);
  }

  body .note-detail-text {
      font-size: 120%;
  }

  body .CodeMirror {
      filter: invert(100%) hue-rotate(180deg);
  }</code></pre><h3>Activating Your Custom Theme</h3>
  <p>Once you've created your custom theme:</p>
  <ol>
  <li>Go to "Menu" -&gt; "Options" -&gt; "Appearance."</li>
  <li>In the theme selection dropdown, you should see your custom theme listed under the name you provided with the <code>#appTheme</code> <a href="#root/zEY4DaJG4YT5">label</a>.</li>
  <li>Select your custom theme to activate it.</li>
  </ol>
  <p>If you make changes to your theme, press <code>CTRL-R</code> to reload the frontend and apply your updates.</p>
  <h3>Sharing and Importing Themes</h3>
  <p>Custom themes can be exported as <code>.tar</code> archives, which can be shared with other users. However, be cautious when importing themes from untrusted sources, as they may contain executable scripts that could pose security risks.</p>
  <p>An example user theme, <em>Steel Blue</em>, is available in the <a href="#root/xjSsCcvVZf6H">demo document</a>.</p>
  <p><img src="api/images/uVF9DAmAmEWC/steel-blue.png" alt="Steel Blue Theme" /></p>
  <h3>Using Custom CSS for Specific Purposes</h3>
  <p>In addition to full themes, Trilium allows for custom CSS that isn't tied to a theme. This can be particularly useful in scripting contexts, where you might want to modify specific UI elements, such as changing the colors of notes in the tree view.</p>
  <h3>Applying Custom CSS</h3>
  <p>To use custom CSS:</p>
  <ol>
  <li><strong>Create a CSS Code Note</strong>: Create a new <a href="#root/6f9hih2hXXZk">code note</a> with the <code>CSS</code> type.</li>
  <li><strong>Add the <code>appCss</code> Label</strong>: Annotate the note with the <code>#appCss</code> <a href="#root/zEY4DaJG4YT5">label</a>.</li>
  <li><strong>Write Your CSS</strong>: Add your custom CSS rules to the note.</li>
  </ol>
  <p>For example:</p>
  <pre><code class="language-text-css">/* Custom CSS to style specific elements */
  .tree-item {
      color: #ff6347; /* Change tree item color */
  }</code></pre><p>When Trilium's frontend starts, all notes labeled with <code>appCss</code> are automatically included in the style element of the HTML page.</p>
  <p>After making changes, press <code>CTRL-R</code> to reload the frontend and apply your new styles.</p>
  <p><img src="api/images/loUkLR5Mp7Ap/app-css.png" alt="Applying Custom CSS" /></p>
  <h3>Styling Specific Notes in the Tree</h3>
  <p>To apply specific styles to certain notes in the tree:</p>
  <ul>
  <li><strong>Use the <code>cssClass</code> Attribute</strong>: Add the <code>cssClass</code> <a href="#root/zEY4DaJG4YT5">attribute</a> to a note, and assign it a value representing the desired CSS class.</li>
  <li><strong>Define an <code>iconClass</code></strong>: You can also define a custom icon for a note using the <code>iconClass</code> attribute, selecting from <a href="https://boxicons.com">Box Icons</a> or your own custom classes.</li>
  </ul>
  <p>For example, if you want to style notes of a specific type, such as notes containing PNG images, you can target them with classes like <code>type-image mime-image-png</code>.</p>
  <h3>User-Provided Themes</h3>
  <p>A gallery of user-created themes is available, showcasing the variety of customizations that the Trilium community has developed. For more information, visit the <a href="#root/VbjZvtUek0Ln">Theme Gallery</a>.</p>
  <h3>Asset Path Management</h3>
  <p>When referencing built-in assets like images in your custom themes or CSS, you can avoid hardcoding version numbers by using the <code>vX</code> alias. For example, instead of specifying <code>/assets/v0.57.0-beta/images/icon-grey.png</code>, you can use <code>/assets/vX/images/icon-grey.png</code> to keep your theme compatible with future versions of Trilium.</p>


blobId: zkmRgQsZgH9DOui3xkvL
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.574Z
content:
  <h2>TLS Configuration</h2>
  <p>Configuring TLS is essential for <a href="#root/WOcw2SLH6tbX">server installation</a> in Trilium. This guide details the steps to set up TLS within Trilium itself.</p>
  <p>For a more robust solution, consider using TLS termination with a reverse proxy (recommended, e.g., Nginx). You can follow a <a href="https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-20-04">guide like this</a> for such setups.</p>
  <h2>Obtaining a TLS Certificate</h2>
  <p>You have two options for obtaining a TLS certificate:</p>
  <ul>
  <li><strong>Recommended</strong>: Obtain a TLS certificate signed by a root certificate authority. For personal use, <a href="https://letsencrypt.org">Let's Encrypt</a> is an excellent choice. It is free, automated, and straightforward. Certbot can facilitate automatic TLS setup.</li>
  <li>Generate a self-signed certificate. This option is not recommended due to the additional complexity of importing the certificate into all machines connecting to the server.</li>
  </ul>
  <h2>Modifying <code>config.ini</code></h2>
  <p>Once you have your certificate, modify the <code>config.ini</code> file in the <a href="#root/tAassRL4RSQL">data directory</a> to configure Trilium to use it:</p>
  <pre><code class="language-text-x-toml">[Network]
  port=8080
  # Set to true for TLS/SSL/HTTPS (secure), false for HTTP (insecure).
  https=true
  # Path to the certificate (run "bash bin/generate-cert.sh" to generate a self-signed certificate).
  # Relevant only if https=true
  certPath=/[username]/.acme.sh/[hostname]/fullchain.cer
  keyPath=/[username]/.acme.sh/[hostname]/example.com.key</code></pre><p>You can also review the <a href="#root/Gzjqa934BdH4">configuration</a> file to provide all <code>config.ini</code> values as environment variables instead. </p>
  <p>The above example shows how this is set up in an environment where the certificate was generated using Let's Encrypt's ACME utility. Your paths may differ. For Docker installations, ensure these paths are within a volume or another directory accessible by the Docker container, such as <code>/home/node/trilium-data/[DIR IN DATA DIRECTORY]</code>.</p>
  <p>After configuring <code>config.ini</code>, restart Trilium and access the hostname using "https".</p>
  <h2>Self-Signed Certificate</h2>
  <p>If you opt to use a self-signed certificate for your server instance, note that the desktop instance will not trust it by default.</p>
  <p>To bypass this, disable certificate validation by setting the following environment variable (for Linux):</p>
  <pre><code class="language-text-x-trilium-auto">export NODE_TLS_REJECT_UNAUTHORIZED=0
  trilium</code></pre><p>Trilium provides scripts to start in this mode, such as <code>trilium-no-cert-check.bat</code> for Windows.</p>
  <p><strong>Warning</strong>: Disabling TLS certificate validation is insecure. Proceed only if you fully understand the implications.</p>


blobId: 5yzBUxm4xw82gUu7QQav
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.578Z
content:
  <h2>Tree Concepts</h2>
  <p>This page explains the basic concepts related to the tree structure of notes in TriliumNext.</p>
  <h2>Note</h2>
  <p>A note is the central entity in TriliumNext. For more details, see <a href="#root/BFs8mudNFgCS">Note</a>.</p>
  <h2>Branch</h2>
  <p>A branch describes the placement of a note within the note tree. Essentially, it is a tuple of <code>parentNoteId</code> and <code>noteId</code>, indicating that the given note is placed as a child under the specified parent note.</p>
  <p>Each note can have multiple branches, meaning any note can be placed in multiple locations within the tree. This concept is referred to as "<a href="#root/IakOLONlIfGI">cloning</a>."</p>
  <h2>Prefix</h2>
  <p>A prefix is a branch-specific title modifier for a note. If you place your note in two different locations within the tree and want to alter the title slightly in one of those placements, you can use a prefix.</p>
  <p>To edit a prefix, right-click on the note in the tree pane and select "Edit branch prefix."</p>
  <p>The prefix is not part of the note itself and is not encrypted when the note is protected. This can be useful if you want part of the title to remain visible in the tree for easier navigation, even when the note is protected.</p>
  <h2>Subtree</h2>
  <p>A subtree consists of a particular note (the subtree root) and all its children and descendants. Some operations, such as exporting, work on entire subtrees.</p>


blobId: HqsrpdHleNJw6SCjpLEe
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.582Z
content:
  <h2>Tree Manipulation</h2>
  <p>This page explains how to manipulate the note tree in TriliumNext, focusing on moving notes.</p>
  <h2>Drag and Drop</h2>
  <p><img src="api/images/sLZ7Bcq9p8E9/drag-and-drop.gif" alt="Drag and drop example" />
  You can easily rearrange the note tree by dragging and dropping notes, as demonstrated in the example above.</p>
  <h2>Keyboard Manipulation</h2>
  <p><img src="api/images/qL7381ZG0lMK/move-note-with-keyboard.gif" alt="Example of using keyboard keys to move a note" />
  Trilium offers efficient keyboard-based manipulation using the following <a href="#root/A9Oc6YKKc65v">shortcuts</a>:</p>
  <ul>
  <li><code>CTRL-UP</code> and <code>CTRL-DOWN</code>: Move the note up or down in the order.</li>
  <li><code>CTRL-LEFT</code>: Move the note up in the hierarchy by changing its parent to the note's grandparent.</li>
  <li><code>CTRL-RIGHT</code>: Move the note down in the hierarchy by setting its parent to the note currently above it (this action is best understood through a demo or hands-on experience).</li>
  <li><code>LEFT</code> and <code>RIGHT</code>: Expand and collapse a sub-tree.</li>
  </ul>
  <h2>Context Menu</h2>
  <p>You can also move notes using the familiar cut and paste functions available in the context menu, or with the associated keyboard <a href="#root/A9Oc6YKKc65v">shortcuts</a>: <code>CTRL-C</code> (<a href="#root/IakOLONlIfGI">copy</a>), <code>CTRL-X</code> (cut) and <code>CTRL-V</code> (paste).</p>


blobId: 30qoj4BYjiNURIGijhQT
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.613Z
content:
  <h2>Troubleshooting</h2>
  <p>As Triliumis currently in beta, encountering bugs is to be expected.</p>
  <h2>General Quick Fix</h2>
  <p>The first step in troubleshooting is often a restart.</p>
  <p>If you experience an UI issue, the frontend may have entered an inconsistent state. Reload the application by pressing <code>CTRL-R</code>. This will reload the frontend.</p>
  <p>If the issue persists or appears to be a backend problem, restart the entire application. For the desktop (Electron) build, simply close and reopen the window. If you're using a Docker build, restart the container.</p>
  <h2>Broken Note Crashes Trilium</h2>
  <p>Certain problems, such as rendering a note with a faulty script, can cause Trilium to crash. If Trilium attempts to reload the problematic note upon restart, it will continue to crash.</p>
  <p>To resolve this, use the <code>TRILIUM_START_NOTE_ID</code> environment variable to reset the open tabs to a single specified note ID (e.g., <code>root</code>). In Linux, you can set it as follows:</p>
  <pre><code class="language-text-x-trilium-auto">TRILIUM_START_NOTE_ID=root ./trilium</code></pre><h2>Broken Script Prevents Application Startup</h2>
  <p>If a custom script causes Triliumto crash, and it is set as a startup script or in an active <a href="#root/MgibgPcfeuGz">custom widget</a>, start Triliumin "safe mode" to prevent any custom scripts from executing:</p>
  <pre><code class="language-text-x-trilium-auto">TRILIUM_SAFE_MODE=true ./trilium</code></pre><p>Depending on your Trilium distribution, you may have pre-made scripts available: <code>trilium-safe-mode.bat</code> and <code>trilium-safe-mode.sh</code>.</p>
  <p>Once Trilium starts, locate and fix or delete the problematic note.</p>
  <h2>Sync and Consistency Checks</h2>
  <p>Trilium periodically verifies the logical consistency of the database (e.g., ensuring every note has a parent). If inconsistencies are detected, you will be notified via the UI.</p>
  <p>In such cases, file a bug report and attach an <a href="#root/x59R8J8KV5Bp">anonymized database</a> if necessary.</p>
  <h2>Restoring Backup</h2>
  <p>Trilium makes regular automatic backups. If issues become severe, you can <a href="#root/ODY7qQn5m2FT">restore from a backup</a>.</p>
  <h2>Forgotten Password</h2>
  <p>If you forget your password:</p>
  <ul>
  <li>Protected notes are irretrievable without the password.</li>
  <li>Unprotected notes can be recovered. Follow these steps:</li>
  </ul>
  <p>Access the <a href="#root/wX4HbRucYSDD">database</a> file in the <a href="#root/tAassRL4RSQL">data directory</a>. Open the <code>document.db</code> file with an SQLite client (e.g., <a href="https://sqlitebrowser.org/">DB Browser</a>) and execute the following queries:</p>
  <pre><code class="language-text-x-mariadb">UPDATE options SET value = '77/twC5O00cuQgNC63VK32qOKKYwj21ev3jZDXoytVU=' WHERE name = 'passwordVerificationSalt';
  UPDATE options SET value = '710BMasZCAgibzIc07X4P9Q4TeBd4ONnqJOho+pWcBM=' WHERE name = 'passwordDerivedKeySalt';
  UPDATE options SET value = 'Eb8af1/T57b89lCRuS97tPEl4CwxsAWAU7YNJ77oY+s=' WHERE name = 'passwordVerificationHash';
  UPDATE options SET value = 'QpC8XoiYYeqHPtHKRtbNxfTHsk+pEBqVBODYp0FkPBa22tlBBKBMigdLu5GNX8Uu' WHERE name = 'encryptedDataKey';</code></pre><p>After executing the changes, commit/write the changes. <strong>This sets the password to "password," allowing you to log in again.</strong></p>
  <p>For pre-existing protected notes (now unrecoverable), consider deleting them or exporting the unprotected notes. Then, delete <code>document.db</code> and start fresh.</p>
  <p>If you continue using the existing document file, change your password (Options -&gt; Change Password).</p>
  <h2>Reporting Bugs</h2>
  <p>Reporting bugs is highly valuable. Here are some tips:</p>
  <ul>
  <li>Use GitHub issues for reporting: <a href="https://github.com/TriliumNext/Notes/issues">https://github.com/TriliumNext/Notes/issues</a></li>
  <li>Refer to the <a href="#root/qzNzp9LYQyPT">error logs</a> page for information on providing necessary details.</li>
  </ul>


blobId: CYQbC5B0XqZKF5CUkcIc
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.619Z
content:
  <h2>Upgrading TriliumNext</h2>
  <p>This document outlines the steps required to upgrade Triliumto a new release version.</p>
  <h2>How to Upgrade</h2>
  <p>Triliumdoes not support built-in automatic upgrades; all updates must be performed manually. The upgrade process varies depending on the installation method:</p>
  <ul>
  <li><strong><a href="#root/rWX5eY045zbE">Docker Server Installation</a></strong>: Pull the new image and restart the container.</li>
  <li><strong>Other Installations</strong>: Download the latest version from the <a href="https://github.com/TriliumNext/Notes/releases/latest">release page</a> and replace the existing application files.</li>
  </ul>
  <h2>Database Compatibility and Migration</h2>
  <p>Upon startup, Triliumwill automatically migrate the <a href="#root/wX4HbRucYSDD">database</a> to the new version. Note that after migration, older versions of Trilium will be unable to read the database. If you need to revert to a previous version of Triliumand its database, you can restore the <a href="#root/ODY7qQn5m2FT">backup</a> that is created prior to migration.</p>
  <h2>Sync Compatibility</h2>
  <p>The <a href="#root/cbkrhQjrkKrh">synchronization</a> protocol used by Triliumis versioned, requiring all members of the sync cluster to use the same protocol version. Therefore, when upgrading to a new version, you may need to upgrade all instances in the sync cluster. Changes to the sync protocol version are typically indicated on the release page.</p>


blobId: lK4WIYYhddva1N1fKfX9
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.624Z
content:
  <h2>Web-clipper</h2>
  <p><img src="api/images/ZwPsWktLVBAz/web-clipper-chrome-trilium-web.png" alt="screenshot of webclipper in chrome" /></p>
  <p>Trilium Web Clipper is a web browser extension which allows user to clip text, screenshots, whole pages and short notes and save them directly to Trilium Notes.</p>
  <p>Project is hosted <a href="https://github.com/TriliumNext/web-clipper">here</a>.</p>
  <p>Firefox and Chrome are supported browsers, but the chrome build should work on other chromium based browsers as well.</p>
  <h2>Functionality</h2>
  <ul>
  <li>select text and clip it with the right-click context menu</li>
  <li>click on an image or link and save it through context menu</li>
  <li>save whole page from the popup or context menu</li>
  <li>save screenshot (with crop tool) from either popup or context menu</li>
  <li>create short text note from popup</li>
  </ul>
  <p>Trilium will save these clippings as a new child note under a "clipper inbox" note.</p>
  <p>By default, that's the <a href="#root/l0tKav7yLHGF">day note</a> but you can override that by setting the <a href="#root/zEY4DaJG4YT5">label</a> <code>clipperInbox</code>, on any other note.</p>
  <p>If there's multiple clippings from the same page (and on the same day), then they will be added to the same note.</p>
  <p><strong>Extension is available from:</strong></p>
  <ul>
  <li><a href="https://github.com/TriliumNext/web-clipper/releases">Project release page</a> - .xpi for Firefox and .zip for Chromium based browsers.</li>
  <li>%%{WARNING}%% <a href="https://chromewebstore.google.com/detail/trilium-web-clipper/dfhgmnfclbebfobmblelddiejjcijbjm">Chrome Web Store</a></li>
  </ul>
  <h2>Configuration</h2>
  <p>The extension needs to connect to a running Trilium instance. By default, it scans a port range on the local computer to find a desktop Trilium instance.</p>
  <p>It's also possible to configure the <a href="#root/WOcw2SLH6tbX">server</a> address if you don't run the desktop application, or want it to work without the desktop application running.</p>
  <h2>Username</h2>
  <p>Older versions of Trilium (before 0.50) required username &amp; password to authenticate, but this is no longer the case. You may enter anything in that field, it will not have any effect.</p>


blobId: bzYjdGjpynI6efDu2EjX
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.629Z
content:
  <h2>Weight-tracker</h2>
  <p><img src="api/images/PFrpANAUte0M/weight-tracker.png" alt="screenshot of weight tracker" /></p>
  <p>The <code>Weight Tracker</code> is a <a href="#root/GLks18SNjxmC">Script API</a> showcase present in the <a href="#root/wX4HbRucYSDD">demo notes</a>.</p>
  <p>By adding <code>weight</code> as a <a href="#root/OFXdgB2nNk1F">promoted attribute</a> in the <a href="#root/KC1HB96bqqHX">template</a> from which <a href="#root/l0tKav7yLHGF">day notes</a> are created, you can aggregate the data and plot weight change over time.</p>
  <h2>Implementation</h2>
  <p>The <code>Weight Tracker</code> note in the screenshot above is of the type <code>Render Note</code>. That type of note doesn't have any useful content itself. Instead it is a placeholder where a <a href="#root/CdNpE2pqjmI6">script</a> can render its output.</p>
  <p>Scripts for <code>Render Notes</code> are defined in a <a href="#root/zEY4DaJG4YT5">relation</a> called <code>~renderNote</code>. In this example, it's the <code>Weight Tracker</code>'s child <code>Implementation</code>. The Implementation consists of two <a href="#root/6f9hih2hXXZk">code notes</a> that contain some HTML and JavaScript respectively, which load all the notes with a <code>weight</code> attribute and display their values in a chart.</p>
  <p>To actually render the chart, we're using a third party library called <a href="https://www.chartjs.org/">chart.js</a> which is imported as an attachment, since it's not built into Trilium.</p>
  <h3>Code</h3>
  <p>Here's the content of the script which is placed in a <a href="#root/6f9hih2hXXZk">code note</a> of type <code>JS Frontend</code>:</p>
  <pre><code class="language-text-x-trilium-auto">async function getChartData() {
      const days = await api.runOnBackend(async () =&gt; {
          const notes = api.getNotesWithLabel('weight');
          const days = [];

          for (const note of notes) {
              const date = note.getLabelValue('dateNote');
              const weight = parseFloat(note.getLabelValue('weight'));

              if (date &amp;&amp; weight) {
                  days.push({ date, weight });
              }
          }

          days.sort((a, b) =&gt; a.date &gt; b.date ? 1 : -1);

          return days;
      });

      const datasets = [
          {
              label: "Weight (kg)",
              backgroundColor: 'red',
              borderColor: 'red',
              data: days.map(day =&gt; day.weight),
              fill: false,
              spanGaps: true,
              datalabels: {
                  display: false
              }
          }
      ];

      return {
          datasets: datasets,
          labels: days.map(day =&gt; day.date)
      };
  }

  const ctx = $("#canvas")[0].getContext("2d");

  new chartjs.Chart(ctx, {
      type: 'line',
      data: await getChartData()
  });</code></pre><h2>How to remove the Weight Tracker button from the top bar</h2>
  <p>In the link map of the <code>Weight Tracker</code>, there is a note called <code>Button</code>. Open it and delete or comment out its contents. The <code>Weight Tracker</code> button will disappear after you restart Trilium.</p>


blobId: p9RV9HVJAOWExn2IPZBF
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.637Z
content:
  <h2>Introduction to Widget Development</h2>
  <p>This guide will walk you through creating a basic widget inside Trilium. By following these steps, you'll learn how to build a simple UI element that interacts with the user.</p>
  <h3>Step 1: The Basic Widget Structure</h3>
  <p>To start, we'll create the most basic widget possible. 
  Here's a simple example:</p>
  <pre><code class="language-text-x-trilium-auto">class MyWidget extends api.BasicWidget {
      get position() { return 1; }
      get parentWidget() { return "left-pane"; }
      
      doRender() {
          this.$widget = $("<div>");
          return this.$widget;
      }
  }

  module.exports = new MyWidget();</div></code></pre><p>To implement this widget:</p>
  <ol>
  <li>Create a new <code>JS Frontend</code> note in Trilium and paste in the code above.</li>
  <li>Assign the <code>#widget</code> <a href="#root/zEY4DaJG4YT5">attribute</a> to the <a href="#root/BFs8mudNFgCS">note</a>.</li>
  <li>Restart Trilium or reload the window.</li>
  </ol>
  <p>To verify that the widget is working, open the developer tools (<code>Cmd</code> + <code>Shift</code> + <code>I</code>) and run <code>document.querySelector("#my-widget")</code>. If the element is found, the widget is functioning correctly. If <code>undefined</code> is returned, double-check that the <a href="#root/BFs8mudNFgCS">note</a> has the <code>#widget</code> <a href="#root/zEY4DaJG4YT5">attribute</a>.</p>
  <h3>Step 2: Adding an UI Element</h3>
  <p>Next, let's improve the widget by adding a button to it.</p>
  <pre><code class="language-text-x-trilium-auto">const template = `<div><button>Click Me!</button></div>`;

  class MyWidget extends api.BasicWidget {
      get position() {return 1;}
      get parentWidget() {return "left-pane"}

      doRender() {
          this.$widget = $(template);
          return this.$widget;
      }
  }

  module.exports = new MyWidget();</code></pre><p>After making this change, reload Trilium. You should now see a button in the top-left corner of the left pane.</p>
  <h3>Step 3: Styling the Widget</h3>
  <p>To make the button more visually appealing and position it correctly, we'll apply some custom styling. Trilium includes <a href="https://boxicons.com">Box Icons</a>, which we'll use to replace the button text with an icon.
  For example the <code>bx bxs-magic-wand</code> icon.</p>
  <p>Here's the updated template:</p>
  <pre><code class="language-text-x-trilium-auto">const template = `<div><button class="tree-floating-button bx bxs-magic-wand tree-settings-button"></button></div>`;</code></pre><p>Next, we'll adjust the button's position using CSS:</p>
  <pre><code class="language-text-x-trilium-auto">class MyWidget extends api.BasicWidget {
      get position() { return 1; }
      get parentWidget() { return "left-pane"; }
      
      doRender() {
          this.$widget = $(template);
          this.cssBlock(`#my-widget {
              position: absolute;
              bottom: 40px;
              left: 60px;
              z-index: 1;
          }`);
          return this.$widget;
      }
  }

  module.exports = new MyWidget();</code></pre><p>After reloading Trilium, the button should now appear at the bottom left of the left pane, alongside other action buttons.</p>
  <h3>Step 4: Adding User Interaction</h3>
  <p>Let’s make the button interactive by showing a message when it’s clicked. We'll use the <code>api.showMessage</code> method from the <a href="#root/GLks18SNjxmC">Script API</a>.</p>
  <pre><code class="language-text-x-trilium-auto">class MyWidget extends api.BasicWidget {
      get position() { return 1; }
      get parentWidget() { return "left-pane"; }
      
      doRender() {
          this.$widget = $(template);
          this.cssBlock(`#my-widget {
              position: absolute;
              bottom: 40px;
              left: 60px;
              z-index: 1;
          }`);
          this.$widget.find("button").on("click", () =&gt; api.showMessage("Hello World!"));
          return this.$widget;
      }
  }

  module.exports = new MyWidget();</code></pre><p>Reload the application one last time. When you click the button, a "Hello World!" message should appear, confirming that your widget is fully functional.</p>


blobId: hzAYSCUqZE2iaP55l7eO
dateModified: 2025-03-09 10:46:07.608+0200
utcDateModified: 2025-03-09 08:46:09.641Z
content:
  <h2>Workspace</h2>
  <p>Workspace is a concept built up on top of <a href="#root/OR8WJ7Iz9K4U">note hoisting</a>. It is based on the idea that a user has several distinct spheres of interest. An example might be "Personal" and "Work", these two spheres are quite distinct and don't interact together. When I focus on Work, I don't really care about personal notes.</p>
  <p>So far workspace consists of these features:</p>
  <ul>
  <li><a href="#root/OR8WJ7Iz9K4U">note hoisting</a> - you can "zoom" into a workspace subtree to focus only on the relevant notes</li>
  <li>easy entering of workspace:</li>
  </ul>
  <p><img src="api/images/8zB1VFJRr0TS/1 Workspace image.png" alt="" /></p>
  <ul>
  <li>visual identification of workspace in tabs:</li>
  </ul>
  <p><img src="api/images/IZbC0lF5YNpQ/Workspace image.png" alt="" /></p>
  <h3>How to use workspaces</h3>
  <p>Let's say you have identified the workspaces and their subtrees. Define on the root of this subtree following labels:</p>
  <ul>
  <li><code>#workspace</code> - Marks this note as a workspace, button to enter the workspace is controlled by this</li>
  <li><code>#workspaceIconClass</code> - controls the box icon to be displayed in the tree and tabs, example <code>bx bx-home</code>. See <a href="https://boxicons.com/">https://boxicons.com/</a></li>
  <li><code>#workspaceTabBackgroundColor</code> - Background color of the tab, use any CSS color format, e.g. "lightblue" or "#ddd". See <a href="https://www.w3schools.com/cssref/css_colors.asp">https://www.w3schools.com/cssref/css_colors.asp</a>.</li>
  <li><code>#workspaceCalendarRoot</code> - marking a note with this label will define a new per-workspace calendar. If there's no such note, the global calendar will be used.</li>
  <li><code>#workspaceTemplate</code> - This note will appear in the selection of available templates when creating a new note, but only when you are currently hoisted into a workspace containing this template.</li>
  </ul>


blobId: beXdlYxXQ1rhBVjl1bNG
dateModified: 2025-03-09 10:51:55.984+0200
utcDateModified: 2025-03-09 08:51:55.985Z
content:
  <ul class="todo-list"><li><label class="todo-list__label"><input type="checkbox" disabled="disabled"><span class="todo-list__label__description">Integrate titles of the notes</span></label></li><li><label class="todo-list__label"><input type="checkbox" disabled="disabled"><span class="todo-list__label__description">Set <code>#shareAlias</code> for all the notes</span></label></li><li><label class="todo-list__label"><input type="checkbox" disabled="disabled"><span class="todo-list__label__description">Recreate structure of notes</span></label></li><li><label class="todo-list__label"><input type="checkbox" disabled="disabled"><span class="todo-list__label__description">Merge images into their corresponding notes</span></label></li><li><label class="todo-list__label"><input type="checkbox" disabled="disabled"><span class="todo-list__label__description">Review and delete each note from Pikapod</span></label></li></ul>


blobId: uJt5Zb2ZZTYDLYWSu5XI
dateModified: 2025-03-09 11:03:23.401+0200
utcDateModified: 2025-03-09 09:03:23.401Z
content:
  <h2>Bulk actions</h2><h3>Execute script</h3><p>For more complex scenarios, it is possible to type in a JavaScript expression in order to apply the necessary changes.</p><p>To apply a suffix (<code>- suffix</code> in this example), to the note title:</p><pre><code class="language-application-javascript-env-backend">note.title = note.title + " - suffix";</code></pre><p>To alter attributes of a note in a bulk action, such as setting the <code>#shareAlias</code> label to the title of the note:</p><pre><code class="language-application-javascript-env-backend">note.setLabel("shareAlias", note.title)</code></pre>


blobId: DmAYbSuLXI1TCNaXZooE
dateModified: 2025-03-09 11:04:00.117+0200
utcDateModified: 2025-03-09 09:04:00.117Z
content:
  <p>Trilium offers advanced functionality through <a href="#root/CdNpE2pqjmI6">Scripts</a> and <a href="#root/OFXdgB2nNk1F">Promoted Attributes</a>. To illustrate these features, we've prepared several showcases available in the <a href="#root/wX4HbRucYSDD">demo notes</a>:</p><ul><li><a href="#root/iRwzGnHPzonm">Relation Map</a></li><li><a href="#root/l0tKav7yLHGF">Day Notes</a></li><li><a href="#root/R7abl2fc6Mxi">Weight Tracker</a></li><li><a href="#root/xYjQUYhpbUEW">Task Manager</a></li></ul><p>It's important to note that these examples are not natively supported by Trilium out of the box; instead, they demonstrate what you can build within Trilium.</p>


blobId: 7oXRy6vo3lagdDBZ0zIX
dateModified: 2025-03-09 11:04:03.543+0200
utcDateModified: 2025-03-09 09:04:03.543Z
content:
  <p><img src="api/images/gaRKhojVlYx5/anonymization.png" alt="screenshot of advanced settings"></p><p>In certain scenarios, understanding the structure of a database is crucial for troubleshooting issues. However, sharing your actual <a href="#root/wX4HbRucYSDD">database</a> file with personal notes is not advisable. To address this, Trilium offers a feature to anonymize the database. This feature can be accessed via Menu -&gt; Options -&gt; Advanced tab.</p><p>This feature creates a copy of your database with all sensitive data removed. Specifically, it strips out note titles, contents, revisions, history, and some non-system attributes while retaining the overall structure and metadata, such as modification dates. After anonymization, the database undergoes a <a href="https://sqlite.org/lang_vacuum.html">vacuuming process</a> to ensure no sensitive data remnants remain in the file. The anonymized database is saved in the <code>anonymized</code> directory within the <a href="#root/tAassRL4RSQL">data directory</a>, making it safe to share with bug reports.</p><p>This will create a copy of your document and remove all sensitive data (currently note titles, contents, revisions, history and some of the options, and non-system attributes) while leaving all structure and metadata (e.g. date of last change). After this is done, the database is <a href="https://sqlite.org/lang_vacuum.html">VACUUMed</a> to make sure there's no stale sensitive data in the document file. The resulting file is stored in <code>anonymized</code> directory (placed in the <a href="#root/tAassRL4RSQL">data directory</a>). You can safely attach it to a bug report.</p><h2>Command Line Anonymization</h2><p>If your <a href="#root/wX4HbRucYSDD">database</a> is corrupted to the point where Trilium cannot start, the anonymization process can still be executed via the command line:</p><pre><code class="language-text-x-trilium-auto">node src/anonymize.js</code></pre><p>Run this command from the directory containing Trilium's source files, typically found in the <code>resources/app</code> directory for desktop builds.</p>


blobId: 0UxIoCdHN84MEBtL1ojY
dateModified: 2025-03-09 11:04:09.233+0200
utcDateModified: 2025-03-09 09:04:09.232Z
content:
  <p>I've assumed you have created a DNS A record for <code>trilium.yourdomain.com</code> that you want to use for your Trilium server.</p><ol><li><p>Download docker image and create container</p><pre><code class="language-text-x-trilium-auto"> docker pull triliumnext/notes:[VERSION]
   docker create --name trilium -t -p 127.0.0.1:8080:8080 -v ~/trilium-data:/home/node/trilium-data triliumnext/notes:[VERSION]</code></pre></li><li>Configure Apache proxy and websocket proxy<ol><li><p>Enable apache proxy modules</p><pre><code class="language-text-x-trilium-auto"> a2enmod ssl
   a2enmod proxy
   a2enmod proxy_http
   a2enmod proxy_wstunnel</code></pre></li><li><p>Create a new let's encrypt certificate</p><pre><code class="language-text-x-trilium-auto"> sudo certbot certonly -d trilium.mydomain.com</code></pre><p>Choose standalone (2) and note the location of the created certificates (typically /etc/letsencrypt/live/...)</p></li><li><p>Create a new virtual host file for apache (you may want to use <code>apachectl -S</code> to determine the server root location, mine is /etc/apache2)</p><pre><code class="language-text-x-trilium-auto"> sudo nano /etc/apache2/sites-available/trilium.yourdomain.com.conf</code></pre><p>Paste (and customize) the following text into the configuration file</p><pre><code class="language-text-x-trilium-auto"> 
       ServerName http://trilium.yourdomain.com
       RewriteEngine on
           RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
   
   
       ServerName https://trilium.yourdomain.com
       RewriteEngine On
       RewriteCond %{HTTP:Connection} Upgrade [NC]
       RewriteCond %{HTTP:Upgrade} websocket [NC]
       RewriteRule /(.*) ws://localhost:8080/$1 [P,L]
       AllowEncodedSlashes NoDecode
       ProxyPass / http://localhost:8080/ nocanon
       ProxyPassReverse / http://localhost:8080/
       SSLCertificateFile /etc/letsencrypt/live/trilium.yourdomain.com/fullchain.pem
       SSLCertificateKeyFile /etc/letsencrypt/live/trilium.yourdomain.com/privkey.pem
       Include /etc/letsencrypt/options-ssl-apache.conf
   </code></pre></li><li>Enable the virtual host with <code>sudo a2ensite trilium.yourdomain.com.conf</code></li><li>Reload apache2 with <code>sudo systemctl reload apache2</code></li></ol></li><li>Create and enable a systemd service to start the docker container on boot<ol><li><p>Create a new empty file called <code>/lib/systemd/system/trilium.service</code> with the contents</p><pre><code class="language-text-x-trilium-auto"> [Unit]
   Description=Trilium Server
   Requires=docker.service
   After=docker.service

   [Service]
   Restart=always
   ExecStart=/usr/bin/docker start -a trilium
   ExecStop=/usr/bin/docker stop -t 2 trilium

   [Install]
   WantedBy=local.target</code></pre></li><li><p>Install, enable and start service</p><pre><code class="language-text-x-trilium-auto"> sudo systemctl daemon-reload
   sudo systemctl enable trilium.service
   sudo systemctl start trilium.service</code></pre></li></ol></li></ol>


blobId: ZUuvQVjg4e2XNcplteXp
dateModified: 2025-03-09 11:04:18.041+0200
utcDateModified: 2025-03-09 09:04:18.041Z
content:
  <p>Archived notes are notes which have <code>archived</code> <a href="#root/zEY4DaJG4YT5">attribute</a> - either directly or <a href="#root/bwZpz2ajCEwO">inherited</a>.</p><p>Such notes are then by default not shown in the autocomplete and in the full text <a href="#root/eIg8jdvaoNNd">search</a>.</p><p>This can be useful for notes which are no longer very useful but still valuable enough to keep around without them getting too much in the way.</p><p>You can control whether archived notes are displayed in the note tree with a setting:</p><p><img src="api/images/1fkGrskxHx5u/hide-archived.png" alt=""></p>


blobId: ZsHYPrLLQNsKr6dvmgv0
dateModified: 2025-03-09 11:04:24.847+0200
utcDateModified: 2025-03-09 09:04:24.847Z
content:
  <p>A <a href="#root/BFs8mudNFgCS">note</a> in Trilium can <i>own</i> one or more attachments, which can be either images or files. These attachments can be displayed or linked within the note that owns them.</p><p>This can be especially useful to include dependencies for your <a href="#root/CdNpE2pqjmI6">scripts</a>. The <a href="#root/R7abl2fc6Mxi">Weight Tracker</a> shows how to use <a href="https://chartjs.org/">chartjs</a> which is attached to the <a href="#root/HcUYTojFohtb">script note</a>.</p><p>Each note exclusively owns its attachments, meaning attachments cannot be shared or linked from one note to another. If an attachment link is copied to a different note, the attachment itself is duplicated, and the copies are managed independently thereafter.</p><p>Attachments, especially image files, are the recommended method for embedding visuals in notes. It is important to link image attachments within the text of the owning note; otherwise, they will be automatically deleted after a configurable timeout period if not referenced.</p>


blobId: ENkYpRwMlXGoI05oYeLc
dateModified: 2025-03-09 11:04:51.736+0200
utcDateModified: 2025-03-09 09:04:51.736Z
content:
  <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><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 receive specific attributes from the parent note. These attributes are independent of the parent and will persist even if the note is moved elsewhere.</p><h3>How to Use</h3><ul><li><strong>Syntax:</strong> <code>#child:attributeName</code></li><li><strong>Chained Inheritance:</strong> You can chain this inheritance, such as <code>#child:child:attributeName</code>, where each child down the hierarchy receives the appropriate attribute.</li></ul><h3>Example</h3><p>If a parent note has the label <code>#child:exampleAttribute</code>, all newly created child notes will inherit the <code>#exampleAttribute</code> label. This can be useful for setting default properties for notes in a specific section.</p><h2>3. Template Inheritance</h2><p>Attributes can also be inherited from <a href="#root/KC1HB96bqqHX">templates</a>. 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.</p>


blobId: xYToFIaLjYBdJnZdDa70
dateModified: 2025-03-09 11:05:00.521+0200
utcDateModified: 2025-03-09 09:05:00.522Z
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><strong>Labels</strong>: Simple key-value text records</li><li><strong>Relations</strong>: Named links to other notes</li></ol><p>These attributes play a crucial role in organizing, categorizing, and enhancing the functionality of notes.</p><p><img src="api/images/exRtMRlEGzyO/attributes.png" alt="Screenshot of 'task template' attributes"></p><h2>Labels</h2><p>Labels in Trilium can be used for a variety of purposes:</p><ul><li><strong>Metadata</strong>: Assign labels with optional values for categorization, such as <code>#year=1999</code>, <code>#genre="sci-fi"</code>, or <code>#author="Neal Stephenson"</code></li><li><strong>Configuration</strong>: Labels can configure advanced features or settings</li><li><strong>Scripts and Plugins</strong>: Used to tag notes with special metadata, such as the "weight" attribute in the <a href="#root/R7abl2fc6Mxi">Weight Tracker</a></li></ul><p>Labels are also searchable, enhancing note retrieval.</p><h3>Common Labels for Advanced Configuration</h3><ul><li><code><strong>disableVersioning</strong></code>: Disables automatic versioning, ideal for large, unimportant notes like script libraries</li><li><code><strong>versioningLimit</strong></code>: Used to limit the number of revisions for a single note</li><li><code><strong>calendarRoot</strong></code>: Marks the note as the root for <a href="#root/l0tKav7yLHGF">day notes</a>. Only one note should carry this label</li><li><code><strong>archived</strong></code>: Hides notes from default search results and dialogs</li><li><code><strong>excludeFromExport</strong></code>: Excludes notes and their subtrees from export operations</li><li><code><strong>run</strong></code>: Specifies events to trigger scripts (e.g., <code>frontendStartup</code>, <code>hourly</code>)</li><li><code><strong>runAtHour</strong></code>: Defines specific hours for scripts to run, used with <code>#run=hourly</code></li><li><code><strong>disableInclusion</strong></code>: Prevents a script from being included in parent script executions</li><li><code><strong>sorted</strong></code>: Automatically sorts child notes alphabetically by title</li><li><code><strong>top</strong></code>: Keeps the note at the top of its parent's list, useful with <code>sorted</code></li><li><code><strong>hidePromotedAttributes</strong></code>: Hides certain attributes in the note's display</li><li><code><strong>readOnly</strong></code>: Sets the note to read-only mode, applicable to text and code notes</li><li><code><strong>autoReadOnlyDisabled</strong></code>: Disables automatic read-only mode for large notes</li><li><code><strong>appCss</strong></code>: Marks CSS notes used to modify Trilium’s appearance</li><li><code><strong>appTheme</strong></code>: Marks full CSS themes available in Trilium's options</li><li><code><strong>cssClass</strong></code>: Adds a CSS class to the note's representation in the tree</li><li><code><strong>iconClass</strong></code>: Adds a CSS class to the note's icon, useful for distinguishing notes visually. See <a href="#root/p9kXRFAkwN4o">note icons</a></li><li><code><strong>pageSize</strong></code>: Specifies the number of items per page in note listings</li><li><code><strong>customRequestHandler</strong></code><strong> and </strong><code><strong>customResourceProvider</strong></code>: Refer to <a href="#root/J5Ex1ZrMbyJ6">Custom request handler</a></li><li><code><strong>widget</strong></code>: Marks a note as a custom widget, added to Trilium's component tree</li><li><code><strong>workspace</strong></code><strong> and related attributes</strong>: See <a href="#root/9sRHySam5fXb">Workspace</a> for more details</li><li><code><strong>searchHome</strong></code>: Specifies the parent for new search notes</li><li><code><strong>inbox</strong></code>: Designates a default location for new notes created via the sidebar</li><li><code><strong>sqlConsoleHome</strong></code>: Default location for SQL console notes</li><li><code><strong>bookmarked</strong></code><strong> and </strong><code><strong>bookmarkFolder</strong></code>: See <a href="#root/u3YFHC9tQlpm">Bookmarks</a></li><li><code><strong>shareXXX</strong></code>: See <a href="#root/R9pX4DGra2Vt">Sharing</a></li><li><code><strong>keyboardShortcut</strong></code>: Assigns a keyboard shortcut to open the note</li><li><code><strong>displayRelations</strong></code><strong> and </strong><code><strong>hideRelations</strong></code>: Manages the display of note relations</li><li><code><strong>titleTemplate</strong></code>: See <a href="#root/47ZrP6FNuoG8">Default note title</a></li><li><code><strong>template</strong></code>: Makes the note available as a template</li><li><code><strong>toc</strong></code>: Controls the visibility of the table of contents</li><li><code><strong>color</strong></code>: Defines the color of the note in the tree and links</li><li><code><strong>hideChildrenOverview</strong></code>: Hides child notes in the parent note's editor</li><li><code><strong>viewType</strong></code>: Sets the view of child notes (grid or list)</li></ul><h2>Relations</h2><p>Relations define connections between notes, similar to links.</p><h3>Uses</h3><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><ul><li><strong>Event-based Relations</strong>: Such as <code>runOnNoteCreation</code> or <code>runOnNoteChange</code>, which trigger scripts on specific actions</li><li><strong>Other Relations</strong>: Include <code>template</code>, <code>renderNote</code>, <code>widget</code>, and sharing-related relations</li></ul><h2>Multiplicity</h2><p>Attributes in Trilium can be "multivalued", meaning multiple attributes with the same name can coexist.</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 <a href="#root/OFXdgB2nNk1F">Promoted attributes</a>.</p><h2>Attribute Inheritance</h2><p>Trilium supports attribute inheritance, allowing child notes to inherit attributes from their parents. For more information, see <a href="#root/bwZpz2ajCEwO">Attribute inheritance</a>.</p>


blobId: z3R5hkFF9xMZjdmOQgfF
dateModified: 2025-03-09 11:05:10.244+0200
utcDateModified: 2025-03-09 09:05:10.245Z
content:
  <p>Trilium supports simple backup scheme where it saves copy of the <a href="#root/xjSsCcvVZf6H">document</a> on these events:</p><ul><li>once a day</li><li>once a week</li><li>once a month</li><li>before DB migration to newer version</li></ul><p>So in total you'll have at most 4 backups from different points in time which should protect you from various problems. These backups are stored by default in <code>backup</code> directory placed in the <a href="#root/tAassRL4RSQL">data directory</a>.</p><p>This is only very basic backup solution, and you're encouraged to add some better backup solution - e.g. backing up the <a href="#root/xjSsCcvVZf6H">document</a> to cloud / different computer etc.</p><p>Note that <a href="#root/cbkrhQjrkKrh">synchronization</a> provides also some backup capabilities by its nature of distributing the data to other computers.</p><h2>Restoring backup</h2><p>Let's assume you want to restore the weekly backup, here's how to do it:</p><ul><li>find <a href="#root/tAassRL4RSQL">data directory</a> Trilium uses - easy way is to open "About Trilium Notes" from "Menu" in upper left corner and looking at "data directory"<ul><li>I'll refer to <code>~/trilium-data</code> as data directory from now on</li></ul></li><li>find <code>~/trilium-data/backup/backup-weekly.db</code> - this is the <a href="#root/xjSsCcvVZf6H">document</a> backup</li><li>at this point stop/kill Trilium</li><li>delete <code>~/trilium-data/document.db</code>, <code>~/trilium-data/document.db-wal</code> and <code>~/trilium-data/document.db-shm</code> (latter two files are auto generated)</li><li>copy and rename this <code>~/trilium-data/backup/backup-weekly.db</code> to <code>~/trilium-data/document.db</code></li><li>make sure that the file is writable, e.g. with <code>chmod 600 document.db</code></li><li>start Trilium again</li></ul><p>If you have configured sync then you need to do it across all members of the sync cluster, otherwise older version (restored backup) of the document will be detected and synced to the newer version.</p><h2>Disabling backup</h2><p>Although this is not recommended, it is possible to disable backup in <code>config.ini</code> in the <a href="#root/tAassRL4RSQL">data directory</a>:</p><pre><code class="language-text-x-trilium-auto">[General]
  ... some other configs
  # set to true to disable backups (e.g. because of limited space on server)
  noBackup=true</code></pre><p>You can also review the <a href="#root/Gzjqa934BdH4">configuration</a> file to provide all <code>config.ini</code> values as environment variables instead.</p><p>See <a href="https://github.com/TriliumNext/Notes/blob/master/config-sample.ini">sample config</a>. %%{WARNING}%%</p>


blobId: aYXx5Lpufw1eev3YYSAJ
dateModified: 2025-03-09 11:05:32.770+0200
utcDateModified: 2025-03-09 09:05:32.769Z
content:
  <h2>Book Notes</h2><p>A <strong>Book Note</strong> in Trilium is a special type of <a href="#root/BFs8mudNFgCS">note</a> designed to display the contents of its child notes sequentially, creating a linear, book-like reading experience. This format is particularly useful for viewing multiple smaller notes in a cohesive, continuous manner.</p><p><img src="api/images/kLoEdvFsjOqB/book-note.png" alt="Book Note Example"></p><p>In the example above, the "node.js" note on the left panel contains several child notes. The right panel displays the content of these child notes as a single continuous document.</p><h2>Features</h2><h3>Linear Display</h3><p>The Book Note format compiles the contents of all child notes into one continuous view. This makes it ideal for reading extensive information broken into smaller, manageable segments.</p><h3>Grid View Option</h3><p>Trilium also offers a "Grid View" option within the Book Note properties. This view presents the child notes in a grid format, allowing for a more visual navigation experience.</p><p><img src="api/images/DF89NW1ZLkX0/book-note-pictures.png" alt="Grid View Example"></p><p>Switching between these views can be easily managed through the Book Note's settings (or <code>viewType</code> attribute), allowing users to choose the format that best suits their reading or navigation preferences.</p>


blobId: EHj3WeuYROAEPdrSVADB
dateModified: 2025-03-09 11:05:38.105+0200
utcDateModified: 2025-03-09 09:05:38.105Z
content:
  <p>To easily access selected notes, you can bookmark them. See demo:</p><p><img src="api/images/sag6ww9q4pgW/bookmarks.gif" alt=""></p><h2>Bookmark folder</h2><p>Space in the left panel is limited, and you might want to bookmark many items. One possible solution is to bookmark a folder, so it shows its children:</p><p><img src="api/images/HEtnpiQrEvjl/bookmark-folder.png" alt=""></p><p>To do this, you need to add a <code>#bookmarkFolder</code> label to the note.</p>


blobId: tuELQyserkydZ0jLONJQ
dateModified: 2025-03-09 11:05:56.271+0200
utcDateModified: 2025-03-09 09:05:56.272Z
content:
  <p>(Since trilium v0.52)</p><p>Canvas note use the excalidraw library to allow handwritten notes with mouse, pen or touch on an infinite canvas. It also supports basic diagramming, text and garphics input.</p><p><img src="api/images/IYMnSG4HrC1K/Canvas-note image.png" alt="grafik"></p>


blobId: K5TF9hlk615b7gRI3dwp
dateModified: 2025-03-09 11:07:01.189+0200
utcDateModified: 2025-03-09 09:07:01.190Z
content:
  <h2>Motivation</h2><p>Trilium's core feature is the ability to structure your notes into hierarchical tree-like structure.</p><p>It is expected then that you'll have an elaborate and deep note hierarchy - each subtree will represent a more refined and specialized view of your knowledge base.</p><p>This is a pretty powerful approach, but it also carries a hidden assumption that each "subtopic" is "owned" by one parent. I'll illustrate this with an example - let's say my basic structure is this:</p><ul><li>Technology<ul><li>Programming<ul><li>Kotlin</li><li>JavaScript</li></ul></li><li>Operating systems<ul><li>Linux</li><li>Windows</li></ul></li></ul></li></ul><p>Now, I'm starting to learn about <a href="https://en.wikipedia.org/wiki/Bash_(Unix_shell)">Bash</a> and would like to create notes related to this topic. But now I'm facing a problem of where to categorize this. The issue here is that Bash is both a programming language and a tool (shell) very much tied into Linux. It seems it belongs to both of these, I can't (and don't want to) choose one over the other.</p><h2>Solution</h2><p>The solution to the problem shown above is to allow notes to have multiple parents.</p><p>I call these "clones", but that is a bit misleading - there's no original and cloned note - the notes in both of the parents categories are identical.</p><p>Another misleading thing about "cloning" is that it suggests that a copy of the note has been made. That's not really true, the note itself stays in just one original, it is just referenced in multiple places in the tree hierarchy. So changing it in one category changes it in all the others, because they're all the same note.</p><p>Here's the final structure with cloning:</p><ul><li>Technology<ul><li>Programming<ul><li>Kotlin</li><li>JavaScript</li><li>Bash<ul><li>some sub-notes ...</li></ul></li></ul></li><li>Operating systems<ul><li>Linux<ul><li>Bash<ul><li>some sub-notes ...</li></ul></li></ul></li><li>Windows</li></ul></li></ul></li></ul><p>So now the "Bash" subtree appears on multiple locations in the hierarchy. Both the Bash subtrees are the same and contain the same sub-categories and notes.</p><h3>Demo</h3><p><img src="api/images/BqvIJUHkWrvH/create-clone.gif" alt=""></p><p>In the demo, you can see how a clone can be created using the context menu. It's possible to do this also using the Add Link dialog or with CTRL+C and CTRL+V <a href="#root/A9Oc6YKKc65v">keyboard shortcuts</a>.</p><p>As seen in the demo, you can view the list of all available clones in the "Note Paths" tab in the Ribbon toolbar.</p><p>Titles of cloned notes in the tree view have an asterisk to the right to easily see that the note is also placed into some other location.</p><h2>Prefix</h2><p>Since notes can be categorized into multiple places, it's recommended to choose a generalized name that fits into all locations instead of something more specific to avoid confusion. In some cases this isn't possible so Trilium provides "branch prefixes", which is shown before the note name in the tree and as such provides a specific kind of context. The prefix is location specific, so it's displayed only in the tree pane.</p><h2>Deleting notes/clones</h2><p>With clones, it might not be immediately obvious how deleting works.</p><p>If you try to delete a note, it works like this:</p><ol><li>if the note has multiple clones, delete just this clone and leave the actual note (and its other clones) as it is.</li><li>if this note doesn't have any other clones, delete the note<ul><li>Run the whole process starting with 1. on all note's children notes</li></ul></li></ol>


blobId: EW6RHj1jiNPosVDU4WTV
dateModified: 2025-03-09 11:07:10.163+0200
utcDateModified: 2025-03-09 09:07:10.163Z
content:
  <p>Trilium supports creating "code" notes, i.e. notes which contain some sort of formal code - be it programming language (C++, JavaScript), structured data (JSON, XML) or other types of codes (CSS etc.).</p><p>This can be useful for a few things:</p><ul><li>computer programmers can store code snippets as notes with syntax highlighting</li><li>JavaScript code notes can be executed inside Trilium for some extra functionality<ul><li>we call such JavaScript code notes "scripts" - see <a href="#root/CdNpE2pqjmI6">Scripts</a></li></ul></li><li>JSON, XML etc. can be used as storage for structured data (typically used in conjunction with scripting)</li></ul><p><img src="api/images/8jgXl1RUGL4H/code-note.png" alt=""></p><h2>Extra languages</h2><p>Trilium supports syntax highlighting for many languages, but by default displays only some of them (to reduce the number of items). You can add extra languages in Options -&gt; Code notes.</p><h2>Code blocks</h2><p>An alternative to the code note is a "code block" - feature of a text note which can add short snippets of code to the text editor. Starting with TriliumNext v0.90.12, the code blocks also support syntax highlighting.</p><p><img src="api/images/Y7RLSw20haCB/code-block.png" alt=""></p>


blobId: mYb1e52Oh5JqIhuUW6RB
dateModified: 2025-03-09 11:07:16.748+0200
utcDateModified: 2025-03-09 09:07:16.748Z
content:
  <p>Trilium supports configuration via a file named <code>config.ini</code> and environment variables. Please review the file named <a href="https://github.com/TriliumNext/Notes/blob/develop/config-sample.ini">config-sample.ini</a> in the <a href="https://github.com/TriliumNext/Notes">Notes</a> repository to see what values are supported.</p><p>You can provide the same values via environment variables instead of the <code>config.ini</code> file, and these environment variables use the following format:</p><ol><li>Environment variables should be prefixed with <code>TRILIUM_</code> and use underscores to represent the INI section structure.</li><li>The format is: <code>TRILIUM_&lt;SECTION&gt;_&lt;KEY&gt;=&lt;VALUE&gt;</code></li><li>The environment variables will override any matching values from config.ini</li></ol><p>For example, if you have this in your config.ini:</p><pre><code class="language-text-x-trilium-auto">[Network]
  host=localhost
  port=8080</code></pre><p>You can override these values using environment variables:</p><pre><code class="language-text-x-sh">TRILIUM_NETWORK_HOST=0.0.0.0
  TRILIUM_NETWORK_PORT=9000</code></pre><p>The code will:</p><ol><li>First load the config.ini file as before</li><li>Then scan all environment variables for ones starting with <code>TRILIUM_</code></li><li>Parse these variables into section/key pairs</li><li>Merge them with the config from the file, with environment variables taking precedence</li></ol>


blobId: BxGYVuvn0L3akRR0HySy
dateModified: 2025-03-09 11:07:20.458+0200
utcDateModified: 2025-03-09 09:07:20.459Z
content:
  <p>Trilium provides a mechanism for <a href="#root/CdNpE2pqjmI6">scripts</a> to open a public REST endpoint. This opens a way for various integrations with other services - a simple example would be creating new note from Slack by issuing a slash command (e.g. <code>/trilium buy milk</code>).</p><h2>Create note from outside Trilium</h2><p>Let's take a look at an example. The goal is to provide a REST endpoint to which we can send title and content and Trilium will create a note.</p><p>We'll start with creating a JavaScript backend <a href="#root/6f9hih2hXXZk">code note</a> containing:</p><pre><code class="language-text-x-trilium-auto">const {req, res} = api;
  const {secret, title, content} = req.body;

  if (req.method == 'POST' &amp;&amp; secret === 'secret-password') {
      // notes must be saved somewhere in the tree hierarchy specified by a parent note. 
      // This is defined by a relation from this code note to the "target" parent note
      // alternetively you can just use constant noteId for simplicity (get that from "Note Info" dialog of the desired parent note)
      const targetParentNoteId = api.currentNote.getRelationValue('targetNote');
      
      const {note} = api.createTextNote(targetParentNoteId, title, content);
      const notePojo = note.getPojo();

      res.status(201).json(notePojo);
  }
  else {
      res.send(400);
  }</code></pre><p>This script note has also following two attributes:</p><ul><li>label <code>#customRequestHandler</code> with value <code>create-note</code></li><li>relation <code>~targetNote</code> pointing to a note where new notes should be saved</li></ul><h3>Explanation</h3><p>Let's test this by using an HTTP client to send a request:</p><pre><code class="language-text-x-trilium-auto">POST http://my.trilium.org/custom/create-note
  Content-Type: application/json

  {
    "secret": "secret-password",
    "title": "hello",
    "content": "world"
  }+++++++++++++++++++++++++++++++++++++++++++++++</code></pre><p>Notice the <code>/custom</code> part in the request path - Trilium considers any request with this prefix as "custom" and tries to find a matching handler by looking at all notes which have <code>customRequestHandler</code> <a href="#root/zEY4DaJG4YT5">label</a>. Value of this label then contains a regular expression which will match the request path (in our case trivial regex "create-note").</p><p>Trilium will then find our code note created above and execute it. <code>api.req</code>, <code>api.res</code> are set to <a href="https://expressjs.com/en/api.html#req">request</a> and <a href="https://expressjs.com/en/api.html#res">response</a> objects from which we can get details of the request and also respond.</p><p>In the code note we check the request method and then use trivial authentication - keep in mind that these endpoints are by default totally unauthenticated, and you need to take care of this yourself.</p><p>Once we pass these checks we will just create the desired note using <a href="#root/GLks18SNjxmC">Script API</a>.</p><h2>Custom resource provider</h2><p>Another common use case is that you want to just expose a file note - in such case you create label <code>customResourceProvider</code> (value is again path regex).</p><p>Note: The file that is supposed to be exposed needs to have a label <code>#customResourceProvider="fonts/myFont.woff</code></p><p>For example, your file is in custom/fonts, you can call it via <code>custom/fonts/myFont.woff</code>.</p><h2>Advanced concepts</h2><p><code>api.req</code> and <code>api.res</code> are Express.js objects - you can always look into its <a href="https://expressjs.com/en/api.html">documentation</a> for details.</p><h3>Parameters</h3><p>REST request paths often contain parameters in the URL, e.g.:</p><pre><code class="language-text-x-trilium-auto">http://my.trilium.org/custom/notes/123</code></pre><p>The last part is dynamic so the matching of the URL must also be dynamic - for this reason the matching is done with regular expressions. Following <code>customRequestHandler</code> value would match it:</p><pre><code class="language-text-x-trilium-auto">notes/([0-9]+)</code></pre><p>Additionally, this also defines a matching group with the use of parenthesis which then makes it easier to extract the value. The matched groups are available in <code>api.pathParams</code>:</p><pre><code class="language-text-x-trilium-auto">const noteId = api.pathParams[0];</code></pre><p>Often you also need query params (as in e.g. <code>http://my.trilium.org/custom/notes?noteId=123</code>), you can get those with standard express <code>req.query.noteId</code>.</p>


blobId: WTv4674YjxsDEa7fwjLk
dateModified: 2025-03-09 11:07:24.991+0200
utcDateModified: 2025-03-09 09:07:24.992Z
content:
  <p>It's possible to create custom widget in three possible locations where you can display your custom content.</p><p>Positions are:</p><ul><li><code>left-pane</code></li><li><code>center-pane</code></li><li><code>note-detail-pane</code> - located within <code>center-pane</code>, but specific to note (split)</li><li><code>right-pane</code></li></ul><h2>Example - word count widget</h2><p>Create a code note of type JS frontend and <strong>give it a</strong> <code>**#widget**</code> <strong>label</strong>.</p><pre><code class="language-text-x-trilium-auto">/*
   * This defines a custom widget which displays number of words and characters in a current text note.
   * To be activated for a given note, add label 'wordCount' to the note, you can also make it inheritable and thus activate it for the whole subtree.
   * 
   * See it in action in "Books" and its subtree.
   */
  const TPL = `
      Word count: 
      

      &nbsp;

      Character count: 
      
  `;

  class WordCountWidget extends api.NoteContextAwareWidget {
      static get parentWidget() { return 'center-pane'; }

      get position() { return 100; } // higher value means position towards the bottom/right

      isEnabled() {
          return super.isEnabled()
              &amp;&amp; this.note.type === 'text'
              &amp;&amp; this.note.hasLabel('wordCount');
      }

      doRender() {
          this.$widget = $(TPL);
          this.$wordCount = this.$widget.find('.word-count');
          this.$characterCount = this.$widget.find('.character-count');
          return this.$widget;
      }

      async refreshWithNote(note) {
          const {content} = await note.getNoteComplement();

          const text = $(content).text(); // get plain text only

          const counts = this.getCounts(text);

          this.$wordCount.text(counts.words);
          this.$characterCount.text(counts.characters);
      }

      getCounts(text) {
          const chunks = text
              .split(/[\s-+:,/\\]+/)
              .filter(chunk =&gt; chunk !== '');

          let words;

          if (chunks.length === 1 &amp;&amp; chunks[0] === '') {
              words = 0;
          }
          else {
              words = chunks.length;
          }

          const characters = chunks.join('').length;

          return {words, characters};
      }

      async entitiesReloadedEvent({loadResults}) {
          if (loadResults.isNoteContentReloaded(this.noteId)) {
              this.refresh();
          }
      }
  }

  module.exports = WordCountWidget;</code></pre><p>After you make changes it is necessary to restart Trilium so that the layout can be rebuilt.</p><h3>Example screenshot</h3><p>On the bottom you can see the resulting widget:</p><p><img src="api/images/3sCPPL0LEC1S/Custom-widget image.png" alt=""></p>


blobId: i40Ogbd8TTVUb1A4peJW
dateModified: 2025-03-09 11:07:32.722+0200
utcDateModified: 2025-03-09 09:07:32.723Z
content:
  <p>Data directory contains:</p><ul><li><code>document.db</code> - <a href="#root/wX4HbRucYSDD">database</a></li><li><code>config.ini</code> - instance level settings like port on which the Trilium application runs</li><li><code>backup</code> - contains automatically <a href="#root/ODY7qQn5m2FT">backup</a> of documents</li><li><code>log</code> - contains application log files</li></ul><h2>Location</h2><p>Easy way how to find out which data directory Trilium uses is to look at the "About Trilium Notes" dialog (from "Menu" in upper left corner):</p><p><img src="api/images/0QpFiijcbMem/about-trilium-data-dir.png" alt=""></p><p>Here's how the location is decided:</p><p>Data directory is normally named <code>trilium-data</code> and it is stored in:</p><ul><li><code>/home/[user]/.local/share</code> for Linux</li><li><code>C:\Users\[user]\AppData\Roaming</code> for Windows Vista and up</li><li><code>/Users/[user]/Library/Application Support</code> for Mac OS</li><li>user's home is a fallback if some of the paths above don't exist</li><li>user's home is also a default setup for [[docker|Docker server installation]]</li></ul><p>If you want to back up your Trilium data, just backup this single directory - it contains everything you need.</p><h3>Changing the location of data directory</h3><p>If you want to use some other location for the data directory than the default one, you may change it via TRILIUM_DATA_DIR environment variable to some other location:</p><h4>Linux</h4><pre><code class="language-text-x-trilium-auto">export TRILIUM_DATA_DIR=/home/myuser/data/my-trilium-data</code></pre><h4>Mac OS X</h4><p>You need to create a .plist file under <code>~/Library/LaunchAgents</code> to load it properly each login.</p><p>To load it manually, u need to use <code>launchctl setenv TRILIUM_DATA_DIR &lt;yourpath&gt;</code></p><p>Here is a pre-defined template, where you just need to add your path to:</p><pre><code class="language-text-x-trilium-auto">



      
          Label
          set.trilium.env
          RunAtLoad
          
          ProgramArguments
          
              launchctl
              setenv
              TRILIUM_DATA_DIR
              /Users/YourUserName/Library/Application Support/trilium-data
          
      
  </code></pre><h3>Create a script to run with specific data directory</h3><p>An alternative to globally setting environment variable is to run only the Trilium Notes with this environment variable. This then allows for different setup styles like two <a href="#root/wX4HbRucYSDD">database</a> instances or "portable" installation.</p><p>To do this in unix based systems simply run trilium like this:</p><pre><code class="language-text-x-trilium-auto">TRILIUM_DATA_DIR=/home/myuser/data/my-trilium-data trilium</code></pre><p>You can then save the above command as a shell script on your path for convenience.</p><h3>Fine-grained directory/path location</h3><p>It's possible to configure e.g. backup and log directories separately, with following env. variables:</p><ul><li><code>TRILIUM_DOCUMENT_PATH</code></li><li><code>TRILIUM_BACKUP_DIR</code></li><li><code>TRILIUM_LOG_DIR</code></li><li><code>TRILIUM_ANONYMIZED_DB_DIR</code></li><li><code>TRILIUM_CONFIG_INI_PATH</code></li></ul><p>If these are not set, default paths within the data directory will be used.</p>


blobId: URLRlbxfSeGPIkTlUvvS
dateModified: 2025-03-09 11:08:27.030+0200
utcDateModified: 2025-03-09 09:08:27.030Z
content:
  <p>Your Trilium data is stored in a <a href="https://www.sqlite.org">SQLite</a> database which contains all notes, tree structure, metadata, and most of the configuration. The database file is named <code>document.db</code> and is stored in the application's default <a href="#root/tAassRL4RSQL">data directory</a>.</p><h2>Demo Notes</h2><p>When you run Trilium for the first time, it will generate a new database containing demo notes. These notes showcase its many features, such as:</p><ul><li><a href="#root/iRwzGnHPzonm">Relation Map</a></li><li><a href="#root/l0tKav7yLHGF">Day Notes</a></li><li><a href="#root/R7abl2fc6Mxi">Weight Tracker</a></li><li><a href="#root/xYjQUYhpbUEW">Task Manager</a></li><li><a href="#root/Wy267RK4M69c">Custom CSS Themes</a></li></ul><h3>Restoring Demo Notes</h3><p>There are some cases in which you may want to restore the original demo notes. For example, if you experimented with some of the more advanced features and want to see the original reference, or if you simply want to explore the latest version of the demo notes, which might showcase new features.</p><p>You can easily restore the demo notes by using Trilium's built-in import feature by importing them:</p><ul><li>Download <a href="https://github.com/TriliumNext/Notes/raw/develop/db/demo.zip">this .zip archive</a> with the latest version of the demo notes</li><li>Right click on any note in your tree under which you would like the demo notes to be imported</li><li>Click "Import into note"</li><li>Select the .zip archive to import it</li></ul><h2>Manually Modifying the Database</h2><p>Trilium provides a lot of flexibility, and with it, opportunities for advanced users to tweak it. If you need to explore or modify the database directly, you can use a tool such as <a href="https://sqlitebrowser.org/">SQLite Browser</a> to work directly on the database file.</p><p>If you are doing any advanced development or troubleshooting where you manually modify the database, you might want to consider creating backups of your <code>document.db</code> file.</p><h2>How to Reset the Database</h2><p>If you are experimenting with Trilium and want to return it to its original state, you can do that by deleting the current database. When you restart the application, it will generate a new database containing the original demo notes.</p><p>To delete the database, simply go to the <a href="#root/tAassRL4RSQL">data directory</a> and delete the <code>document.db</code> file (and any other files starting with <code>document.db</code>).</p><p>If you do not need to preserve any configurations that might be stored in the <code>config.ini</code> file, you can just delete all of the <a href="#root/tAassRL4RSQL">data directory's</a> contents to fully restore the application to its original state. You can also review the <a href="#root/Gzjqa934BdH4">configuration</a> file to provide all <code>config.ini</code> values as environment variables instead.</p>


blobId: SvXuUmhGZEJNiRfYCX3x
dateModified: 2025-03-09 11:08:32.060+0200
utcDateModified: 2025-03-09 09:08:32.060Z
content:
  <p>A common pattern in note-taking is that a lot of notes will be centered around a certain date - e.g. you have some tasks which needs to be done on a certain date, you have meeting minutes from a certain date, you have your thoughts etc. and it all revolves around a date on which they occurred. For this reason, it makes sense to create a certain "day workspace" which will centralize all those notes relevant for a certain date.</p><p>For this, Trilium provides a concept of "day note". Trilium semi-automatically generates a single note for each day. Under this note you can save all those relevant notes.</p><p>Select an existing day note, and the menubar contains a calendar widget. Select any day to create a note for that day. <img src="api/images/BvoF8mgyC7OD/Day-notes image.png" alt="image"></p><p>This pattern works well also because of [[cloning|Cloning notes]] functionality - note can appear in multiple places in the note tree, so besides appearing under day note, it can also be categorized into other notes.</p><h2>Demo</h2><p><img src="api/images/nQf1irAyZrZl/day-notes.png" alt=""></p><p>You can see the structure of day notes appearing under "Journal" note - there's a note for the whole year 2017, under it, you have "12 - December" which then contains "18 - Monday". This is our "day note" which contains some text in its content and also has some child notes (some of them are from <a href="#root/xYjQUYhpbUEW">Task manager</a>).</p><p>You can also notice how this day note has <a href="#root/OFXdgB2nNk1F">promoted attribute</a> "weight" where you can track your daily weight. This data is then used in <a href="#root/R7abl2fc6Mxi">Weight tracker</a>.</p><h2>Templates</h2><p>Trilium provides <a href="#root/KC1HB96bqqHX">template</a> functionality, and it could be used together with day notes.</p><p>You can define one of the following relations on the root of the journal (identified by <code>#calendarRoot</code> label):</p><ul><li>yearTemplate</li><li>monthTemplate</li><li>dateTemplate</li></ul><p>All of these are relations. When Trilium creates a new note for year or month or date, it will take a look at the root and attach a corresponding <code>~template</code> relation to the newly created role. Using this, you can e.g. create your daily template with e.g. checkboxes for daily routine etc.</p><h2>Date pattern</h2><p>It's possible to customize the title of generated date notes by defining a <code>#datePattern</code> label on a root calendar note (identified by <code>#calendarRoot</code> label). Following are possible values:</p><ul><li><code>{dayInMonthPadded} - {weekDay}</code> day notes are named e.g. "24 - Monday"</li><li><code>{dayInMonthPadded}: {weekDay3}</code> day notes are named e.g. "24: Mon"</li><li><code>{dayInMonthPadded}: {weekDay2}</code> day notes are named e.g. "24: Mo"</li><li><code>{isoDate} - {weekDay}</code> day notes are named e.g. "2020-12-24 - Monday"</li><li><code>{ordinal}</code> is replaced with the ordinal date (e.g. 1st, 2nd, 3rd) etc.</li></ul><h2>Month pattern</h2><p>It is also possible to customize the title of generated month notes through the <code>#monthPattern</code> attribute, much like <code>#datePattern</code>. The options are:</p><ul><li><code>{monthNumberPadded}</code> results in a number like <code>09</code> for September, and <code>11</code> for November</li><li><code>{month}</code> results in the full month name (e.g. <code>September</code> or <code>October</code>)</li><li><code>{shortMonth3}</code> is replaced with the first 3 letters of the month, e.g. Jan, Feb, etc.</li><li><code>{shortMonth4}</code> is replaced with the first 4 letters of the month, e.g. Sept, Octo, etc.</li></ul><p>The default is <code>{monthNumberPadded} - {month}</code></p><h2>Implementation</h2><p>Trilium has some special support for day notes in the form of <a href="https://triliumnext.github.io/Notes/backend_api/BackendScriptApi.html">backend Script API</a> - see e.g. getDayNote() function.</p><p>Day (and year, month) notes are created with a label - e.g. <code>#dateNote="2018-08-16"</code> this can then be used by other scripts to add new notes to day note etc.</p><p>Journal also has relation <code>child:child:child:template=Day template</code> (see [[attribute inheritance]]) which effectively adds [[template]] to day notes (grand-grand-grand children of Journal).</p>


blobId: Tqqh5gxx7wtmdAMYj8PY
dateModified: 2025-03-09 11:08:48.183+0200
utcDateModified: 2025-03-09 09:08:48.183Z
content:
  <p>When a new note is created, its name is by default "new note". In some cases, it can be desirable to have a different or even a dynamic default note title.</p><p>For this use case, Trilium (since v0.52) supports <code>#titleTemplate</code> <a href="#root/zEY4DaJG4YT5">label</a>. You can create such a label for a given note, assign it a value, and this value will be used as a default title when creating child notes. As with other labels, you can make it inheritable to apply recursively, and you can even place it on the root note to have it applied globally everywhere.</p><p>As an example use case, imagine you collect books you've read in a given year like this:</p><ul><li>2022 Books<ul><li>Neal Stephenson: Anathem, 2008</li><li>Franz Kafka: Die Verwandlung, 1915</li></ul></li></ul><p>Now, to the parent note "2022 Books" you can assign label <code>#titleTemplate="[Author name]: [Book title], [Publication year]"</code>.</p><p>And all children of "2022 Books" will be created with initial title "[Author name]: [Book title], [Publication year]". There's no artificial intelligence here, the idea is to just prompt you to manually fill in the pieces of information into the note title by yourself.</p><h2>Dynamic value</h2><p>The value of <code>#titleTemplate</code> is evaluated at the point of note's creation as a JavaScript string, which means it can be enriched with the help of JS string interpolation with dynamic data.</p><p>As an example, imagine you collect server outage incidents and write some notes. It looks like this:</p><ul><li>Incidents<ul><li>2022-05-09: System crash</li><li>2022-05-15: Backup delay</li></ul></li></ul><p>You can automatize the date assignment by assigning a label <code>#titleTemplate="${now.format('YYYY-MM-DD')}: "</code> to the parent note "Incidents". Whenever a new child note is created, the title template is evaluated with the injected <a href="https://day.js.org/docs/en/display/format">now</a> object.</p><p>Second variable injected is <a href="https://triliumnext.github.io/Notes/backend_api/BNote.html">parentNote</a>, an example could be <code>#titleTemplate="${parentNote.getLabelValue('authorName')}'s literary works"</code>.</p><p>See also [[<a href="#root/KC1HB96bqqHX">template</a>]] which provides similar capabilities, including default note's content.</p>


blobId: cVkyHBbROF7TPYiYMkXT
dateModified: 2025-03-09 11:08:55.307+0200
utcDateModified: 2025-03-09 09:08:55.307Z
content:
  <p>To install Trilium on your desktop, follow these steps:</p><ol><li><strong>Download the Latest Release</strong>: Obtain the appropriate binary release for your operating system from the <a href="https://github.com/TriliumNext/Notes/releases/latest">latest release page</a> on GitHub.</li><li><strong>Extract the Package</strong>: Unzip the downloaded package to a location of your choice.</li><li><strong>Run the Application</strong>: Launch Trilium by executing the <code>trilium</code> executable found within the unzipped folder.</li></ol><h2>Startup Scripts</h2><p>Trilium offers various startup scripts to customize your experience:</p><ul><li><code><strong>trilium-no-cert-check</strong></code>: Starts Trilium without validating <a href="#root/l2VkvOwUNfZj">TLS certificates</a>, useful if connecting to a server with a self-signed certificate.<ul><li>Alternatively, set the <code>NODE_TLS_REJECT_UNAUTHORIZED=0</code> environment variable before starting Trilium.</li></ul></li><li><code><strong>trilium-portable</strong></code>: Launches Trilium in portable mode, where the <a href="#root/tAassRL4RSQL">data directory</a> is created within the application's directory, making it easy to move the entire setup.</li><li><code><strong>trilium-safe-mode</strong></code>: Boots Trilium in "safe mode," disabling any startup scripts that might cause the application to crash.</li></ul><h2>Synchronization</h2><p>For Trilium desktp users who wish to synchronize their data with a server instance, refer to the <a href="#root/cbkrhQjrkKrh">Synchronization Guide</a> for detailed instructions.</p>


blobId: So0qGGt2CKgd2yr7GXKC
dateModified: 2025-03-09 11:09:31.871+0200
utcDateModified: 2025-03-09 09:09:31.871Z
content:
  <p>Official docker images are published on docker hub for <strong>AMD64</strong>, <strong>ARMv7</strong> and <strong>ARM64/v8</strong>: <a href="https://hub.docker.com/r/triliumnext/notes/">https://hub.docker.com/r/triliumnext/notes/</a></p><h2>Prerequisites</h2><p>Ensure Docker is installed on your system.</p><p>If you need help installing Docker, reference the <a href="https://docs.docker.com/engine/install/">Docker Installation Docs</a></p><p><strong>Note:</strong> Trilium's Docker container requires root privileges to operate correctly.</p><blockquote><p>[!WARNING] If you're using a SMB/CIFS share or folder as your Trilium data directory, <a href="https://github.com/TriliumNext/Notes/issues/415#issuecomment-2344824400">you'll need</a> to add the mount options of <code>nobrl</code> and <code>noperm</code> when mounting your SMB share.</p></blockquote><h2>Running with Docker Compose</h2><h3>Grab the latest docker-compose.yml:</h3><pre><code class="language-text-x-trilium-auto">wget https://raw.githubusercontent.com/TriliumNext/Notes/master/docker-compose.yml</code></pre><p>Optionally, edit the <code>docker-compose.yml</code> file to configure the container settings prior to starting it. Unless configured otherwise, the data directory will be <code>~/trilium-data</code> and the container will be accessible at port 8080.</p><h3>Start the container:</h3><p>Run the following command to start the container in the background:</p><pre><code class="language-text-x-trilium-auto">docker compose up -d</code></pre><h2>Running without Docker Compose / Further Configuration</h2><h3>Pulling the Docker Image</h3><p>To pull the image, use the following command, replacing <code>[VERSION]</code> with the desired version or tag, such as <code>v0.91.6</code> or just <code>latest</code>. (See published tag names at <a href="https://hub.docker.com/r/triliumnext/notes/tags">https://hub.docker.com/r/triliumnext/notes/tags</a>.):</p><pre><code class="language-text-x-trilium-auto">docker pull triliumnext/notes:v0.91.6</code></pre><p><strong>Warning:</strong> Avoid using the "latest" tag, as it may automatically upgrade your instance to a new minor version, potentially disrupting sync setups or causing other issues.</p><h3>Preparing the Data Directory</h3><p>Trilium requires a directory on the host system to store its data. This directory must be mounted into the Docker container with write permissions.</p><h3>Running the Docker Container</h3><h4>Local Access Only</h4><p>Run the container to make it accessible only from the localhost. This setup is suitable for testing or when using a proxy server like Nginx or Apache.</p><pre><code class="language-text-x-trilium-auto">sudo docker run -t -i -p 127.0.0.1:8080:8080 -v ~/trilium-data:/home/node/trilium-data triliumnext/notes:[VERSION]</code></pre><ol><li>Verify the container is running using <code>docker ps</code>.</li><li>Access Trilium via a web browser at <code>127.0.0.1:8080</code>.</li></ol><h4>Local Network Access</h4><p>To make the container accessible only on your local network, first create a new Docker network:</p><pre><code class="language-text-x-trilium-auto">docker network create -d macvlan -o parent=eth0 --subnet 192.168.2.0/24 --gateway 192.168.2.254 --ip-range 192.168.2.252/27 mynet</code></pre><p>Then, run the container with the network settings:</p><pre><code class="language-text-x-trilium-auto">docker run --net=mynet -d -p 127.0.0.1:8080:8080 -v ~/trilium-data:/home/node/trilium-data triliumnext/notes:-latest</code></pre><p>To set a different user ID (UID) and group ID (GID) for the saved data, use the <code>USER_UID</code> and <code>USER_GID</code> environment variables:</p><pre><code class="language-text-x-trilium-auto">docker run --net=mynet -d -p 127.0.0.1:8080:8080 -e "USER_UID=1001" -e "USER_GID=1001" -v ~/trilium-data:/home/node/trilium-data triliumnext/notes:-latest</code></pre><p>Find the local IP address using <code>docker inspect [container_name]</code> and access the service from devices on the local network.</p><pre><code class="language-text-x-trilium-auto">docker ps
  docker inspect [container_name]</code></pre><h4>Global Access</h4><p>To allow access from any IP address, run the container as follows:</p><pre><code class="language-text-x-trilium-auto">docker run -d -p 0.0.0.0:8080:8080 -v ~/trilium-data:/home/node/trilium-data triliumnext/notes:[VERSION]</code></pre><p>Stop the container with <code>docker stop &lt;CONTAINER ID&gt;</code>, where the container ID is obtained from <code>docker ps</code>.</p><h3>Custom Data Directory</h3><p>For a custom data directory, use:</p><pre><code class="language-text-x-trilium-auto">-v ~/YourOwnDirectory:/home/node/trilium-data triliumnext/notes:[VERSION]</code></pre><p>If you want to run your instance in a non-default way, please use the volume switch as follows: <code>-v ~/YourOwnDirectory:/home/node/trilium-data triliumnext/notes:&lt;VERSION&gt;</code>. It is important to be aware of how Docker works for volumes, with the first path being your own and the second the one to virtually bind to. <a href="https://docs.docker.com/storage/volumes/">https://docs.docker.com/storage/volumes/</a> The path before the colon is the host directory, and the path after the colon is the container's path. More details can be found in the <a href="https://docs.docker.com/storage/volumes/">Docker Volumes Documentation</a>.</p><h2>Reverse Proxy</h2><ol><li><a href="#root/ud6MShXL4WpO">Nginx</a></li><li><a href="#root/fDLvzOx29Pfg">Apache</a></li></ol><h3>Note on --user Directive</h3><p>The <code>--user</code> directive is unsupported. Instead, use the <code>USER_UID</code> and <code>USER_GID</code> environment variables to set the appropriate user and group IDs.</p><h3>Note on timezones</h3><p>If you are having timezone issues and you are not using docker-compose, you may need to add a <code>TZ</code> environment variable with the <a href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones">TZ identifier</a> of your local timezone.</p>


blobId: 2AAnEbpMAE8dThIXJruf
dateModified: 2025-03-09 11:09:38.146+0200
utcDateModified: 2025-03-09 09:09:38.146Z
content:
  <p>It's important to provide all available error logs together with bug reports. This page will show you how to do it.</p><h2>Backend logs</h2><p>Open <a href="#root/tAassRL4RSQL">data directory</a>, go to <code>log</code> subdirectory and find the latest log file, e.g. <code>trilium-2022-12-14.log</code>. You can attach the whole file to the bug report (preferable) or open it and copy-paste only the last lines / lines you believe are relevant.</p><p>If you have trouble finding it the log files, there's also an in-app option in top-left menu button -&gt; Advanced -&gt; Show backend log.</p><h2>Frontend logs</h2><p>To provide frontend logs, we need to open the Developer Console. Often the easiest way is to press <code>CTRL-SHIFT-I</code> which should work in most browsers (and desktop app). Make sure that the error producing action happened right before you copy&amp;paste the errors, the console is cleared on app restart.</p><p>If that doesn't work, then:</p><ul><li>in Trilium desktop app, go to top-left menu button -&gt; Advanced -&gt; Open Dev Tools</li><li>In Firefox/Chrome right-click anywhere in the page and click Inspect:</li></ul><p><img src="api/images/zIQ1XGaUbB7i/error-logs-firefox-context-men.png" alt=""></p><p>Once you have Dev Tools open, click on "Console" tab:</p><p><img src="api/images/UPZGQ7wKiLIn/error-logs-dev-tools.png" alt=""></p><p>Copy-paste (or screenshot) the logs. It's better to provide not just errors, but the whole log, which might provide context while analyzing the bug.</p><h2>Providing sensitive data</h2><p>If you don't feel comfortable attaching the logs or anything sensitive to the public GitHub issues, feel free to contact the devs in our Matrix <a href="https://github.com/TriliumNext/Notes#-discuss-with-us">support channel</a>.</p><p>Use this email to also provide anything which could assist in analysing the bug - e.g. files/images/ZIPs being imported or <a href="#root/x59R8J8KV5Bp">anonymized database</a>.</p><h3>Exporting note subtree for reproduction</h3><p>Often times, bugs manifest themselves in specific notes and having them would greatly ease reproduction and fixing.</p><p>In such case, please export the relevant note subtree by right-clicking it on the left tree, choosing Export - HTML as ZIP:</p><p><img src="api/images/v8H3fXMFPki0/error-logs-export-subtree.png" alt=""></p>


blobId: lyTrmYqXycMhjEi7p3yg
dateModified: 2025-03-09 11:09:40.944+0200
utcDateModified: 2025-03-09 09:09:40.944Z
content:
  <p>ETAPI is Trilium's public/external REST API. It is available since Trilium v0.50.</p><p>The documentation is in OpenAPI format, available <a href="https://github.com/TriliumNext/Notes/blob/master/src/etapi/etapi.openapi.yaml">here</a>.</p><p><a href="https://github.com/Nriver/trilium-py">trilium-py</a> is a third-party Python implementation for ETAPI client, you can use Python to communicate with Trilium.</p><h2>Authentication</h2><p>All operations have to be authenticated using a token. You can get this token either from Options -&gt; ETAPI or programmatically using the <code>/auth/login</code> REST call (see the <a href="https://github.com/TriliumNext/Notes/blob/master/src/etapi/etapi.openapi.yaml">spec</a>):</p><pre><code class="language-text-x-trilium-auto">GET https://myserver.com/etapi/app-info
  Authorization: ETAPITOKEN</code></pre><p>Alternatively, since 0.56 you can also use basic auth format:</p><pre><code class="language-text-x-trilium-auto">GET https://myserver.com/etapi/app-info
  Authorization: Basic BATOKEN</code></pre><ul><li>Where <code>BATOKEN = BASE64(username + ':' + password)</code> - this is a standard Basic Auth serialization</li><li>Where <code>username</code> is "etapi"</li><li>And <code>password</code> is the generated ETAPI token described above.</li></ul><p>Basic Auth is meant to be used with tools which support only basic auth.</p>


blobId: JSVCb6RzMaEUaiYxw3Td
dateModified: 2025-03-09 11:09:44.774+0200
utcDateModified: 2025-03-09 09:09:44.774Z
content:
  <p><a href="#root/CdNpE2pqjmI6">Script</a> notes can be triggered by events. Note that these are backend events and thus relation need to point to the "JS backend" code note.</p><h2>Global events</h2><p>Global events are attached to the script note via label. Simply create e.g. "run" label with some of these values and script note will be executed once the event occurs.</p><ul><li><code>run</code><ul><li><code>frontendStartup</code> - executes on frontend upon startup</li><li><code>mobileStartup</code> - executes on mobile frontend upon startup</li><li><code>backendStartup</code> - executes on backend upon startup</li><li><code>hourly</code> - executes once an hour on backend</li><li><code>daily</code> - executes once a day on backend</li></ul></li></ul><h2>Entity events</h2><p>Other events are bound to some entity, these are defined as <a href="#root/zEY4DaJG4YT5">relations</a> - meaning that script is triggered only if note has this script attached to it through relations (or it can inherit it).</p><ul><li><code>runOnNoteCreation</code> - executes when note is created on backend</li><li><code>runOnNoteTitleChange</code> - executes when note title is changed (includes note creation as well)</li><li><code>runOnNoteContentChange</code> - executes when note content is changed (includes note creation as well).</li><li><code>runOnNoteChange</code> - executes when note is changed (includes note creation as well)</li><li><code>runOnNoteDeletion</code> - executes when note is being deleted</li><li><code>runOnBranchCreation</code> - executes when a branch is created. Branch is a link between parent note and child note and is created e.g. when cloning or moving note.</li><li><code>runOnBranchChange</code> (since v0.62) - executes when a branch is changed - either expanded status or prefix are changed.</li><li><code>runOnBranchDeletion</code> - executes when a branch is delete. Branch is a link between parent note and child note and is deleted e.g. when moving note (old branch/link is deleted).</li><li><code>runOnChildNoteCreation</code> - executes when new note is created under <i>this</i> note</li><li><code>runOnAttributeCreation</code> - executes when new attribute is created under <i>this</i> note</li><li><code>runOnAttributeChange</code> - executes when attribute is changed under <i>this</i> note</li></ul>


blobId: W3EmcWofLeyfic3nOpo6
dateModified: 2025-03-09 11:09:53.802+0200
utcDateModified: 2025-03-09 09:09:53.803Z
content:
  <p>Trilium can import ENEX files which are used by Evernote for backup/export. One ENEX file represents content (notes and resources) of one notebook.</p><h2>Export ENEX from Evernote</h2><p>To export ENEX file, you need to have a <i>legacy</i> desktop version of Evernote (i.e. not web/mobile). Right click on notebook and select export and follow the wizard.</p><h2>Import ENEX in Trilium</h2><p>Once you have ENEX file, you can import it to Trilium. Right click on some note (to which you want to import the file), click on "Import" and select the ENEX file.</p><p>After importing the ENEX file, go over the imported notes and resources to be sure the import went well, and you didn't lose any data.</p><h2>Limitations</h2><p>All resources (except for images) are created as note's attachments.</p><p>HTML inside ENEX files is not exactly valid so some formatting maybe broken or lost. You can report major problems into <a href="https://github.com/TriliumNext/Notes/issues">Trilium issue tracker</a>. %%{WARNING}%%</p>


blobId: mdO4BkYo4lRKzuZy9UMr
dateModified: 2025-03-09 11:09:58.847+0200
utcDateModified: 2025-03-09 09:09:58.848Z
content:
  <h2>Mac OS support</h2><p>Originally, desktop builds of Trilium Notes has been available for Windows &amp; Linux, but there has been a considerable demand for macOS build.</p><p>So I made one, but I underestimated the differences and specifics of Mac platform which seems to require special handling in several places. My lack of knowledge and frankly willingness to learn &amp; code Mac specific functionality resulted in a current state where <a href="https://github.com/TriliumNext/Notes/issues/511">Trilium does not integrate well into the OS</a> %%{WARNING}%%.</p><p>macOS build is from now on considered "unsupported". I will strive to keep it fundamentally functional, but I won't work on Mac specific features or integrations. Note that this is more of an acknowledgment of an existing state rather than sudden change of direction.</p><p>Of course, PRs are welcome.</p><h2>Translation / localization support</h2><p>Trilium is currently available only in English. Translation to other languages is not planned in the near/medium term because it brings a significant maintenance overhead. This decision might be revisited once Trilium stabilizes into a more mature product.</p><p>For Chinese, there's an unofficial fork <a href="https://github.com/Nriver/trilium-translation">here</a>. Use at your own risk.</p><h2>Multi user support</h2><p>Common request is to allow multiple users collaborate, share notes etc. So far I'm resisting this because of these reasons:</p><ul><li>it's a huge feature, or rather a Pandora's box of collaboration features like user management, permissions, conflict resolution, real-time editing of a note by multiple people etc. This would be a huge amount of work. Trilium Notes is project made mostly by one person in free time and that's unlikely to change in the future.</li><li>given its size it would probably pivot the attention away from my main focus which is a personal note-taking</li><li>the assumption that only single person has access to the app simplifies many things, or just outright makes them possible. In multi-user app, our <a href="#root/CdNpE2pqjmI6">scripting</a> support would be a XSS security hole, while with the single user assumption it's an endless customizable tool.</li></ul><h2>How to open multiple documents in one Trilium instance</h2><p>This is normally not supported - one Trilium process can open only a single instance of a <a href="#root/wX4HbRucYSDD">database</a>. However, you can run two Trilium processes (from one installation), each connected to a separate document. To achieve this, you need to set a location for the <a href="#root/tAassRL4RSQL">data directory</a> in the <code>TRILIUM_DATA_DIR</code> environment variable and separate port on <code>TRILIUM_PORT</code> environment variable. How to do that depends on the platform, in Unix-based systems you can achieve that by running command such as this:</p><pre><code class="language-text-x-trilium-auto">TRILIUM_DATA_DIR=/home/me/path/to/data/dir TRILIUM_PORT=12345 trilium </code></pre><p>You can save this command into a <code>.sh</code> script file or make an alias. Do this similarly for a second instance with different data directory and port.</p><h2>Can I use Dropbox / Google Drive / OneDrive to sync data across multiple computers.</h2><p>No.</p><p>These general purpose sync apps are not suitable to sync database files which are open and being worked on by another application. The result is that they will corrupt the database file, resulting in data loss and this message in the Trilium logs:</p><blockquote><p>SqliteError: database disk image is malformed</p></blockquote><p>The only supported way to sync Trilium's data across the network is to use a <a href="#root/cbkrhQjrkKrh">sync/web server</a>.</p><h2>Why database instead of flat files?</h2><p>Trilium stores notes in a <a href="#root/wX4HbRucYSDD">database</a> which is an SQLite database. People often ask why doesn't Trilium rather use flat files for note storage - it's fair question since flat files are easily interoperable, work with SCM/git etc.</p><p>Short answer is that file systems are simply not powerful enough for what we want to achieve with Trilium. Using filesystem would mean fewer features with probably more problems.</p><p>More detailed answer:</p><ul><li><a href="#root/IakOLONlIfGI">clones</a> are what you might call "hard directory link" in filesystem lingo, but this concept is not implemented in any filesystem</li><li>filesystems make a distinction between directory and file while there's intentionally no such difference in Trilium</li><li>files are stored in no particular order and user can't change this</li><li>Trilium allows storing note <a href="#root/zEY4DaJG4YT5">attributes</a> which could be represented in extended user attributes but their support differs greatly among different filesystems / operating systems</li><li>Trilium makes links / relations between different notes which can be quickly retrieved / navigated (e.g. for <a href="#root/BCkXAVs63Ttv">note map</a>). There's no such support in file systems which means these would have to be stored in some kind of side-car files (mini-databases).</li><li>Filesystems are generally not transactional. While this is not completely required for a note-taking application, having transactions make it way easier to keep notes and their metadata in predictable and consistent state.</li></ul>


blobId: aK3l7FIEhw52NtlIS3zf
dateModified: 2025-03-09 11:10:07.829+0200
utcDateModified: 2025-03-09 09:10:07.829Z
content:
  <h2>Frontend API</h2><p>The frontend api supports two styles, regular scripts that are run with the current app and note context, and widgets that export an object to Trilium to be used in the UI. In both cases, the frontend api of Trilium is available to scripts running in the frontend context as global variable <code>api</code>. The members and methods of the api can be seen on the <a href="#root/GLks18SNjxmC">Script API</a> page.</p><h2>Scripts</h2><p>Scripts don't have any special requirements. They can be run at will using the execute button in the UI or they can be configured to run at certain times using <a href="#root/zEY4DaJG4YT5">Attributes</a> on the note containing the script.</p><h3>Global Events</h3><p>This attribute is called <code>#run</code> and it can have any of the following values:</p><ul><li><code>frontendStartup</code> - executes on frontend upon startup.</li><li><code>mobileStartup</code> - executes on mobile frontend upon startup.</li><li><code>backendStartup</code> - executes on backend upon startup.</li><li><code>hourly</code> - executes once an hour on backend.</li><li><code>daily</code> - executes once a day on backend.</li></ul><h3>Entity Events</h3><p>These events are triggered by certain <a href="#root/zEY4DaJG4YT5">relations</a> to other notes. Meaning that the script is triggered only if the note has this script attached to it through relations (or it can inherit it).</p><ul><li><code>runOnNoteCreation</code> - executes when note is created on backend.</li><li><code>runOnNoteTitleChange</code> - executes when note title is changed (includes note creation as well).</li><li><code>runOnNoteContentChange</code> - executes when note content is changed (includes note creation as well).</li><li><code>runOnNoteChange</code> - executes when note is changed (includes note creation as well).</li><li><code>runOnNoteDeletion</code> - executes when note is being deleted.</li><li><code>runOnBranchCreation</code> - executes when a branch is created. Branch is a link between parent note and child note and is created e.g. when cloning or moving note.</li><li><code>runOnBranchDeletion</code> - executes when a branch is delete. Branch is a link between parent note and child note and is deleted e.g. when moving note (old branch/link is deleted).</li><li><code>runOnChildNoteCreation</code> - executes when new note is created under this note.</li><li><code>runOnAttributeCreation</code> - executes when new attribute is created under this note.</li><li><code>runOnAttributeChange</code> - executes when attribute is changed under this note.</li></ul><h2>Widgets</h2><p>Conversely to scripts, widgets do have some specific requirements in order to work. A widget must:</p><ul><li>Extend <a href="https://triliumnext.github.io/Notes/frontend_api/BasicWidget.html">BasicWidget</a> or one of it's subclasses.</li><li>Create a new instance and assign it to <code>module.exports</code>.</li><li>Define a <code>parentWidget</code> member to determine where it should be displayed.</li><li>Define a <code>position</code> (integer) that determines the location via sort order.</li><li>Have a <code>#widget</code> attribute on the containing note.</li><li>Create, render, and return your element in the render function.<ul><li>For <a href="https://triliumnext.github.io/Notes/frontend_api/BasicWidget.html">BasicWidget</a> and <a href="https://triliumnext.github.io/Notes/frontend_api/NoteContextAwareWidget.html">NoteContextAwareWidget</a> you should create <code>this.$widget</code> and render it in <code>doRender()</code>.</li><li>For <a href="https://triliumnext.github.io/Notes/frontend_api/RightPanelWidget.html">RightPanelWidget</a> the <code>this.$widget</code> and <code>doRender()</code> are already handled and you should instead return the value in <code>doRenderBody()</code>.</li></ul></li></ul><h3>parentWidget</h3><ul><li><code>left-pane</code> - This renders the widget on the left side of the screen where the note tree lives.</li><li><code>center-pane</code> - This renders the widget in the center of the layout in the same location that notes and splits appear.</li><li><code>note-detail-pane</code> - This renders the widget <i>with</i> the note in the center pane. This means it can appear multiple times with splits.</li><li><code>right-pane</code> - This renders the widget to the right of any opened notes.</li></ul><h3>Tutorial</h3><p>For more information on building widgets, take a look at <a href="#root/SynTBQiBsdYJ">Widget Basics</a>.</p>


blobId: jUOOGKz1cj5kdn3JiuwR
dateModified: 2025-03-09 11:10:18.996+0200
utcDateModified: 2025-03-09 09:10:18.997Z
content:
  <h2>Overview</h2><p>Basic overview of the Trilium project is available at project homepage - <a href="https://github.com/triliumnext/notes#trilium-notes">https://github.com/triliumnext/notes#trilium-notes</a></p><p>Inspiration for the name "Trilium":</p><blockquote><p>Naming software is hard. I lived in Ontario when I first started the project and Trillium (the flower) is sort of a provincial logo, many institutions in Ontario are named "Trillium [something]". So I kept hearing/reading it almost everyday, I liked the sound of it and its nature motif, so I just reused it.</p></blockquote><blockquote><p>~ Zadam (Trilium Developer)</p></blockquote><h2>Documentation</h2><p>This <a href="https://github.com/TriliumNext/Notes/wiki">wiki</a> %%{WARNING}%% contains additional and more in-depth information on some topics. See the sidebar for listing of all available pages.</p><h2>Quick Start</h2><h2>Choose the setup</h2><p><strong>Local only desktop/laptop</strong> - Allows a single instance on a desktop and will save the notes locally on that desktop.</p><ol><li><a href="#root/poXkQfguuA0U">Desktop installation</a></li></ol><p><strong>Server with web only access</strong> - Installs the application on the server and allows access from any web browser on any device, including mobile.</p><ol><li><a href="#root/WOcw2SLH6tbX">Server installation</a></li><li><a href="#root/RDslemsQ6gCp">Mobile frontend</a> (optional)</li><li><a href="https://heroku.com/deploy?template=https://github.com/feilongfl/trilium-heroku"><img src="api/images/B0kIDkK5rnIf/Home button.svg" alt="Deploy"></a></li><li><a href="https://www.pikapods.com/pods?run=trilium-next">PikaPods managed hosting</a></li></ol><p><strong>Combination of server and desktop/laptop</strong> - Install the application on both a server, for web access and data synchronization, and desktop instance(s). This allows all the data to be stored on the server and either accessed from the web browser, or the desktop application. The desktop application will sync and store the data locally so that it can be used when offline.</p><ol><li><a href="#root/WOcw2SLH6tbX">Server installation</a></li><li><a href="#root/RDslemsQ6gCp">Mobile frontend</a> (optional)</li><li><a href="#root/poXkQfguuA0U">Desktop installation</a></li><li><a href="#root/cbkrhQjrkKrh">Synchronization</a></li></ol><h2>Basic concepts</h2><ol><li>Understand <a href="#root/BFs8mudNFgCS">Note</a></li><li>Watch the <a href="#root/lD2Qh6zp8k4d">Screenshot tour</a></li></ol>


blobId: ixEpdAbLnyxbLhsnImOb
dateModified: 2025-03-09 11:10:30.622+0200
utcDateModified: 2025-03-09 09:10:30.622Z
content:
  <p>To import these docs into your own Trilium instance:</p><ol><li>Download archive from main branch of this repo: <a href="https://github.com/TriliumNext/Docs/archive/refs/heads/main.zip">https://github.com/TriliumNext/Docs/archive/refs/heads/main.zip</a></li><li>In Trilim create a new note to act as branch for the docs</li><li>Right-click on the note, select "Import into note" and select downloaded <code>Docs-main.zip</code> file.<ul><li>Optionally uncheck "Shrink images"</li></ul></li></ol><h2>Optional cleanup</h2><ul><li>delete <code>!!!meta.json</code></li><li>Move <code>images</code> node down to the bottom (instead of dragging, it's easier to move out to parent node than back into Wiki. It will go to end of list automatically).</li></ul><p>For new releases delete the old docs note tree and start fresh, or you'll get duplicates.</p>


blobId: vlniRnDQ2sXoV04JgtN7
dateModified: 2025-03-09 11:10:34.738+0200
utcDateModified: 2025-03-09 09:10:34.738Z
content:
  <p>This is supposed to be a complete list of keyboard shortcuts. Note that some of these may work only in certain contexts (e.g. in tree pane or note editor).</p><p>It is also possible to configure most keyboard shortcuts in Options -&gt; Keyboard shortcuts. Using <code>global:</code> prefix, you can assign a shortcut which will work even without Trilium being in focus (requires app restart to take effect).</p><h2>Note navigation</h2><ul><li><code>UP</code>, <code>DOWN</code> - go up/down in the list of notes, <code>CTRL-SHIFT-UP</code> and <code>CTRL-SHIFT-DOWN</code> work also from editor</li><li><code>LEFT</code>, <code>RIGHT</code> - collapse/expand node</li><li><code>ALT+LEFT</code>, <code>ALT+RIGHT</code> - go back / forwards in the history</li><li><code>CTRL+J</code> - show <a href="#root/MMiBEQljMQh2">"Jump to" dialog</a></li><li><code>CTRL+.</code> - scroll to current note (useful when you scroll away from your note or your focus is currently in the editor)</li><li><code>BACKSPACE</code> - jumps to parent note</li><li><code>ALT+C</code> - collapse whole note tree</li><li><code>ALT+-</code> (alt with minus sign) - collapse subtree (if some subtree takes too much space on tree pane you can collapse it)</li><li>you can define a <a href="#root/zEY4DaJG4YT5">label</a> <code>#keyboardShortcut</code> with e.g. value <code>Ctrl+I</code>. Pressing this keyboard combination will then bring you to the note on which it is defined. Note that Trilium must be reloaded/restarted (Ctrl+R) for changes to be in effect.</li></ul><p>See demo of some of these features in <a href="#root/MMiBEQljMQh2">note navigation</a>.</p><h2>Tabs</h2><ul><li><code>CTRL+click</code> - (or middle mouse click) on note link opens note in a new tab</li></ul><p>Only in desktop (electron build):</p><ul><li><code>CTRL+T</code> - opens empty tab</li><li><code>CTRL+W</code> - closes active tab</li><li><code>CTRL+Tab</code> - activates next tab</li><li><code>CTRL+Shift+Tab</code> - activates previous tab</li></ul><h2>Creating notes</h2><ul><li><code>CTRL+O</code> - creates new note after the current note</li><li><code>CTRL+P</code> - creates new sub-note into current note</li><li><code>F2</code> - edit <a href="#root/MMiBEQljMQh2">prefix</a> of current note clone</li></ul><h2>Moving / cloning notes</h2><ul><li><code>CTRL+UP</code>, <code>CTRL+DOWN</code> - move note up/down in the note list</li><li><code>CTRL+LEFT</code> - move note up in the note tree</li><li><code>CTRL+RIGHT</code> - move note down in the note tree</li><li><code>SHIFT+UP</code>, <code>SHIFT+DOWN</code> - multi-select note above/below</li><li><code>CTRL+A</code> - select all notes in the current level</li><li><code>SHIFT+click</code> - multi select note which you clicked on</li><li><code>CTRL+C</code> - copies current note (or current selection) into clipboard (used for <a href="#root/IakOLONlIfGI">cloning</a></li><li><code>CTRL+X</code> - cuts current (or current selection) note into clipboard (used for moving notes)</li><li><code>CTRL+V</code> - pastes note(s) as sub-note into current note (which is either move or clone depending on whether it was copied or cut into clipboard)</li><li><code>DEL</code> - delete note / sub-tree</li></ul><h2>Editing notes</h2><p>Trilium uses CKEditor 5 for the <a href="#root/iPIMuisry3hd">text notes</a> and CodeMirror 5 for <a href="#root/6f9hih2hXXZk">code notes</a>. Check the documentation of these projects to see all their built-in keyboard shortcuts.</p><ul><li><code>ALT-F10</code> - bring up inline formatting toolbar (arrow keys <code>&lt;-</code>,<code>-&gt;</code> to navigate, <code>ENTER</code> to apply)</li><li><code>ALT-F10</code> - again to bring up block formatting toolbar</li><li><code>ENTER</code> in tree pane switches from tree pane into note title. Enter from note title switches focus to text editor. <code>CTRL+.</code> switches back from editor to tree pane.</li><li><code>CTRL+K</code> - create / edit <a href="#root/QEAPj01N5f7w">external link</a></li><li><code>CTRL+L</code> - create <a href="#root/QEAPj01N5f7w">internal (note) link</a></li><li><code>ALT+T</code> - inserts current date and time at caret position</li><li><code>CTRL+.</code> - jump away from the editor to tree pane and scroll to current note</li></ul><h2>Runtime shortcuts</h2><p>These are hooked in Electron to be similar to native browser keyboard shortcuts.</p><ul><li><code>F5</code>, <code>CTRL-R</code> - reloads trilium frontend</li><li><code>CTRL+SHIFT+I</code> - show developer tools</li><li><code>CTRL+F</code> - show search dialog</li><li><code>CTRL+-</code> - zoom out</li><li><code>CTRL+=</code> - zoom in</li></ul><h2>Other</h2><ul><li><code>ALT+O</code> - show SQL console (use only if you know what you're doing)</li><li><code>ALT+M</code> - distraction-free mode - display only note editor, everything else is hidden</li><li><code>F11</code> - toggle full screen</li><li><code>CTRL+S</code> - toggle <a href="#root/eIg8jdvaoNNd">search</a> form in tree pane</li><li><code>ALT+A</code> - show note <a href="#root/zEY4DaJG4YT5">attributes</a> dialog</li></ul>


blobId: dDXxHPQgNHiobp4BCRbY
dateModified: 2025-03-09 11:10:43.824+0200
utcDateModified: 2025-03-09 09:10:43.824Z
content:
  <p>As Trilium can be run in Docker it also can be deployed in Kubernetes. You can either use our Helm chart, a community Helm chart, or roll your own Kubernetes deployment.</p><p>The recommended way is to use a Helm chart.</p><h2>Root privileges</h2><blockquote><p>[!NOTE]<br>The Trilium container at this time needs to be run with root privileges. It will swap to UID and GID <code>1000:1000</code> to run the <code>node</code> process after execution though, so the main process doesn't run with root privileges.</p></blockquote><p>The Trilium docker container needs to be run with root privileges. The node process inside the container will be started with reduced privileges (uid:gid 1000:1000) after some initialization logic. Please make sure that you don't use a security context (PodSecurityContext) which changes the user ID. To use a different uid:gid for file storage and the application, please use the <code>USER_UID</code> &amp; <code>USER_GID</code> environment variables.</p><p>The docker image will also fix the permissions of <code>/home/node</code> so you don't have to use an init container.</p><h2>Helm Charts</h2><p><a href="https://github.com/TriliumNext/helm-charts">Official Helm chart</a> from TriliumNext Unofficial helm chart by <a href="https://github.com/ohdearaugustin">ohdearaugustin</a>: <a href="https://github.com/ohdearaugustin/charts">https://github.com/ohdearaugustin/charts</a></p><h2>Adding a Helm repository</h2><p>Below is an example of how</p><pre><code class="language-text-x-trilium-auto">helm repo add trilium https://triliumnext.github.io/helm-charts
  "trilium" has been added to your repositories</code></pre><h2>How to install a chart</h2><p>After reviewing the <a href="https://github.com/TriliumNext/helm-charts/blob/main/charts/trilium/values.yaml"><code>values.yaml</code></a> from the Helm chart, modifying as required and then creating your own:</p><pre><code class="language-text-x-trilium-auto">helm install --create-namespace --namespace trilium trilium trilium/trilium -f values.yaml</code></pre><p>For more information on using Helm, please refer to the Helm documentation, or create a Discussion in the TriliumNext GitHub Organization.</p>


blobId: In45hJLl2GywfaRMHGHG
dateModified: 2025-03-09 11:11:23.800+0200
utcDateModified: 2025-03-09 09:11:23.800Z
content:
  <ul class="todo-list"><li><label class="todo-list__label"><input type="checkbox" disabled="disabled"><span class="todo-list__label__description">Integrate titles of the notes</span></label></li><li><label class="todo-list__label"><input type="checkbox" checked="checked" disabled="disabled"><span class="todo-list__label__description">Set <code>#shareAlias</code> for all the notes</span></label></li><li><label class="todo-list__label"><input type="checkbox" disabled="disabled"><span class="todo-list__label__description">Recreate structure of notes</span></label></li><li><label class="todo-list__label"><input type="checkbox" disabled="disabled"><span class="todo-list__label__description">Merge images into their corresponding notes</span></label></li><li><label class="todo-list__label"><input type="checkbox" disabled="disabled"><span class="todo-list__label__description">Review and delete each note from Pikapod</span></label></li></ul><hr><p>Broken images:</p><ul class="todo-list"><li><label class="todo-list__label"><input type="checkbox" disabled="disabled"><span class="todo-list__label__description"><a class="reference-link" href="#root/krkLW8AwcYf2/fKYGY3OOo5d1">Canvas Note</a></span></label></li><li><label class="todo-list__label"><input type="checkbox" disabled="disabled"><span class="todo-list__label__description"><a class="reference-link" href="#root/krkLW8AwcYf2/l0tKav7yLHGF">Day notes</a></span></label></li><li><label class="todo-list__label"><input type="checkbox" disabled="disabled"><span class="todo-list__label__description"><a class="reference-link" href="#root/krkLW8AwcYf2/aCE9SFyzUrod">Home</a></span></label></li></ul><p>Content changes:</p><ul class="todo-list"><li><label class="todo-list__label"><input type="checkbox" disabled="disabled"><span class="todo-list__label__description"><a class="reference-link" href="#root/krkLW8AwcYf2/poXkQfguuA0U">Desktop Installation Guide</a></span></label><ul class="todo-list"><li><label class="todo-list__label"><input type="checkbox" disabled="disabled"><span class="todo-list__label__description">Mention Windows installation.</span></label></li><li><label class="todo-list__label"><input type="checkbox" disabled="disabled"><span class="todo-list__label__description">Integrate Fedora documentation</span></label></li></ul></li><li><label class="todo-list__label"><input type="checkbox" disabled="disabled"><span class="todo-list__label__description"><a class="reference-link" href="#root/krkLW8AwcYf2/Hdf1kG6Kvcl1">Link map</a>&nbsp;– it's empty</span></label></li><li><label class="todo-list__label"><input type="checkbox" disabled="disabled"><span class="todo-list__label__description"><a class="reference-link" href="#root/krkLW8AwcYf2/QEAPj01N5f7w">links</a>&nbsp;- extremely old GIFs.</span></label></li></ul>


blobId: EVlQO7YTIFt0Y3BXlgXw
dateModified: 2025-03-09 11:11:31.128+0200
utcDateModified: 2025-03-09 09:11:31.128Z
content:
  <h2>External links</h2><p>External link is general web link targeting some external web resource - e.g. <a href="https://en.wikipedia.org/wiki/South_China_Sea">https://en.wikipedia.org/wiki/South_China_Sea</a> is an external link to one Wikipedia page.</p><p>External links are done through CKEditor native links. To create an external link, select text and press <code>CTRL-K</code> or wait for the "balloon" to appear and click link icon there.</p><p><img src="api/images/N6O1qfBGcbFH/create-external-link.gif" alt=""></p><p>You can follow external link by either double clicking (will open new tab/window) it or right clicking on them and choosing "Open in new tab".</p><h2>Internal links to notes</h2><p>Links to internal notes are created a bit differently. To create link to note at current cursor position, press <code>CTRL-L</code>.</p><p>In the dialog you can see radio button to choose from different types of linking:</p><ul><li>link title mirrors the note's current title - this is sometimes also called "reference link". Title of such links cannot be changed, instead it is always mirroring the title of linked note. This way the link title is never outdated</li><li>link title can be changed arbitrarily - this is the traditional hyperlink - you link to a particular note and can choose the link title</li></ul><p><img src="api/images/dPcRcDZwyGAO/create-link-to-note.gif" alt=""></p><p>You can follow the note link by double clicking it.</p><p>Alternatively if you only wish to quickly preview the content, you can hover over the link and will see read only preview.</p><h3>In-place linking</h3><p>Trilium also provides "inline" linking - type <code>@</code> and you'll see an autocomplete, just type few characters from the desired note title, press enter and you have a link.</p><h2>Note map</h2><p>Trilium provides a visualisation of incoming and outgoing links for a particular note. See <a href="#root/BCkXAVs63Ttv">note map</a> for details.</p>


blobId: rcA5EOAnefIWfWz32kXN
dateModified: 2025-03-09 11:11:39.579+0200
utcDateModified: 2025-03-09 09:11:39.579Z
content:
  <p>This page describes manually installing Trilium on your server. <strong>Note that this is a not well supported way to install Trilium, problems may appear, information laid out here is quite out of date. It is recommended to use either Docker or packaged build installation.</strong></p><h2>Requirements</h2><p>Trilium is a node.js application. Supported (tested) version of node.js is latest 14.X.X and 16.X.X. Trilium might work with older versions as well.</p><p>You can check your node version with this command (node.js needs to be installed):</p><pre><code class="language-text-x-trilium-auto">node --version</code></pre><p>If your Linux distribution has only an outdated version of node.js, you can take a look at the installation instruction on node.js website, which covers most popular distributions.</p><h3>Dependencies</h3><p>There are some dependencies required. You can see command for Debian and its derivatives (like Ubuntu) below:</p><pre><code class="language-text-x-trilium-auto">sudo apt install libpng16-16 libpng-dev pkg-config autoconf libtool build-essential nasm libx11-dev libxkbfile-dev</code></pre><h2>Installation</h2><h3>Download</h3><p>You can either download source code zip/tar from <a href="https://github.com/TriliumNext/Notes/releases/latest%5D%5D">https://github.com/TriliumNext/Notes/releases/latest]]</a> %%{WARNING}%%or clone git repository <strong>from stable branch</strong> with</p><pre><code class="language-text-x-trilium-auto">git clone -b stable https://github.com/triliumnext/notes.git %%{WARNING}%%</code></pre><h2>Installation</h2><pre><code class="language-text-x-trilium-auto">cd trilium

  # download all node dependencies
  npm install

  # make sure the better-sqlite3 binary is there
  npm rebuild

  # bundles &amp; minifies frontend JavaScript
  npm run webpack</code></pre><h2>Run</h2><pre><code class="language-text-x-trilium-auto">cd trilium

  # using nohup to make sure trilium keeps running after user logs out
  nohup TRILIUM_ENV=dev node src/www &amp;</code></pre><p>The application by default starts up on port 8080, so you can open your browser and navigate to <a href="http://localhost:8080">http://localhost:8080</a> to access Trilium (replace "localhost" with your hostname).</p><h2>TLS</h2><p>Don't forget to <a href="#root/l2VkvOwUNfZj">configure TLS</a> which is required for secure usage!</p>


blobId: gUJiFIz1YY1vjQJ41hcy
dateModified: 2025-03-09 11:11:51.862+0200
utcDateModified: 2025-03-09 09:11:51.862Z
content:
  <p>Trilium (<a href="#root/WOcw2SLH6tbX">server edition</a>) has a mobile web frontend which is optimized for touch based devices - smartphones and tablets. It is activated automatically during login process based on browser detection.</p><p>Mobile frontend is limited in features compared to full desktop frontend. See below for more details on this.</p><p>Note that this is not an Android/iOS app, this is just mobile friendly web page served on the <a href="#root/WOcw2SLH6tbX">server edition</a>.</p><h2>Screenshots</h2><h3>Mobile phone</h3><p><img src="api/images/TFAiJIXJFfqv/mobile-smartphone.png" alt=""></p><h3>Tablet</h3><p><img src="api/images/fi37V32TNyzm/mobile-tablet.png" alt=""></p><h2>Limitations</h2><p>Mobile frontend provides only some of the features of the full desktop frontend:</p><ul><li>it is possible to browse the whole note tree, read and edit all types of notes, but you can create only text notes</li><li>reading and editing <a href="#root/bwg0e8ewQMak">protected notes</a> is possible, but creating them is not supported</li><li>editing options is not supported</li><li>cloning notes is not supported</li><li>uploading file attachments is not supported</li></ul><h2>Forcing mobile/desktop frontend</h2><p>Trilium decides automatically whether to use mobile or desktop frontend. If this is not appropriate, you can use <code>?mobile</code> or <code>?desktop</code> query param on <strong>login</strong> page (Note: you might need to log out).</p><h2>Scripting</h2><p>You can alter the behavior with <a href="#root/CdNpE2pqjmI6">scripts</a> just like for normal frontend. For script notes to be executed, they need to have labeled <code>#run=mobileStartup</code>.</p>


blobId: H3pKaNUxKzFHl3d9HAIV
dateModified: 2025-03-09 11:12:06.157+0200
utcDateModified: 2025-03-09 09:12:06.157Z
content:
  <p>Configure Nginx proxy and HTTPS. The operating system here is Ubuntu 18.04.</p><ol><li>Download Nginx and remove Apache2</li></ol><pre><code class="language-text-x-trilium-auto">sudo apt-get install nginx
  sudo apt-get remove apache2</code></pre><ol><li>Create configure file</li></ol><pre><code class="language-text-x-trilium-auto">cd /etc/nginx/conf.d
  vim default.conf</code></pre><ol><li>Fill the file with the context shown below, part of the setting show be changed. Then you can enjoy your web with HTTPS forced and proxy.</li></ol><pre><code class="language-text-x-trilium-auto"># This part is for proxy and HTTPS configure
  server {
      listen 443 ssl;
      server_name trilium.example.net; #change trilium.example.net to your domain without HTTPS or HTTP.
      ssl_certificate /etc/ssl/note/example.crt; #change /etc/ssl/note/example.crt to your path of crt file.
      ssl_certificate_key /etc/ssl/note/example.net.key; #change /etc/ssl/note/example.net.key to your path of key file.
      ssl_session_cache builtin:1000 shared:SSL:10m;
      ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
      ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
      ssl_prefer_server_ciphers on;
      access_log /var/log/nginx/access.log; #check the path of access.log, if it doesn't fit your file, change it
      
      location / {
          proxy_set_header Host $host;
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header X-Forwarded-Proto $scheme;
          proxy_set_header Upgrade $http_upgrade;
          proxy_set_header Connection "upgrade";
          proxy_pass http://127.0.0.1:8080; # change it to a different port if non-default is used
          proxy_read_timeout 90;
          proxy_redirect http://127.0.0.1:8080 https://trilium.example.net; # change them based on your IP, port and domain
      }
  }
  # This part is for HTTPS forced
  server {
              listen 80;
              server_name trilium.example.net; # change to your domain
              return 301 https://$server_name$request_uri;
  }</code></pre>


blobId: gYoUpmp1f9KWXgAqO3vj
dateModified: 2025-03-09 11:12:26.741+0200
utcDateModified: 2025-03-09 09:12:26.740Z
content:
  <p>This page describes configuring the Trilium module included in NixOS.</p><h2>Requirements</h2><p><a href="https://nixos.org/">NixOS</a> installation.</p><h2>Configuration</h2><p>Add this to your <code>configuration.nix</code>:</p><pre><code class="language-text-x-trilium-auto">services.trilium-server.enable = true;

  # default data directory: /var/lib/trilium
  #services.trilium-server.dataDir = "/var/lib/trilium-sync-server";

  # default bind address: 127.0.0.1, port 8080
  #services.trilium-server.host = "0.0.0.0";
  #services.trilium-server.port = 12783;</code></pre><p>Uncomment any option you would like to change.</p><p>See the <a href="https://search.nixos.org/options?channel=unstable&amp;from=0&amp;size=50&amp;sort=relevance&amp;type=packages&amp;query=trilium-server">NixOS options list</a> for more options (including nginx reverse proxy configuration).</p>


blobId: cp6IRMz9JjevVijjadzI
dateModified: 2025-03-09 11:12:29.629+0200
utcDateModified: 2025-03-09 09:12:29.628Z
content:
  <p>Note is a central entity in Trilium. Main attributes of note are title and content.</p><h3>Note types</h3><ul><li><a href="#root/iPIMuisry3hd">text note</a> - this is default note type which allows you to put rich text, images etc.</li><li><a href="#root/6f9hih2hXXZk">code note</a> - some kind of formal code, typically programming language (e.g. JavaScript) or data structure (e.g. JSON)</li><li><a href="https://github.com/TriliumNext/Notes/wiki/Images">image note</a> - represents single image</li><li>file note - represents uploaded file (e.g. docx MS Word document).</li><li>render HTML note - this works as an output screen of attached <a href="#root/CdNpE2pqjmI6">scripts</a></li><li><a href="#root/m523cpzocqaD">saved search</a> note - contains saved search query and dynamically displays result of the search as its sub-notes</li><li><a href="#root/iRwzGnHPzonm">relation map</a> note - visualizes notes and their relations</li><li><a href="#root/GTwFsgaA0lCt">book note</a> - displays its children notes, useful for reading many short notes</li><li>mermaid - create diagrams and flowcharts using <a href="https://github.com/mermaid-js/mermaid">mermaid.js ↗</a></li><li><a href="#root/fKYGY3OOo5d1">canvas note</a> - allows hand drawn notes and basic diagraming on an infinite canvas using <a href="https://github.com/excalidraw/excalidraw">excalidraw ↗</a></li></ul><p>In Trilium there's no specific "folder" note type. Any note can have children and thus be a folder.</p><h3>Root note</h3><p>There's one special note called "root note" which is root of the note tree. All other notes are placed below it in the structure.</p><h3>Tree structure</h3><p>Importantly, note itself doesn't carry information on its placement in note tree. See <a href="#root/IakOLONlIfGI">cloning</a> for details.</p><p>Tree structure of notes can resemble file system - but compared to that notes in Trilium can act as both file and directory - meaning that note can both have its own content and have children. "Leaf note" is a note which doesn't have any children.</p><h3>Deleting / undeleting notes</h3><p>When you delete a note in Trilium, it is actually only marked for deletion (soft-delete) - the actual content, title, attributes etc. are not deleted, only hidden.</p><p>Within (by default) 7 days, it is possible to undelete these soft-deleted notes - open Recent Changes dialog, and you will see a list of all modified notes including the deleted ones. Notes available for undeletion have a link to do so. This is kind of "trash can" functionality known from e.g. Windows.</p><p>Clicking an undelete will recover the note, it's content and attributes - note should be just as before being deleted. This action will also undelete note's children which have been deleted in the same action.</p><p>To be able to undelete a note, it is necessary that deleted note's parent must be undeleted (otherwise there's no place where we can undelete it to). This might become a problem when you delete more notes in succession - the solution is then undelete in the reverse order of your deletion.</p><p>After the 7 days (configurable) the notes will be "erased" - their title, content, revisions and attributes will be erased, and it will not be possible anymore to recover them (unless you restore <a href="#root/ODY7qQn5m2FT">backup</a>).</p><h2>See also</h2><ul><li><a href="#root/CoFPLs3dRlXc">Read-only note</a></li></ul>


blobId: ddRnq2BJXu1J6XlmrWq9
dateModified: 2025-03-09 11:12:33.861+0200
utcDateModified: 2025-03-09 09:12:33.861Z
content:
  <p>Hoisting is a standard outliner feature which allows you to focus on (or "zoom into") a specific note and its subtree by hiding all parent and sibling notes. Demo:</p><p><img src="api/images/AiBOf1LIykMC/note-hoisting.gif" alt=""></p><p>In addition to showing only this subtree, this also narrows both full text search and <a href="#root/MMiBEQljMQh2">“jump to note”</a> to just notes present in hoisted subtree.</p><p>See also <a href="#root/9sRHySam5fXb">Workspace</a> which extends this feature.</p>


blobId: Ss3XYlCT3I84a3ZTGXFq
dateModified: 2025-03-09 11:12:37.910+0200
utcDateModified: 2025-03-09 09:12:37.909Z
content:
  <p>Icons are useful for distinguishing notes. At the technical level, they are set by the <code><strong>iconClass</strong></code> attribute which adds a CSS class to the note. For example <code>#iconClass="bx bx-calendar"</code> will show a calendar instead of the default page or folder icon. Looking up and remembering the css class names is not necessary. While editing a note, click on the icon next to the title to bring up a chooser gallery:</p><p><img src="api/images/iuAfnapzpRCB/note-icon-change.png" alt="change note icon"></p><p><img src="api/images/R1L2vUshJD82/note-icon-gallery.png" alt="note icon gallery"></p>


blobId: rCItjjx7OxouKxDDkR6Y
dateModified: 2025-03-09 11:12:41.348+0200
utcDateModified: 2025-03-09 09:12:41.347Z
content:
  <p>Note map is a visualization of connections between notes.</p><p>This provides an insight into a structure ("web") of notes.</p><p>There are two types of note map:</p><h2>Link Map</h2><p>Shows <a href="#root/zEY4DaJG4YT5">relations</a> between notes:</p><p><img src="api/images/5nE2aM3crNI6/link-map.png" alt=""></p><h2>Tree Map</h2><p>Shows hierarchical map of notes:</p><p><img src="api/images/9ypFh2kQ6bKC/tree-map.png" alt=""></p><h2>See also</h2><p><a href="#root/iRwzGnHPzonm">Relation map</a> is a similar concept, with some differences:</p><ul><li>note map is automatically generated while relation map must be created manually</li><li>relation map is a type of note while a link map is just virtual visualization</li></ul>


blobId: fXI2OY78O5tqd6RATpeH
dateModified: 2025-03-09 11:12:45.920+0200
utcDateModified: 2025-03-09 09:12:45.919Z
content:
  <p>One of the Trilium's goals is to provide fast and comfortable navigation between notes.</p><h2>Backwards and forward</h2><p>You can use alt-left and alt-right to move back and forward in history of viewed pages.</p><p>This works identically to browser backwards / forwards, it's actually using built-in browser support for this.</p><p><img src="api/images/TNwG60mH2Foe/back-and-forwards.gif" alt=""></p><h2>Jump to note</h2><p>This is useful to quickly find and view arbitrary note - click on <code>Jump to</code> button on the top or press <code>CTRL-J</code>. Then type part of the note name and autocomplete will help you pick the desired note.</p><p><img src="api/images/snfWRIih71MM/jump-to.gif" alt=""></p><h3>Recent notes</h3><p>Jump to note also has the ability to show the list of recently viewed / edited notes and quickly jump to it.</p><p>To access this functionality, click on <code>Jump to</code> button on the top. By default, (when nothing is entered into autocomplete), this dialog will show the list of recent notes.</p><p>Alternatively you can click on the "time" icon on the right.</p><p><img src="api/images/wpFu8PhUu7e7/recent-notes.gif" alt=""></p>


blobId: YdBhVB6PVz0DY59QcXR5
dateModified: 2025-03-09 11:12:49.312+0200
utcDateModified: 2025-03-09 09:12:49.312Z
content:
  <p>Trilium supports seamless versioning of notes by storing snapshots ("revisions") of notes at regular intervals.</p><h2>Note Revisions Snapshot Interval</h2><p>Time interval of taking note snapshot is configurable in the Options -&gt; Other dialog. This provides a tradeoff between more revisions and more data to store.</p><p>To turn off note versioning for a particular note (or subtree), add <code>disableVersioning</code> <a href="#root/zEY4DaJG4YT5">label</a> to the note.</p><h2>Note Revision Snapshots Limit</h2><p>The limit on the number of note snapshots can be configured in the Options -&gt; Other dialog. The note revision snapshot number limit refers to the maximum number of revisions that can be saved for each note. Where -1 means no limit, 0 means delete all revisions. You can set the maximum revisions for a single note through the <code>versioningLimit=X</code> label.</p><p>The note limit will not take effect immediately; it will only apply when the note is modified.</p><p>You can click the <strong>Erase excess revision snapshots now</strong> button to apply the changes immediately.</p><p>Note revisions can be accessed through the button on the right of ribbon toolbar.</p><p><img src="api/images/MA2uvkVloWXl/note-revisions.png" alt=""></p>


blobId: KjxJBWJAXkaLOPCDsDa2
dateModified: 2025-03-09 11:13:29.188+0200
utcDateModified: 2025-03-09 09:13:29.189Z
content:
  <p>This page contains description of some of the patterns I use to organize information in my knowledge base. This is meant to give some inspiration of how one might create and structure their knowledge base in general and also specifically in <a href="https://github.com/triliumnext/notes">Trilium Notes</a>. It also gives some background and justification for some of the design decisions.</p><h2>Meta patterns</h2><p>Just to be clear, meta patterns are "patterns of patterns", i.e. patterns appearing in other patterns.</p><h3>Hierarchical organization of information</h3><p>Basic meta pattern is that I sort notes (units of information) into a hierarchy - I have some "top level" notes which represent coarse grained organization, these then split into sub-notes defining finer grained organization and so on. I consider this hierarchical (tree) organization very efficient for organization of large amounts of information. A lot of note taking software (such as Evernote) are frustratingly limited in this regard which limits scalability of the software to large amounts of notes.</p><h4>Scalability</h4><p>It's important to frame the following (meta) patterns with some idea of how large amount of data are we talking about.</p><p>My rule of thumb for estimation of size of personal knowledge base is that you can reasonably produce around 10 notes a day, which is 3650 in a year. I plan to use my knowledge base long term (with or without Trilium Notes), probably decades so you can easily get to number 100 000 or even more. Right now, my personal knowledge base has around 10 000 notes.</p><p>100 000 is a number to which most note taking software doesn't scale well (in both performance and UI). Yet I don't think it's really very much considering a lifetime of knowledge.</p><h4>Lazy hierarchy</h4><p>My approach to creating the hierarchy is being lazy - I don't create the structure first and then fill it with notes, instead I create single note for some specific topic and start using this one note. Once the content starts to grow, and I see how <i>some</i> parts could be split out, I move them out into separate sub notes. As an example I have a book review for <i>The Fellowship of the Ring</i>:</p><ul><li>Book reviews<ul><li>The Fellowship of the Ring</li></ul></li></ul><p>The note contains basic book info (author, publisher etc.), book highlights with the comments and then overall review. Now it turns out there's far too many book highlights and overall review is also rather long, so I want to change the structure to the following:</p><ul><li>Book reviews<ul><li>The Fellowship of the Ring &nbsp; &nbsp; &nbsp;&nbsp;<i>(still contains basic info)</i><ul><li>Highlights</li><li>Review</li></ul></li></ul></li></ul><p>If I used standard text file stored in a filesystem I would soon run into an annoying problem that in order to split out the Highlights and Review into sub-notes I would also have to convert <i>The Fellowship of the Ring</i> from text file into directory and split out all sections of the note into sub-notes. Instead, Trilium treats all notes as equal - both leaf notes and inner notes can have both text content which allows me to sub-structure only content which needs it.</p><h3>Sorting notes into multiple places in the hierarchy</h3><p>While organizing the notes into the hierarchy, you very quickly run into a dilemma - your note seem to belong to two places in the hierarchy equally. As an example - you want to make a note about <a href="https://en.wikipedia.org/wiki/Bash_(Unix_shell)">bash</a> - does it belong to "OS / Linux" or "Programming / Scripting languages"? This is actually a false dichotomy forced down by the limits of the basic tree hierarchy - the answer is <i>of course it belongs to both</i>. This is the reason why Trilium doesn't use standard tree structure (which requires every note to have exactly one parent), but an extension which allows every note to have several parents, thus effectively allowing it to appear in multiple places in the hierarchy. For lack of better term I call this "<a href="https://github.com/TriliumNext/Notes/wiki/Cloning_notes">cloning</a>". The main problem with this term is that it suggests that each clone must have an original, but here all clones are completely equal - effectively there's no original.</p><p>In tech lingo, it might be better to describe it as a <a href="https://en.wikipedia.org/wiki/Hard_link">hard link</a> with an important difference that it is possible to hard link (clone) a directory (inner note).</p><h3>Protected notes</h3><p>I have Trilium Notes opened non-stop. Sometimes I forget to lock my computer when going to the bathroom. Sometimes I let a friend or family member to use my computer for a minute without supervision. They might click on (running) Trilium and inadvertently see a note I really don't want anybody to see (personal diary, credentials). To cover this, Trilium has a concept of "<a href="https://github.com/TriliumNext/Notes/wiki/Protected-notes">protected notes</a>" - protected note is encrypted and on top of that requires the user to enter the password every 5 minutes which guarantees that such note can be in a readable state only for small amount of time. Working with ordinary (not protected) notes don't require password so you're not bothered by extra security when it's not needed.</p><h3>Archiving notes</h3><p>Notes can lose relevancy with time - let's say I switch jobs - all the notes specific to the former employer immediately lose most of its import. This doesn't mean I want to delete these notes though - typically I just want them to somehow deprioritize - in Trilium I would do that by assigning an <a href="https://github.com/TriliumNext/Notes/wiki/Attribute-inheritance">inherited</a> <a href="https://github.com/TriliumNext/Notes/wiki/Attributes">label</a> <code>archived</code> to the company root note. The main effect of this label is that all the notes from this sub-tree are filtered out from search results (fast search via note autocomplete is my main <a href="https://github.com/TriliumNext/Notes/wiki/Note-navigation">navigation approach</a>). Apart from this, I also typically move such outdated notes to some less prominent place in the hierarchy.</p><p>I use archivation also for notes which are not very relevant from their creation - an example might be automatically imported reddit comments.</p><p>Sometimes there's no clear <i>category</i> split between relevant and non-relevant notes, in that case I just create "<i>OLD</i>" note with <code>archived</code> label and move all irrelevant notes there. So my credentials note might look something like this:</p><ul><li>Credentials<ul><li>Personal<ul><li>OLD &nbsp; &nbsp; &nbsp;&nbsp;<i>(contains a bunch of notes with credentials for services I don't use anymore)</i></li><li>Gmail</li><li>Github</li><li>...</li></ul></li></ul></li></ul><h2>Patterns</h2><h3>Day note</h3><p>Every day has its note which contains or references everything related to the given day. Structure looks like this:</p><ul><li>2018<ul><li>11 - November<ul><li>26 - Monday</li><li>27 - Tuesday<ul><li>subnote 1</li></ul></li></ul></li></ul></li></ul><p>Day note serves as a workspace and note inbox at the same time - it's the default location to create a note when I don't have time to think about proper placement. At the end of the day I typically review my day note and clone the notes into suitable locations in the hierarchy.</p><p>Trilium has this pattern partly built-in - Trilium understands and can create this Year / Month / Day structure semi-automatically (on API call). There's also global keyboard shortcut <code>CTRL-ALT-P</code> which will create new note in the day note.</p><p>What notes do I keep under this day note?</p><ul><li>TODO list for given day (this can be automated - see <a href="https://github.com/TriliumNext/Notes/wiki/Task-manager">Task Manager</a>)</li><li>Personal diary</li><li><a href="https://github.com/TriliumNext/Notes/wiki/Cloning-notes">clones</a> of notes I created during this day (which kind of represents what I've been working on).</li><li>I often clone notes (or sub-trees) of e.g. projects I'm working on at given day so they are at hand</li><li>I have some <a href="https://github.com/TriliumNext/Notes/wiki/Scripts">scripts</a> which allow me to track certain daily metrics (like weight). These are saved into one daily "data note" (actually JSON <a href="https://github.com/TriliumNext/Notes/wiki/Code-notes">code note</a>).<ul><li>I have other scripts which then help me to visualize these data (see a <a href="https://github.com/TriliumNext/Notes/wiki/Weight%20tracker">Weight Tracker</a> example)</li><li>I have a script which automatically imports all my comments from reddit into the day note.<ul><li>People are sometimes wondering why. The answer is that I usually put some effort and thought into a comment and that's why I feel it's worth preserving, especially if it can be done automatically.</li></ul></li></ul></li></ul><p>For most notes, this day note placement is <i>secondary</i> and their primary location is somewhere else (e.g. for a book review I've been working on it's <i>Book / Reviews</i>, not the day note). So for this pattern to work, ability to <a href="https://github.com/TriliumNext/Notes/wiki/Cloning-notes">clone</a> notes into multiple places is pretty fundamental.</p><h3>Projects</h3><p><i>Project</i> is pretty self-explanatory, for me specifically it also means being long term (years) - an example of a project might be Trilium Notes or university studies. Given their longevity, projects can be large and deep, but their structure is very domain specific, and I don't see any common patterns. What's pretty clear is they are often widely interconnected with other parts of the knowledge base - e.g. university credentials are cloned from "Credentials / University" top level notes and Trilium related blog posts are in "Blog / [Name of the blog] / Trilium".</p><p><i>Epics</i> are the same thing as projects, but differ in scope - they are typically several months long and as such are usually placed into a year note (e.g. <i>2018 / Epics</i>). Epics are often of work nature (also cloned into work note) and personal (e.g. currently I have large epic for moving to a different city).</p><p>I don't have a term for short term projects (typically several days long), but continuing the scrum analogy I might call them <i>story</i>. These are often placed directly into day notes and manually moved from one day to another (or place into a month note, e.g. <i>2018 / 11 - November</i>).</p><h3>Credentials</h3><p>I keep all my credentials in the knowledge base, they are sorted into categories - work related, project related, personal per country etc. These notes are of course <a href="https://github.com/TriliumNext/Notes/wiki/Protected-notes">protected</a> and are often cloned into other places (e.g. project credentials are cloned into the project itself). This is a pretty important advantage compared to traditional tools like KeePass - all the relevant information is centralized into one place without compromising security.</p><h3>People profiles</h3><p>This might seem creepy to some, but I keep a profile on most people. It contains pretty standard things like date of birth, contacts, address, but also current and previous employments, their hobbies and worldviews and sometimes even important (IM/mail/meatspace) conversations. Just about everything I find notable. It helps to refresh some basic info before meeting people, especially if you haven't been in touch in a while. It gets pretty awkward to ask for the tenth time where do they work for example, because you keep forgetting it.</p><p>Naturally I have a lot of (extended) family members, friends, acquaintances etc. so I need some way to sort them. My main method is to sort them by social circle (work, high school, sports club etc.), sometimes also by their town of residence. Family <i>circle</i> is still too large so the further organization is by <i>clan</i> (as in "Smiths"). Some people are members of several such circles, so they are just cloned into multiple places.</p><p>For family specifically it's pretty useful to create <a href="https://github.com/TriliumNext/Notes/wiki/Relation-map">relation map</a> to visualize relationships:</p><p><img src="api/images/xeZPrfi77XPu/relation-map-family.png" alt=""></p><h3>Books</h3><p>Of course, I keep standard "To read" list. I also keep a record on the books I've read - typically one book has one subtree where the root has some basic info like author, page count, publication date, date started, date finished (in the form of <a href="https://github.com/TriliumNext/Notes/wiki/Promoted-attributes">promoted labels</a>). I also write a (private) review and keep list of highlights from Kindle, optionally with some commentary, these are usually stored in sub notes (unless they are pretty short).</p><p>To keep the list of books manageable, I sort them per year (of reading them), this also gives me some basic overview of "reading performance" for given year. I plan to create a <a href="https://github.com/TriliumNext/Notes/wiki/Scripts">script</a> which would show some timeline chart visualizing book attributes <code>dateStarted</code> - <code>dateFinished</code> to have nicer view of my reading sprints and trends.</p><p>Some specific authors also have their own note which contains cloned book reviews, links to interviews and other related resources.</p><p>I have similar system for movies and TV shows, but not as sophisticated.</p><h3>Personal diary</h3><p>This is a place to reflect on events, experiences, new findings etc. This can help you get deeper understanding of your inner self, clarify your thinking and make better decisions as a result.</p><p>I sort personal diary notes directly under <i>day note</i> (explained above), but it can be cloned also to e.g. "trip note" (if the diary note is about given trip) or to person's profile (if the person plays a role in the diary note). All my diary notes are <a href="https://github.com/TriliumNext/Notes/wiki/Protected-notes">protected</a> since they are usually pretty sensitive.</p><h3>Documents</h3><p>I keep all my personal documents (ID, passport, education certificates ...) scanned in the knowledge base. They are <a href="https://github.com/TriliumNext/Notes/wiki/Synchronization">synchronized</a> across every PC which provides decent backup and makes them available everywhere.</p><p>Advantage compared to e.g. keeping them in Dropbox or Google Drive is that they are not stored on some 3rd party server and they can be encrypted (<a href="https://github.com/TriliumNext/Notes/wiki/Protected-notes">protected</a>).</p><h3>Inventory</h3><p>Inventory contains documents and other relevant importation for my important belongings - e.g. for car you can keep the registration card, maintenance record, related costs etc. I also keep inventory for some items personally important to me - mainly computers, phones, cameras and similar electronics. This can be practical at times but also provides sentimental value.</p><h3>Topic knowledge base</h3><p>This where I store hard "knowledge" - summarized topics and findings from different domains. Topics can range from traditional sciences - physics, history, economy to philosophy, mental models, apps (notes about specific apps I use) etc. Of course this is very subjective - given what I do, my Physics sub-tree is pretty sparse compared to my Programming subtree.</p><h3>Work knowledge base</h3><p>I usually keep top level note for the company I currently work at (past jobs are moved elsewhere). I track basic organization of the company (divisions, business units), who is who (<a href="https://github.com/TriliumNext/Notes/wiki/Relation-map">relation maps</a>) are again useful for visualization), projects I work at etc.</p><p>There's a number of credentials to various company services I need to use. Companies usually have a bunch of complex processes and tools. I record meeting minutes, link to the company wiki (which is usually difficult to find relevant info). In general there's a lot of company specific information I need to know or need have them at hand in a nice structure I can understand. Often it's just copy pasting and reshuffling of existing information into something more understandable for me.</p><p>From my experience, keeping this makes me more productive and even more importantly dramatically reduces frustration and stress.</p><h2>Conclusion</h2><p>I could probably go on with more patterns (e.g. study notes, travelling), but I think you get the idea. Whatever is important in your life, it probably makes sense to document and track it.</p>


blobId: RSXhh32p6IJxkG5yuHVL
dateModified: 2025-03-09 11:13:37.500+0200
utcDateModified: 2025-03-09 09:13:37.500Z
content:
  <h3>Trilium Notes</h3><p>Trilium Notes does not collect/send any data from the user's installation, i.e. no analytics, no telemetry etc. The data flows only between user controlled / installed applications, without any intermediary.</p><p>Automatic network activity consists of:</p><ul><li>Trilium periodically queries URL <a href="https://github.com/TriliumNext/Notes/releases">https://github.com/TriliumNext/Notes/releases</a> to see if there's a new stable version released. (check only, there's no automatic download and/or installation).</li><li>Trilium will download spelling dictionaries automatically as needed based on language settings</li></ul><h3>Trilium Web Clipper</h3><p>Trilium Web Clipper does not collect/send any data from the user's installation, i.e. no analytics, no telemetry etc. The data flows only between user controlled / installed applications, without any intermediary.</p><h3>Trilium Sender for Android</h3><p>Trilium Sender for Android does not collect/send any data from the user's installation, i.e. no analytics, no telemetry etc. The data flows only between user controlled / installed applications, without any intermediary.</p>


blobId: g8zU5Syce0XwU5yNTH8d
dateModified: 2025-03-09 11:13:44.008+0200
utcDateModified: 2025-03-09 09:13:44.008Z
content:
  <p>Promoted attributes are <a href="#root/zEY4DaJG4YT5">attributes</a> which are considered important and thus are "promoted" onto the main note UI. See example below:</p><p><img src="api/images/rxH2Dm1jn6YT/promoted-attributes.png" alt=""></p><p>You can see the note having kind of form with several fields. Each of these is just regular attribute, the only difference is that they appear on the note itself.</p><p>Attributes can be pretty useful since they allow for querying and script automation etc. but they are also inconveniently hidden. This allows you to select few of the important ones and push them to the front of the user.</p><p>Now, how do we make attribute to appear on the UI?</p><h2>Attribute definition</h2><p>Attribute is always name-value pair where both name and value are strings.</p><p><i>Attribute definition</i> specifies how should this value be interpreted - is it just string, or is it a date? Should we allow multiple values or note? And importantly, should we <i>promote</i> the attribute or not?</p><p><img src="api/images/l42VG6hOjJ40/attribute-definitions.png" alt=""></p><p>You can notice tag attribute definition. These "definition" attributes define how the "value" attributes should behave.</p><p>So there's one attribute for value and one for definition. But notice how definition attribute is <a href="#root/bwZpz2ajCEwO">Inheritable</a>, meaning that it's also applied to all descendant note. So in a way, this definition is used for the whole subtree while "value" attributes are applied only for this note.</p><h3>Inverse relation</h3><p>Some relations always occur in pairs - my favorite example is on the family. If you have a note representing husband and note representing wife, then there might be a relation between those two of <code>isPartnerOf</code>. This is bidirectional relationship - meaning that if a relation is pointing from husband to wife then there should be always another relation pointing from wife to husband.</p><p>Another example is with parent - child relationship. Again these always occur in pairs, but in this case it's not exact same relation - the one going from parent to child might be called <code>isParentOf</code> and the other one going from child to parent might be called <code>isChildOf</code>.</p><p>Relation definition allows you to specify such "inverse relation" - for the relation you just define you specify which is the inverse relation. Note that in the second example we should have two relation definitions - one for <code>isParentOf</code> which defines <code>isChildOf</code> as inverse relation and then second relation definition for <code>isChildOf</code> which defines <code>isParentOf</code> as inverse relation.</p><p>What this does internally is that whenever we save a relation which has defined inverse relation, we check that this inverse relation exists on the relation target note. Similarly, when we delete relation, we also delete inverse relation on the target note.</p>


blobId: IjnSM3XKFXdKOqsAvSLD
dateModified: 2025-03-09 11:13:48.537+0200
utcDateModified: 2025-03-09 09:13:48.538Z
content:
  <p>Trilium is designed to store a wide variety of data, including sensitive information such as personal journals, credentials, or confidential documents. To safeguard this type of content, Trilium offers the option to protect notes, which involves the following measures:</p><ul><li><strong>Encryption:</strong> Protected notes are encrypted using a key derived from your password. This ensures that without the correct password, protected notes remain indecipherable. Even if someone gains access to your Trilium <a href="#root/wX4HbRucYSDD">database</a>, they won't be able to read your encrypted notes.</li><li><strong>Time-limited access:</strong> To access protected notes, you must first enter your password, which decrypts the note for reading and writing. However, after a specified period of inactivity (10 minutes by default), the note is unloaded from memory, requiring you to re-enter your password to access it again.<ul><li>The session timeout is extended automatically while you're interacting with the protected note, so if you're actively editing, the session remains open. However, if you switch to an unprotected note, the session timer starts, and the session expires after 10 minutes of inactivity unless you return to the protected notes.</li></ul></li><li><strong>Protection scope:</strong> Protected notes ensure the confidentiality of their content and partially their integrity. While unauthorized users cannot read or edit protected notes, they can still delete or move them outside of the protected session.</li></ul><h2>Using Protected Notes</h2><p>By default, notes are unprotected. To protect a note, simply click on the shield icon next to the note's title, as shown here:</p><p><img src="api/images/zaUtPWl8NcCt/protecting-note.gif" alt="example animation of unlocking protected notes"></p><h2>What is Encrypted?</h2><p>Trilium encrypts the data within protected notes but not their metadata. Specifically:</p><p><strong>Encrypted:</strong></p><ul><li>Note title</li><li>Note content</li><li>Images</li><li>File attachments</li></ul><p><strong>Not encrypted:</strong></p><ul><li>Note structure (i.e., it remains visible that there are protected notes)</li><li>Metadata, such as the last modified date</li><li><a href="#root/zEY4DaJG4YT5">Attributes</a></li></ul><h2>Encryption Details</h2><p>The following steps outline how encryption and decryption work in Trilium:</p><ol><li>The user enters a password.</li><li>The password is passed through the <a href="https://en.wikipedia.org/wiki/Scrypt">scrypt</a> algorithm along with a "password verification" <a href="https://en.wikipedia.org/wiki/Salt_(cryptography)">salt</a> to confirm that the password is correct.</li><li>The password is then processed again through scrypt with an "encryption" salt, which generates a hash.<ul><li>Scrypt is used for <a href="https://en.wikipedia.org/wiki/Key_stretching">key stretching</a> to make the password harder to guess.</li></ul></li><li>The generated hash is used to decrypt the actual <i>data encryption key</i>.<ul><li>The data encryption key is encrypted using <a href="https://en.wikipedia.org/wiki/Advanced_Encryption_Standard">AES-128</a> with a random <a href="https://en.wikipedia.org/wiki/Initialization_vector">IV</a>.</li><li>The data encryption key is randomly generated during the <a href="#root/wX4HbRucYSDD">database</a> initialization and remains constant throughout the document’s lifetime. When the password is changed, only this key is re-encrypted.</li></ul></li><li>The data encryption key is then used to decrypt the actual content of the note, including its title and body.<ul><li>The encryption algorithm used is AES-128 with <a href="https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation">CBC mode</a>, where a unique IV is generated for each encryption operation and stored with the cipher text.</li></ul></li></ol><h2>Sharing Protected Notes</h2><p>Protected notes cannot be shared in the same way as regular notes. Their encryption ensures that only authorized users with the correct password can access them.</p>


blobId: AgylCkC3FumyvoCRLHHJ
dateModified: 2025-03-09 11:13:56.965+0200
utcDateModified: 2025-03-09 09:13:56.965Z
content:
  <h2>Choose the setup</h2><p><strong>Local only desktop/laptop</strong> - Allows a single instance on a desktop and will save the notes locally on that desktop.</p><ol><li><a href="#root/poXkQfguuA0U">Desktop installation</a></li></ol><p><strong>Server with web only access</strong> - Installs the application on the server and allows access from any web browser on any device, including mobile.</p><ol><li><a href="#root/WOcw2SLH6tbX">Server installation</a></li><li><a href="#root/RDslemsQ6gCp">Mobile frontend</a> (optional)</li><li><a href="https://heroku.com/deploy?template=https://github.com/feilongfl/trilium-heroku"><img src="api/images/JXFeNgU8Xnp1/home-button.svg" alt="Deploy"></a> %%{WARNING}%%</li><li><a href="https://www.pikapods.com/pods?run=trilium-next">PikaPods managed hosting</a></li></ol><p><strong>Combination of server and desktop/laptop</strong> - Install the application on both a server, for web access and data synchronization, and desktop instance(s). This allows all the data to be stored on the server and either accessed from the web browser, or the desktop application. The desktop application will sync and store the data locally so that it can be used when offline.</p><ol><li><a href="#root/WOcw2SLH6tbX">Server installation</a></li><li><a href="#root/RDslemsQ6gCp">Mobile frontend</a> (optional)</li><li><a href="#root/poXkQfguuA0U">Desktop installation</a></li><li><a href="#root/cbkrhQjrkKrh">Synchronization</a></li></ol><h2>Basic concepts</h2><ol><li>Understand <a href="#root/BFs8mudNFgCS">Note</a></li><li>Watch the <a href="#root/lD2Qh6zp8k4d">Screenshot tour</a></li></ol>


blobId: 09CuWEYujK6uqhKkHc87
dateModified: 2025-03-09 11:14:00.428+0200
utcDateModified: 2025-03-09 09:14:00.428Z
content:
  <p>Both <a href="#root/iPIMuisry3hd">text</a> and <a href="#root/6f9hih2hXXZk">code</a> notes in Trilium can be set to read-only. When a note is in read-only mode, it is presented to the user in a non-editable view, with the option to switch to editing mode if needed.</p><h2>Setting Read-Only Mode with a Label</h2><p>To set a note as read-only, add the <code>readOnly</code> <a href="#root/zEY4DaJG4YT5">label</a> to the note.</p><h2>Automatic Read-Only Mode</h2><p>For optimization purposes, Trilium will automatically set very large notes to read-only. Displaying such lengthy notes in editing mode can slow down performance, especially when editing is unnecessary.</p><p>If you want to ensure that a specific note remains editable regardless of its size, you can add the <code>autoReadOnlyDisabled</code> <a href="#root/zEY4DaJG4YT5">label</a> to the note.</p>


blobId: klp3FYmHBe79McMN3XrY
dateModified: 2025-03-09 11:14:07.188+0200
utcDateModified: 2025-03-09 09:14:07.189Z
content:
  <p>Relation map is a type of <a href="#root/kBrnXNG3Hplm">note</a> which visualizes notes and their <a href="#root/zEY4DaJG4YT5">relations</a>. See an example:</p><h2>Development process demo</h2><p>This is a basic example how you can create simple diagram using relation maps:</p><p><img src="api/images/EH6qNioOHeyT/relation-map-dev-process.png" alt=""></p><p>And this is how you can create it:</p><p><img src="api/images/SC6fYfv2NV3q/relation-map-dev-process-demo." alt=""></p><p>We start completely from scratch by first creating new note called "Development process" and changing its type to "Relation map". After that we create new notes one by one and place them by clicking into the map. We also drag <a href="#root/zEY4DaJG4YT5">relations</a> between notes and name them. That's all!</p><p>Items on the map - "Specification", "Development", "Testing" and "Demo" are actually notes which have been created under "Development process" note - you can click on them and write some content. Connections between notes are called "<a href="#root/zEY4DaJG4YT5">relations</a>".</p><h2>Family demo</h2><p>This is more complicated demo using some advanced concepts. Resulting diagram is here:</p><p><img src="api/images/xeZPrfi77XPu/relation-map-family.png" alt=""></p><p>This is how you get to it:</p><p><img src="api/images/N98UhifxrVpZ/relation-map-family-demo.gif" alt=""></p><p>There are several steps here:</p><ul><li>we start with empty relation map and two existing notes representing Prince Philip and Queen Elizabeth II. These two notes already have "isPartnerOf" <a href="#root/zEY4DaJG4YT5">relations</a> defined.<ul><li>There are actually two "inverse" relations (one from Philip to Elizabeth and one from Elizabeth to Philip)</li></ul></li><li>we drag both notes to relation map and place to suitable position. Notice how the existing "isPartnerOf" relations are displayed.</li><li>now we create new note - we name it "Prince Charles" and place it on the relation map by clicking on the desired position. The note is by default created under the relation map note (visible in the note tree on the left).</li><li>we create two new relations "isChildOf" targeting both Philip and Elizabeth<ul><li>now there's something unexpected - we can also see the relation to display another "hasChild" relation. This is because there's a <a href="#root/OFXdgB2nNk1F">relation definition</a> which puts "isChildOf" as an "<a href="#root/OFXdgB2nNk1F">inverse</a>" relation of "hasChildOf" (and vice versa) and thus it is created automatically.</li></ul></li><li>we create another note for Princess Diana and create "isPartnerOf" relation from Charles. Again notice how the relation has arrows both ways - this is because "isPartnerOf" definition specifies its inverse relation as again "isPartnerOf" so the opposite relation is created automatically.</li><li>as the last step we pan &amp; zoom the map to fit better to window dimensions.</li></ul><p>Relation definitions mentioned above come from "Person template" note which is assigned to any child of "My Family Tree" relation note. You can play with the whole thing in the <a href="#root/wX4HbRucYSDD">demo notes</a>.</p><h2>Details</h2><p>You can specify which relations should be displayed with comma delimited names of relations in <code>displayRelations</code> label.</p><p>Alternatively, you can specify comma delimited list of relation names in <code>hideRelations</code> which will display all relations, except for the ones defined in the label.</p><h2>See also</h2><ul><li><a href="#root/BCkXAVs63Ttv">Note map</a> is a similar concept</li></ul>


blobId: 2W5NjdxI3FT62zrIxJUE
dateModified: 2025-03-09 11:14:10.099+0200
utcDateModified: 2025-03-09 09:14:10.100Z
content:
  <p>Trilium allows you to save common searches as notes within the note tree. The search results will appear as sub-notes under these "saved search" notes. Here is an example of how it works:</p><p><img src="api/images/rVtYANyVhE9U/saved-search-image.gif" alt="save-search"></p><h2>Location</h2><p>By default, saved searches are stored in the day note. However, you can designate a different note to store saved searches by marking it with the <code>#searchHome</code> label. Additionally, for <a href="#root/9sRHySam5fXb">workspaces</a>, you can use the <code>#workspaceSearchHome</code> label to specify a storage location for saved searches within that workspace.</p>


blobId: EsABT2vYdt3ibSzKfhxr
dateModified: 2025-03-09 11:14:19.537+0200
utcDateModified: 2025-03-09 09:14:19.537Z
content:
  <p>Sometimes the fastest way to assess the software is just through screenshots so here they are:</p><p><img src="api/images/V01a3OdC9O06/screenshot.png" alt=""></p><p><img src="api/images/zaQnUsJTbvjr/dark-theme.png" alt=""></p><p>See <a href="#root/Wy267RK4M69c">Themes</a>.</p><p><img src="api/images/8jgXl1RUGL4H/code-note.png" alt=""></p><p>This shows <a href="#root/6f9hih2hXXZk">code note</a> editor.</p><p><img src="api/images/umjOUcnZi4z2/promoted-attributes-queen.png" alt=""></p><p>See <a href="#root/OFXdgB2nNk1F">promoted attributes</a></p><p><img src="api/images/xeZPrfi77XPu/relation-map-family.png" alt=""></p><p>See <a href="#root/iRwzGnHPzonm">relation map</a>.</p><p><img src="api/images/5nE2aM3crNI6/link-map.png" alt=""></p><p>See <a href="#root/Hdf1kG6Kvcl1">link map</a>.</p><p><img src="api/images/nQf1irAyZrZl/day-notes.png" alt=""></p><p>See <a href="#root/l0tKav7yLHGF">Day notes</a>.</p><p><img src="api/images/PFrpANAUte0M/weight-tracker.png" alt=""></p><p>See <a href="#root/R7abl2fc6Mxi">Weight tracker</a>.</p><p><img src="api/images/92KeXdKh3Ca1/task-manager.png" alt=""></p><p>See <a href="#root/xYjQUYhpbUEW">Task manager</a>.</p><p><img src="api/images/MA2uvkVloWXl/note-revisions.png" alt=""></p><p>See <a href="#root/vZWERwf8U3nx">Note revisions</a>.</p><p><img src="api/images/TFAiJIXJFfqv/mobile-smartphone.png" alt=""></p><p><img src="api/images/fi37V32TNyzm/mobile-tablet.png" alt=""></p><p>See <a href="#root/RDslemsQ6gCp">Mobile frontend</a>.</p>


blobId: bSibcThBH7Ptdp7DGWQ9
dateModified: 2025-03-09 11:14:23.300+0200
utcDateModified: 2025-03-09 09:14:23.301Z
content:
  <p>Trilium offers a "Script API" that enables scripts to perform various useful functions. There are two main APIs available:</p><ul><li><a href="https://triliumnext.github.io/Notes/frontend_api/FrontendScriptApi.html">Frontend API</a></li><li><a href="https://triliumnext.github.io/Notes/backend_api/BackendScriptApi.html">Backend API</a></li></ul><p>Please note that the Script API is currently experimental and may undergo changes in future updates.</p>


blobId: KXw0SxsvMdoNUjYoUdto
dateModified: 2025-03-09 11:14:26.901+0200
utcDateModified: 2025-03-09 09:14:26.901Z
content:
  <p>Trilium supports creating <a href="#root/6f9hih2hXXZk">code notes</a>, i.e. notes which allow you to store some programming code and highlight it. Special case is JavaScript code notes which can also be executed inside Trilium which can in conjunction with <a href="#root/GLks18SNjxmC">Script API</a> provide extra functionality.</p><h2>Scripting</h2><p>To go further I must explain basic architecture of Trilium - in its essence it is a classic web application - it has these two main components:</p><ul><li>frontend running in the browser (using HTML, CSS, JavaScript) - this is mainly used to interact with the user, display notes etc.</li><li>backend running JavaScript code in node.js runtime - this is responsible for e.g. storing notes, encrypting them etc.</li></ul><p>So we have frontend and backend, each with their own set of responsibilities, but their common feature is that they both run JavaScript code. Add to this the fact, that we're able to create JavaScript [[code notes]] and we're onto something.</p><h2>Button use case</h2><p>Let's take a look at our demo script (shipped with default Trilium <a href="#root/wX4HbRucYSDD">database</a>) - Task manager. One of the things this script does is adding a button to the Trilium interface which will allow user to easily add new Task (TODO item).</p><p><img src="api/images/DVJl4l3T8EG2/button-script.png" alt=""></p><p>First take a look at the red circle all the way on the top - this what we want to achieve - new button in UI which will create new note representing a task/todo item.</p><p>Red point below the first one marks the note type we have created for this script - it's "JavaScript frontend". It's frontend because adding button to UI is clearly frontend responsibility.</p><p>In the note content you can see the code which calls one of the API methods, this one is specifically meant to add new buttons. Code needs to set few button properties:</p><ul><li>button title</li><li>icon which should appear on the button</li><li>optional shortcut under which you can trigger the button</li><li>most importantly "action" - what must happen when button is clicked</li></ul><h3>Action handler</h3><p>Saving the note to the database is backend's responsibility, so we immediately pass control to the backend and ask it to create a note. Once this is done, we show the newly created note so that the user can set the task title and maybe some attributes.</p><h3>Script execution</h3><p>So we have a script which will add the button to the toolbar. But how can we execute it? One possibility is to click on "play" icon (marked by red circle). The problem with this is that this UI change is time bound by Trilium runtime so when we restart Trilium, button won't be there.</p><p>We need to execute it every time Trilium starts up, but we probably don't want to have to manually click on play button on every start up.</p><p>The solution is marked by red circle at the bottom - this note has <a href="#root/zEY4DaJG4YT5">label</a> <code>#run=frontendStartup</code> - this is one of the "system" labels which Trilium understands. As you might guess, this will cause all such labeled script notes to be executed once Trilium frontend starts up.</p><p>(<code>#run=frontendStartup</code> does not work for <a href="#root/RDslemsQ6gCp">Mobile frontend</a> - if you want to have scripts running there, give the script <code>#run=mobileStartup</code> label)</p><h3>More showcases</h3><p>You can see more scripting with explanation in <a href="#root/5668rwcirq1t">Advanced showcases</a></p><h2>Events</h2><p>See <a href="#root/GPERMystNGTB">Events</a>.</p><h2>Script API</h2><p>See <a href="#root/GLks18SNjxmC">Script API</a>.</p>


blobId: e2Xk487Z3P813R1cz8CW
dateModified: 2025-03-09 11:14:30.817+0200
utcDateModified: 2025-03-09 09:14:30.818Z
content:
  <h2>Local Search</h2><p>Local search allows you to search within the currently displayed note. To initiate a local search, press CTRL-F. If using a web browser, this will be handled by the browser's native search functionality. In the desktop (electron) version, a separate dialog will apear.</p><h2>Note Search</h2><p>Note search enables you to find notes by searching for text in the title, content, or <a href="#root/zEY4DaJG4YT5">attributes</a> of the notes. You also have the option to save your searches, which will create a special search note which is visible on your navigation tree and contains the search results as sub-items.</p><p>To search for notes, click on the magnifying glass icon on the toolbar or press the <code>CTRL-S</code> keyboard <a href="#root/A9Oc6YKKc65v">shortcut</a>.</p><h3>Simple Note Search Examples</h3><ul><li><code>rings tolkien</code>: Full-text search to find notes containing both "rings" and "tolkien".</li><li><code>"The Lord of the Rings" Tolkien</code>: Full-text search where "The Lord of the Rings" must match exactly.</li><li><code>note.content *=* rings OR note.content *=* tolkien</code>: Find notes containing "rings" or "tolkien" in their content.</li><li><code>towers #book</code>: Combine full-text and attribute search to find notes containing "towers" and having the "book" label.</li><li><code>towers #book or #author</code>: Search for notes containing "towers" and having either the "book" or "author" label.</li><li><code>towers #!book</code>: Search for notes containing "towers" and not having the "book" label.</li><li><code>#book #publicationYear = 1954</code>: Find notes with the "book" label and "publicationYear" set to 1954.</li><li><code>#genre *=* fan</code>: Find notes with the "genre" label containing the substring "fan". Additional operators include <code>*=*</code> for "contains", <code>=*</code> for "starts with", <code>*=</code> for "ends with", and <code>!=</code> for "is not equal to".</li><li><code>#book #publicationYear &gt;= 1950 #publicationYear &lt; 1960</code>: Use numeric operators to find all books published in the 1950s.</li><li><code>#dateNote &gt;= TODAY-30</code>: A "smart search" to find notes with the "dateNote" label within the last 30 days. Supported smart values include NOW +- seconds, TODAY +- days, MONTH +- months, YEAR +- years.</li><li><code>~author.title *=* Tolkien</code>: Find notes related to an author whose title contains "Tolkien".</li><li><code>#publicationYear %= '19[0-9]{2}'</code>: Use the '%=' operator to match a regular expression (regex). This feature has been available since Trilium 0.52.</li></ul><h3>Advanced Use Cases</h3><ul><li><code>~author.relations.son.title = 'Christopher Tolkien'</code>: Search for notes with an "author" relation to a note that has a "son" relation to "Christopher Tolkien". This can be modeled with the following note structure:<ul><li>Books<ul><li>Lord of the Rings<ul><li>label: “book”</li><li>relation: “author” points to “J. R. R. Tolkien” note</li></ul></li></ul></li><li>People<ul><li>J. R. R. Tolkien<ul><li>relation: “son” points to "Christopher Tolkien" note</li><li>Christopher Tolkien</li></ul></li></ul></li></ul></li><li><code>~author.title *= Tolkien OR (#publicationDate &gt;= 1954 AND #publicationDate &lt;= 1960)</code>: Use boolean expressions and parentheses to group expressions. Note that expressions starting with a parenthesis need an "expression separator sign" (# or ~) prepended.</li><li><code>note.parents.title = 'Books'</code>: Find notes with a parent named "Books".</li><li><code>note.parents.parents.title = 'Books'</code>: Find notes with a grandparent named "Books".</li><li><code>note.ancestors.title = 'Books'</code>: Find notes with an ancestor named "Books".</li><li><code>note.children.title = 'sub-note'</code>: Find notes with a child named "sub-note".</li></ul><h3>Search with Note Properties</h3><p>Notes have properties that can be used in searches, such as <code>noteId</code>, <code>dateModified</code>, <code>dateCreated</code>, <code>isProtected</code>, <code>type</code>, <code>title</code>, <code>text</code>, <code>content</code>, <code>rawContent</code>, <code>ownedLabelCount</code>, <code>labelCount</code>, <code>ownedRelationCount</code>, <code>relationCount</code>, <code>ownedRelationCountIncludingLinks</code>, <code>relationCountIncludingLinks</code>, <code>ownedAttributeCount</code>, <code>attributeCount</code>, <code>targetRelationCount</code>, <code>targetRelationCountIncludingLinks</code>, <code>parentCount</code>, <code>childrenCount</code>, <code>isArchived</code>, <code>contentSize</code>, <code>noteSize</code>, and <code>revisionCount</code>.</p><p>These properties can be accessed via the <code>note.</code> prefix, e.g., <code>note.type = code AND note.mime = 'application/json'</code>.</p><h3>Order by and Limit</h3><pre><code class="language-text-x-trilium-auto">#author=Tolkien orderBy #publicationDate desc, note.title limit 10</code></pre><p>This example will:</p><ol><li>Find notes with the author label "Tolkien".</li><li>Order the results by <code>publicationDate</code> in descending order.</li><li>Use <code>note.title</code> as a secondary ordering if publication dates are equal.</li><li>Limit the results to the first 10 notes.</li></ol><h3>Negation</h3><p>Some queries can only be expressed with negation:</p><pre><code class="language-text-x-trilium-auto">#book AND not(note.ancestor.title = 'Tolkien')</code></pre><p>This query finds all book notes not in the "Tolkien" subtree.</p><h2>Under the Hood</h2><h3>Label and Relation Shortcuts</h3><p>The "full" syntax for searching by labels is:</p><pre><code class="language-text-x-trilium-auto">note.labels.publicationYear = 1954</code></pre><p>For relations:</p><pre><code class="language-text-x-trilium-auto">note.relations.author.title *=* Tolkien</code></pre><p>However, common label and relation searches have shortcut syntax:</p><pre><code class="language-text-x-trilium-auto">#publicationYear = 1954
  #author.title *=* Tolkien</code></pre><h3>Separating Full-Text and Attribute Parts</h3><p>Search syntax allows combining full-text search with attribute-based search seamlessly. For example, <code>tolkien #book</code> contains:</p><ol><li>Full-text tokens - <code>tolkien</code></li><li>Attribute expressions - <code>#book</code></li></ol><p>Trilium detects the separation between full text search and attribute/property search by looking for certain special characters or words that denote attributes and properties (e.g., #, ~, note.). If you need to include these in full-text search, escape them with a backslash so they are processed as regular text:</p><pre><code class="language-text-x-trilium-auto">"note.txt" 
  \#hash 
  #myLabel = 'Say "Hello World"'</code></pre><h3>Escaping Special Characters</h3><p>Special characters can be enclosed in quotes or escaped with a backslash to be used in full-text search:</p><pre><code class="language-text-x-trilium-auto">"note.txt"
  \#hash
  #myLabel = 'Say "Hello World"'</code></pre><p>Three types of quotes are supported: single, double, and backtick.</p><h3>Type Coercion</h3><p>Label values are technically strings but can be coerced for numeric comparisons:</p><pre><code class="language-text-x-trilium-auto">note.dateCreated =* '2019-05'</code></pre><p>This finds notes created in May 2019. Numeric operators like <code>#publicationYear &gt;= 1960</code> convert string values to numbers for comparison.</p><h2>Auto-Trigger Search from URL</h2><p>You can open Trilium and automatically trigger a search by including the search <a href="https://meyerweb.com/eric/tools/dencoder/">url encoded</a> string in the URL:</p><p><code>http://localhost:8080/#?searchString=abc</code></p>


