-
Attributes
In Trilium, attributes are key-value pairs assigned to notes, providing additional metadata or functionality. There are two primary types of attributes:
Labels can be used for a variety of purposes, such as storing metadata or configuring the behavior of notes. Labels are also searchable, enhancing note retrieval.
For more information, including predefined labels, see Labels.
Relations define connections between notes, similar to links. These can be used for metadata and scripting purposes.
-
Templates
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:
A typical example would be a "Book" template note, which might include:
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.
To create an instance note through the UI:
-
Snippets
Snippets let you define reusable pieces of text, Markdown or code that can be quickly inserted into your notes.
-
Note Map (Link map, Tree map)
Note map is a visualization of connections between notes. This provides an insight into a structure ("web") of notes.
There are two types of note map:
The note map comes into multiple flavors:
The link map is a visualization of links and Relations incoming to and outgoing from a particular note.
The map indicates the following types of relations:
The link map will also show unlinked notes that are part of the hierarchy as a cloud of unconnected dots.
-
Sharing
Trilium allows you to share selected notes as publicly accessible read-only documents. This feature is particularly useful for publishing content directly from your Trilium notes, making it accessible to others online.
While the sharing feature is powerful, it has some limitations:
Some of these limitations may be addressed in future updates.
To use the sharing feature, you must have a Server Installation of Trilium. This is necessary because the notes will be hosted from the server.
-
Advanced Showcases
Trilium offers advanced functionality through Scripts and Promoted Attributes. To illustrate these features, we've prepared several showcases available in the demo notes:
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.
-
Customizing to-do task states
Trilium features customizable to-do list task states. To customize them, go to Options → Text Notes → Related settings → Custom checkbox states for to-do lists. Alternatively, right-click a checkbox in an editable text note and click the pencil icon; on the Mobile Frontend, the pencil icon is in the row of the List › button of a to-do list.
Changes take effect only after restarting the application.
-
Custom Request Handler
Trilium provides a mechanism for scripts 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. /trilium buy milk).
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.
We'll start with creating a JavaScript backend code note containing:
-
Custom Resource Providers
A custom resource provider allows any file imported into Trilium (images, fonts, stylesheets) to be publicly accessible via a URL.
A potential use case for this is to add embed a custom font alongside a theme.
Instead of hello, the name can be:
For example, if you have a custom font to be imported by the theme, first upload a font file into Trilium and assign it the #customResourceProvider=fonts/myfont.ttf attribute.
Then modify the theme CSS to point to:
-
ETAPI (REST API)
For a quick start, consult the API Reference.
ETAPI is Trilium's public/external REST API. It is available since Trilium v0.50.
As an alternative to calling the API directly, there are client libraries to simplify this
All operations with the REST API have to be authenticated using a token. You can get this token either from Options → ETAPI or programmatically using the /auth/login REST call (see the spec).
-
Default Note Title
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.
For this use case, Trilium (since v0.52) supports #titleTemplate label. 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.
-
Database
Your Trilium data is stored in a SQLite database which contains all notes, tree structure, metadata, and most of the configuration. The database file is named document.db and is stored in the application's default Data directory.
When first starting Trilium, it will provide a set of notes to showcase various features of the application.
For more information see Demo Notes.
Trilium provides a lot of flexibility, and with it, opportunities for advanced users to tweak it.
-
Configuration (config.ini or environment variables)
Trilium supports configuration via a file named config.ini and environment variables. This document provides a comprehensive reference for all configuration options.
The configuration file is not located in the same directory as the application. Instead, the config.ini is located in the Data directory. As such, the configuration file is only available after starting the application and creating a database.
Configuration values are loaded in the following order of precedence (highest to lowest):
-
Bulk Actions
The Bulk Actions dialog makes it easy to apply changes to multiple notes at once, ranging from simple actions such as adding or removing a label to being executing custom scripts.
These actions operate the Labels of a note. Except for Add label, they only affect labels set directly on the note; inherited labels are left unchanged.
These actions operate the Relations of a note. Except for Add relation, they only affect relations set directly on the note; inherited relations are left unchanged.
-
Note source
Internally, the structure of the content of each note is different based on the Note Types.
For example:
Note that some information is also stored as Attachments. For example Canvas notes use the attachments feature to store the custom libraries, and alongside with Mind Map and other similar note types it stores an SVG representation of the content for use in other features such as including in other notes, shared notes, etc.
-
Technologies used
One core aspect of Trilium that allows it to have support for multiple Note Types is the fact that it makes use of various off-the-shelf or reusable libraries.
This page showcases some of the technologies used, for a better understanding of how Trilium works but also to credit the developers of that particular technology.
-
Note ID
Whereas some applications use file names to uniquely identify notes, Trilium uses the concept of Note ID.
Generally, the Note ID is a 12-character long alphanumeric sequence (including both lower and upper case letter) that is randomly generated for each new note.
When notes are exported, their note ID is kept in the metadata of the export. However when they are imported back in, a new note ID is generated for all the notes.
-
Internal API
-
Hidden Notes
For easy extensibility, a lot of features in Trilium make use of actual notes to store information as opposed to having them stored in a separate location in the database. This allows some functions such as Attributes, Relations or even Search and Links to be able to operate on them.
As the name suggests, these notes are hidden to the user by default to prevent cluttering the note tree and to prevent them from being accidentally deleted.
-
Metrics
The Trilium Metrics API provides comprehensive monitoring data about your Trilium instance, designed for external monitoring systems like Prometheus.
You need an ETAPI token to access the metrics endpoint. Get one by:
Prometheus Format (Default)
Returns metrics in Prometheus text format:
JSON Format
Returns detailed metrics in JSON format for debugging or custom integrations.
Add to your prometheus.yml:
-
Safe mode
Safe mode is triggered by setting the TRILIUM_SAFE_MODE environment variable to a truthy value, usually 1.
In each artifact there is a trilium-safe-mode.sh (or .bat) script to enable it.
What it does:
-
Nightly release
Nightly releases are versions built every day, containing the latest improvements and bugfixes, directly from the main development branch. These versions are generally useful in preparation for a release, to ensure that there are no significant bugs that need to be addressed first, or they can be used to confirm whether a particular bug is fixed or feature is well implemented.
-
Read-only database
This functionality is still in preview, expect possible issues or even the feature disappearing completely. Feel free to report any issues you might have.
The read-only database is an alternative to Sharing notes. Although the share functionality works pretty well to publish pages to the Internet in a wiki, blog-like format it does not offer the full functionality behind Trilium (such as the advanced Search or the interactivity behind Collections or the various Note Types).
-
Text Extraction (OCR)
Optical Character Recognition is the process in which the text from images or PDFs is extracted.
Since v0.103.0, Trilium has built-in support for OCR. The extracted text can be:
OCR in Trilium supports the following formats:
The PDF extraction supports:
Note that OCR extraction is limited to 50 pages per PDF, pages containing text information (not as an image) are not subject to this limitation.
Text extraction for scanned PDFs using OCR was introduced in v0.106.0.