chore(monorepo): put back docs
11576
docs/User Guide/!!!meta.json
Normal file
2
docs/User Guide/User Guide.md
Normal file
@@ -0,0 +1,2 @@
|
||||
# User Guide
|
||||
The sub-children of this note are automatically synced.
|
||||
BIN
docs/User Guide/User Guide/AI/1_AI Provider Information_im.png
Normal file
|
After Width: | Height: | Size: 186 KiB |
BIN
docs/User Guide/User Guide/AI/1_Introduction_image.png
Normal file
|
After Width: | Height: | Size: 168 KiB |
BIN
docs/User Guide/User Guide/AI/2_Introduction_image.png
Normal file
|
After Width: | Height: | Size: 43 KiB |
BIN
docs/User Guide/User Guide/AI/3_Introduction_image.png
Normal file
|
After Width: | Height: | Size: 172 KiB |
BIN
docs/User Guide/User Guide/AI/4_Introduction_image.png
Normal file
|
After Width: | Height: | Size: 167 KiB |
BIN
docs/User Guide/User Guide/AI/5_Introduction_image.png
Normal file
|
After Width: | Height: | Size: 237 KiB |
BIN
docs/User Guide/User Guide/AI/6_Introduction_image.png
Normal file
|
After Width: | Height: | Size: 202 KiB |
BIN
docs/User Guide/User Guide/AI/7_Introduction_image.png
Normal file
|
After Width: | Height: | Size: 49 KiB |
BIN
docs/User Guide/User Guide/AI/8_Introduction_image.png
Normal file
|
After Width: | Height: | Size: 80 KiB |
BIN
docs/User Guide/User Guide/AI/9_Introduction_image.png
Normal file
|
After Width: | Height: | Size: 191 KiB |
15
docs/User Guide/User Guide/AI/AI Provider Information.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# AI Provider Information
|
||||
Currently, we support the following providers:
|
||||
|
||||
* <a class="reference-link" href="AI%20Provider%20Information/Ollama">Ollama</a>
|
||||
* <a class="reference-link" href="AI%20Provider%20Information/OpenAI.md">OpenAI</a>
|
||||
* <a class="reference-link" href="AI%20Provider%20Information/Anthropic.md">Anthropic</a>
|
||||
* Voyage AI
|
||||
|
||||
To set your preferred chat model, you'll want to enter the provider's name here:
|
||||
|
||||
<figure class="image image_resized" style="width:88.38%;"><img style="aspect-ratio:1884/1267;" src="AI Provider Information_im.png" width="1884" height="1267"></figure>
|
||||
|
||||
And to set your preferred embedding provider:
|
||||
|
||||
<figure class="image image_resized" style="width:93.47%;"><img style="aspect-ratio:1907/1002;" src="1_AI Provider Information_im.png" width="1907" height="1002"></figure>
|
||||
|
After Width: | Height: | Size: 47 KiB |
|
After Width: | Height: | Size: 270 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 89 KiB |
@@ -0,0 +1,25 @@
|
||||
# Installing Ollama
|
||||
[Ollama](https://ollama.com/) can be installed in a variety of ways, and even runs [within a Docker container](https://hub.docker.com/r/ollama/ollama). Ollama will be noticeably quicker when running on a GPU (Nvidia, AMD, Intel), but it can run on CPU and RAM. To install Ollama without any other prerequisites, you can follow their [installer](https://ollama.com/download):
|
||||
|
||||
<figure class="image image_resized" style="width:50.49%;"><img style="aspect-ratio:785/498;" src="3_Installing Ollama_image.png" width="785" height="498"></figure><figure class="image image_resized" style="width:40.54%;"><img style="aspect-ratio:467/100;" src="Installing Ollama_image.png" width="467" height="100"></figure><figure class="image image_resized" style="width:55.73%;"><img style="aspect-ratio:1296/1011;" src="1_Installing Ollama_image.png" width="1296" height="1011"></figure>
|
||||
|
||||
After their installer completes, if you're on Windows, you should see an entry in the start menu to run it:
|
||||
|
||||
<figure class="image image_resized" style="width:66.12%;"><img style="aspect-ratio:1161/480;" src="2_Installing Ollama_image.png" width="1161" height="480"></figure>
|
||||
|
||||
Also, you should have access to the `ollama` CLI via Powershell or CMD:
|
||||
|
||||
<figure class="image image_resized" style="width:86.09%;"><img style="aspect-ratio:1730/924;" src="5_Installing Ollama_image.png" width="1730" height="924"></figure>
|
||||
|
||||
After Ollama is installed, you can go ahead and `pull` the models you want to use and run. Here's a command to pull my favorite tool-compatible model and embedding model as of April 2025:
|
||||
|
||||
```
|
||||
ollama pull llama3.1:8b
|
||||
ollama pull mxbai-embed-large
|
||||
```
|
||||
|
||||
Also, you can make sure it's running by going to [http://localhost:11434](http://localhost:11434) and you should get the following response (port 11434 being the “normal” Ollama port):
|
||||
|
||||
<figure class="image"><img style="aspect-ratio:585/202;" src="4_Installing Ollama_image.png" width="585" height="202"></figure>
|
||||
|
||||
Now that you have Ollama up and running, have a few models pulled, you're ready to go to go ahead and start using Ollama as both a chat provider, and embedding provider!
|
||||
|
After Width: | Height: | Size: 5.3 KiB |
BIN
docs/User Guide/User Guide/AI/AI Provider Information_im.png
Normal file
|
After Width: | Height: | Size: 198 KiB |
89
docs/User Guide/User Guide/AI/Introduction.md
Normal file
@@ -0,0 +1,89 @@
|
||||
# Introduction
|
||||
<figure class="image image_resized" style="width:63.68%;"><img style="aspect-ratio:1363/1364;" src="Introduction_image.png" width="1363" height="1364"><figcaption>An example chat with an LLM</figcaption></figure>
|
||||
|
||||
The AI / LLM features within Trilium Notes are designed to allow you to interact with your Notes in a variety of ways, using as many of the major providers as we can support.
|
||||
|
||||
In addition to being able to send chats to LLM providers such as OpenAI, Anthropic, and Ollama - we also support agentic tool calling, and embeddings.
|
||||
|
||||
The quickest way to get started is to navigate to the “AI/LLM” settings:
|
||||
|
||||
<figure class="image image_resized" style="width:74.04%;"><img style="aspect-ratio:1916/1906;" src="5_Introduction_image.png" width="1916" height="1906"></figure>
|
||||
|
||||
Enable the feature:
|
||||
|
||||
<figure class="image image_resized" style="width:82.82%;"><img style="aspect-ratio:1911/997;" src="1_Introduction_image.png" width="1911" height="997"></figure>
|
||||
|
||||
## Embeddings
|
||||
|
||||
**Embeddings** are important as it allows us to have an compact AI “summary” (it's not human readable text) of each of your Notes, that we can then perform mathematical functions on (such as cosine similarity) to smartly figure out which Notes to send as context to the LLM when you're chatting, among other useful functions.
|
||||
|
||||
You will then need to set up the AI “provider” that you wish to use to create the embeddings for your Notes. Currently OpenAI, Voyage AI, and Ollama are supported providers for embedding generation.
|
||||
|
||||
In the following example, we're going to use our self-hosted Ollama instance to create the embeddings for our Notes. You can see additional documentation about installing your own Ollama locally in <a class="reference-link" href="AI%20Provider%20Information/Ollama/Installing%20Ollama.md">Installing Ollama</a>.
|
||||
|
||||
To see what embedding models Ollama has available, you can check out [this search](https://ollama.com/search?c=embedding)on their website, and then `pull` whichever one you want to try out. As of 4/15/25, my personal favorite is `mxbai-embed-large`.
|
||||
|
||||
First, we'll need to select the Ollama provider from the tabs of providers, then we will enter in the Base URL for our Ollama. Since our Ollama is running on our local machine, our Base URL is `http://localhost:11434`. We will then hit the “refresh” button to have it fetch our models:
|
||||
|
||||
<figure class="image image_resized" style="width:82.28%;"><img style="aspect-ratio:1912/1075;" src="4_Introduction_image.png" width="1912" height="1075"></figure>
|
||||
|
||||
When selecting the dropdown for the “Embedding Model”, embedding models should be at the top of the list, separated by regular chat models with a horizontal line, as seen below:
|
||||
|
||||
<figure class="image image_resized" style="width:61.73%;"><img style="aspect-ratio:1232/959;" src="8_Introduction_image.png" width="1232" height="959"></figure>
|
||||
|
||||
After selecting an embedding model, embeddings should automatically begin to be generated by checking the embedding statistics at the top of the “AI/LLM” settings panel:
|
||||
|
||||
<figure class="image image_resized" style="width:67.06%;"><img style="aspect-ratio:1333/499;" src="7_Introduction_image.png" width="1333" height="499"></figure>
|
||||
|
||||
If you don't see any embeddings being created, you will want to scroll to the bottom of the settings, and hit “Recreate All Embeddings”:
|
||||
|
||||
<figure class="image image_resized" style="width:65.69%;"><img style="aspect-ratio:1337/1490;" src="3_Introduction_image.png" width="1337" height="1490"></figure>
|
||||
|
||||
Creating the embeddings will take some time, and will be regenerated when a Note is created, updated, or deleted (removed).
|
||||
|
||||
If for some reason you choose to change your embedding provider, or the model used, you'll need to recreate all embeddings.
|
||||
|
||||
## Tools
|
||||
|
||||
Tools are essentially functions that we provide to the various LLM providers, and then LLMs can respond in a specific format that tells us what tool function and parameters they would like to invoke. We then execute these tools, and provide it as additional context in the Chat conversation.
|
||||
|
||||
These are the tools that currently exist, and will certainly be updated to be more effectively (and even more to be added!):
|
||||
|
||||
* `search_notes`
|
||||
* Semantic search
|
||||
* `keyword_search`
|
||||
* Keyword-based search
|
||||
* `attribute_search`
|
||||
* Attribute-specific search
|
||||
* `search_suggestion`
|
||||
* Search syntax helper
|
||||
* `read_note`
|
||||
* Read note content (helps the LLM read Notes)
|
||||
* `create_note`
|
||||
* Create a Note
|
||||
* `update_note`
|
||||
* Update a Note
|
||||
* `manage_attributes`
|
||||
* Manage attributes on a Note
|
||||
* `manage_relationships`
|
||||
* Manage the various relationships between Notes
|
||||
* `extract_content`
|
||||
* Used to smartly extract content from a Note
|
||||
* `calendar_integration`
|
||||
* Used to find date notes, create date notes, get the daily note, etc.
|
||||
|
||||
When Tools are executed within your Chat, you'll see output like the following:
|
||||
|
||||
<figure class="image image_resized" style="width:66.88%;"><img style="aspect-ratio:1372/1591;" src="6_Introduction_image.png" width="1372" height="1591"></figure>
|
||||
|
||||
You don't need to tell the LLM to execute a certain tool, it should “smartly” call tools and automatically execute them as needed.
|
||||
|
||||
## Overview
|
||||
|
||||
Now that you know about embeddings and tools, you can just go ahead and use the “Chat with Notes” button, where you can go ahead and start chatting!:
|
||||
|
||||
<figure class="image image_resized" style="width:60.77%;"><img style="aspect-ratio:1378/539;" src="2_Introduction_image.png" width="1378" height="539"></figure>
|
||||
|
||||
If you don't see the “Chat with Notes” button on your side launchbar, you might need to move it from the “Available Launchers” section to the “Visible Launchers” section:
|
||||
|
||||
<figure class="image image_resized" style="width:69.81%;"><img style="aspect-ratio:1765/1287;" src="9_Introduction_image.png" width="1765" height="1287"></figure>
|
||||
BIN
docs/User Guide/User Guide/AI/Introduction_image.png
Normal file
|
After Width: | Height: | Size: 175 KiB |
|
After Width: | Height: | Size: 76 KiB |
@@ -0,0 +1,9 @@
|
||||
# Advanced Showcases
|
||||
Trilium offers advanced functionality through [Scripts](../Scripting.md) and [Promoted Attributes](Attributes/Promoted%20Attributes.md). To illustrate these features, we've prepared several showcases available in the [demo notes](Database.md):
|
||||
|
||||
* [Relation Map](../Note%20Types/Relation%20Map.md)
|
||||
* [Day Notes](Advanced%20Showcases/Day%20Notes.md)
|
||||
* [Weight Tracker](Advanced%20Showcases/Weight%20Tracker.md)
|
||||
* [Task Manager](Advanced%20Showcases/Task%20Manager.md)
|
||||
|
||||
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.
|
||||
|
After Width: | Height: | Size: 23 KiB |
@@ -0,0 +1,103 @@
|
||||
# Day Notes
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
Select an existing day note, and the menubar contains a calendar widget. Select any day to create a note for that day.
|
||||
|
||||

|
||||
|
||||
This pattern works well also because of [Cloning Notes](../../Basic%20Concepts%20and%20Features/Notes/Cloning%20Notes.md) 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.
|
||||
|
||||
## Demo
|
||||
|
||||

|
||||
|
||||
You can see the structure of day notes appearing under "Journal" note - there's a note for the whole year 2025, under it, you have "03 - March" which then contains "09 - Monday". This is our "day note" which contains some text in its content and also has some child notes (some of them are from [Task manager](Task%20Manager.md)).
|
||||
|
||||
You can also notice how this day note has [promoted attribute](../Attributes/Promoted%20Attributes.md) "weight" where you can track your daily weight. This data is then used in [Weight tracker](Weight%20Tracker.md).
|
||||
|
||||
## Week Note and Quarter Note
|
||||
|
||||
Week and quarter notes are disabled by default, since it might be too much for some people. To enable them, you need to set `#enableWeekNotes` and `#enableQuarterNotes` attributes on the root calendar note, which is identified by `#calendarRoot` label. Week note is affected by the first week of year option. Be careful when you already have some week notes created, it will not automatically change the existing week notes and might lead to some duplicates.
|
||||
|
||||
## Templates
|
||||
|
||||
Trilium provides [template](../Templates.md) functionality, and it could be used together with day notes.
|
||||
|
||||
You can define one of the following relations on the root of the journal (identified by `#calendarRoot` label):
|
||||
|
||||
* yearTemplate
|
||||
* quarterTemplate (if `#enableQuarterNotes` is set)
|
||||
* monthTemplate
|
||||
* weekTemplate (if `#enableWeekNotes` is set)
|
||||
* dateTemplate
|
||||
|
||||
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 `~template` relation to the newly created role. Using this, you can e.g. create your daily template with e.g. checkboxes for daily routine etc.
|
||||
|
||||
## Naming pattern
|
||||
|
||||
You can customize the title of generated journal notes by defining a `#datePattern`, `#weekPattern`, `#monthPattern`, `#quarterPattern` and `#yearPattern` attribute on a root calendar note (identified by `#calendarRoot` label). The naming pattern replacements follow a level-up compatibility - each level can use replacements from itself and all levels above it. For example, `#monthPattern` can use month, quarter and year replacements, while `#weekPattern` can use week, month, quarter and year replacements. But it is not possible to use week replacements in `#monthPattern`.
|
||||
|
||||
### Date pattern
|
||||
|
||||
It's possible to customize the title of generated date notes by defining a `#datePattern` attribute on a root calendar note (identified by `#calendarRoot` label). Following are possible values:
|
||||
|
||||
* `{isoDate}` results in an ISO 8061 formatted date (e.g. "2025-03-09" for March 9, 2025)
|
||||
* `{dateNumber}` results in a number like `9` for the 9th day of the month, `11` for the 11th day of the month
|
||||
* `{dateNumberPadded}` results in a number like `09` for the 9th day of the month, `11` for the 11th day of the month
|
||||
* `{ordinal}` is replaced with the ordinal date (e.g. 1st, 2nd, 3rd) etc.
|
||||
* `{weekDay}` results in the full day name (e.g. `Monday`)
|
||||
* `{weekDay3}` is replaced with the first 3 letters of the day, e.g. Mon, Tue, etc.
|
||||
* `{weekDay2}` is replaced with the first 2 letters of the day, e.g. Mo, Tu, etc.
|
||||
|
||||
The default is `{dateNumberPadded} - {weekDay}`
|
||||
|
||||
### Week pattern
|
||||
|
||||
It is also possible to customize the title of generated week notes through the `#weekPattern` attribute on the root calendar note. The options are:
|
||||
|
||||
* `{weekNumber}` results in a number like `9` for the 9th week of the year, `11` for the 11th week of the year
|
||||
* `{weekNumberPadded}` results in a number like `09` for the 9th week of the year, `11` for the 11th week of the year
|
||||
* `{shortWeek}` results in a short week string like `W9` for the 9th week of the year, `W11` for the 11th week of the year
|
||||
* `{shortWeek3}` results in a short week string like `W09` for the 9th week of the year, `W11` for the 11th week of the year
|
||||
|
||||
The default is `Week {weekNumber}`
|
||||
|
||||
### Month pattern
|
||||
|
||||
It is also possible to customize the title of generated month notes through the `#monthPattern` attribute on the root calendar note. The options are:
|
||||
|
||||
* `{isoMonth}` results in an ISO 8061 formatted month (e.g. "2025-03" for March 2025)
|
||||
* `{monthNumber}` results in a number like `9` for September, and `11` for November
|
||||
* `{monthNumberPadded}` results in a number like `09` for September, and `11` for November
|
||||
* `{month}` results in the full month name (e.g. `September` or `October`)
|
||||
* `{shortMonth3}` is replaced with the first 3 letters of the month, e.g. Jan, Feb, etc.
|
||||
* `{shortMonth4}` is replaced with the first 4 letters of the month, e.g. Sept, Octo, etc.
|
||||
|
||||
The default is `{monthNumberPadded} - {month}`
|
||||
|
||||
### Quarter pattern
|
||||
|
||||
It is also possible to customize the title of generated quarter notes through the `#quarterPattern` attribute on the root calendar note. The options are:
|
||||
|
||||
* `{quarterNumber}` results in a number like `1` for the 1st quarter of the year
|
||||
* `{shortQuarter}` results in a short quarter string like `Q1` for the 1st quarter of the year
|
||||
|
||||
The default is `Quarter {quarterNumber}`
|
||||
|
||||
### Year pattern
|
||||
|
||||
It is also possible to customize the title of generated year notes through the `#yearPattern` attribute on the root calendar note. The options are:
|
||||
|
||||
* `{year}` results in the full year (e.g. `2025`)
|
||||
|
||||
The default is `{year}`
|
||||
|
||||
## Implementation
|
||||
|
||||
Trilium has some special support for day notes in the form of [backend Script API](https://triliumnext.github.io/Notes/backend_api/BackendScriptApi.html) - see e.g. getDayNote() function.
|
||||
|
||||
Day (and year, month) notes are created with a label - e.g. `#dateNote="2025-03-09"` this can then be used by other scripts to add new notes to day note etc.
|
||||
|
||||
Journal also has relation `child:child:child:template=Day template` (see \[\[attribute inheritance\]\]) which effectively adds \[\[template\]\] to day notes (grand-grand-grand children of Journal). Please note that, when you enable week notes or quarter notes, it will not automatically change the relation for the child level.
|
||||
|
After Width: | Height: | Size: 59 KiB |
@@ -0,0 +1,63 @@
|
||||
# Task Manager
|
||||
Task Manager is a [promoted attributes](../Attributes/Promoted%20Attributes.md) and [scripts](../../Scripting.md)showcase present in the [demo notes](../Database.md).
|
||||
|
||||
## Demo
|
||||
|
||||

|
||||
|
||||
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.
|
||||
|
||||
Task Manager also integrates with [day notes](Day%20Notes.md) - notes are [cloned](../../Basic%20Concepts%20and%20Features/Notes/Cloning%20Notes.md) into day note to both todoDate note and doneDate note (with [prefix](../../Basic%20Concepts%20and%20Features/Navigation/Tree%20Concepts.md) of either "TODO" or "DONE").
|
||||
|
||||
## Implementation
|
||||
|
||||
New tasks are created in the TODO note which has `~child:template` [relation](../Attributes.md)(see [attribute inheritance](../Attributes/Attribute%20Inheritance.md)) pointing to the task template.
|
||||
|
||||
### Attributes
|
||||
|
||||
Task template defines several [promoted attributes](../Attributes/Promoted%20Attributes.md) - todoDate, doneDate, tags, location. Importantly it also defines `~runOnAttributeChange` relation - [event](../../Scripting/Events.md) handler which is run on attribute change. This [script](../../Scripting.md) 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.
|
||||
|
||||
### New task button
|
||||
|
||||
There's also "button" note which contains simple script which adds a button to create new note (task) in the TODO note.
|
||||
|
||||
```
|
||||
api.addButtonToToolbar({
|
||||
title: 'New task',
|
||||
icon: 'check',
|
||||
shortcut: 'alt+n',
|
||||
action: async () => {
|
||||
// creating notes is backend (server) responsibility so we need to pass
|
||||
// the control there
|
||||
const taskNoteId = await api.runOnBackend(async () => {
|
||||
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);
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
### CSS
|
||||
|
||||
In the demo screenshot above you may notice that TODO tasks are in red color and DONE tasks are green.
|
||||
|
||||
This is done by having this CSS [code note](../../Note%20Types/Code.md) which defines extra CSS classes:
|
||||
|
||||
```
|
||||
span.fancytree-node.todo .fancytree-title {
|
||||
color: red !important;
|
||||
}
|
||||
|
||||
span.fancytree-node.done .fancytree-title {
|
||||
color: green !important;
|
||||
}
|
||||
```
|
||||
|
||||
This [code note](../../Note%20Types/Code.md) has `#appCss` [label](../Attributes.md)which is recognized by Trilium on startup and loaded as CSS into the application.
|
||||
|
||||
Second part of this functionality is based in event handler described above which assigns `#cssClass` label to the task to either "done" or "todo" based on the task status.
|
||||
|
After Width: | Height: | Size: 158 KiB |
@@ -0,0 +1,70 @@
|
||||
# Weight Tracker
|
||||

|
||||
|
||||
The `Weight Tracker` is a [Script API](../../Scripting/Script%20API.md) showcase present in the [demo notes](../Database.md).
|
||||
|
||||
By adding `weight` as a [promoted attribute](../Attributes/Promoted%20Attributes.md) in the [template](../Templates.md) from which [day notes](Day%20Notes.md) are created, you can aggregate the data and plot weight change over time.
|
||||
|
||||
## Implementation
|
||||
|
||||
The `Weight Tracker` note in the screenshot above is of the type `Render Note`. That type of note doesn't have any useful content itself. Instead it is a placeholder where a [script](../../Scripting.md) can render its output.
|
||||
|
||||
Scripts for `Render Notes` are defined in a [relation](../Attributes.md) called `~renderNote`. In this example, it's the `Weight Tracker`'s child `Implementation`. The Implementation consists of two [code notes](../../Note%20Types/Code.md) that contain some HTML and JavaScript respectively, which load all the notes with a `weight` attribute and display their values in a chart.
|
||||
|
||||
To actually render the chart, we're using a third party library called [chart.js](https://www.chartjs.org/)which is imported as an attachment, since it's not built into Trilium.
|
||||
|
||||
### Code
|
||||
|
||||
Here's the content of the script which is placed in a [code note](../../Note%20Types/Code.md) of type `JS Frontend`:
|
||||
|
||||
```
|
||||
async function getChartData() {
|
||||
const days = await api.runOnBackend(async () => {
|
||||
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 && weight) {
|
||||
days.push({ date, weight });
|
||||
}
|
||||
}
|
||||
|
||||
days.sort((a, b) => a.date > b.date ? 1 : -1);
|
||||
|
||||
return days;
|
||||
});
|
||||
|
||||
const datasets = [
|
||||
{
|
||||
label: "Weight (kg)",
|
||||
backgroundColor: 'red',
|
||||
borderColor: 'red',
|
||||
data: days.map(day => day.weight),
|
||||
fill: false,
|
||||
spanGaps: true,
|
||||
datalabels: {
|
||||
display: false
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
return {
|
||||
datasets: datasets,
|
||||
labels: days.map(day => day.date)
|
||||
};
|
||||
}
|
||||
|
||||
const ctx = $("#canvas")[0].getContext("2d");
|
||||
|
||||
new chartjs.Chart(ctx, {
|
||||
type: 'line',
|
||||
data: await getChartData()
|
||||
});
|
||||
```
|
||||
|
||||
## How to remove the Weight Tracker button from the top bar
|
||||
|
||||
In the link map of the `Weight Tracker`, there is a note called `Button`. Open it and delete or comment out its contents. The `Weight Tracker` button will disappear after you restart Trilium.
|
||||
|
After Width: | Height: | Size: 68 KiB |
31
docs/User Guide/User Guide/Advanced Usage/Attributes.md
Normal file
@@ -0,0 +1,31 @@
|
||||
# Attributes
|
||||
<figure class="image"><img style="aspect-ratio:1071/146;" src="Attributes_image.png" width="1071" height="146"></figure>
|
||||
|
||||
In Trilium, attributes are key-value pairs assigned to notes, providing additional metadata or functionality. There are two primary types of attributes:
|
||||
|
||||
1. <a class="reference-link" href="Attributes/Labels.md">Labels</a> can be used for a variety of purposes, such as storing metadata or configuring the behaviour of notes. Labels are also searchable, enhancing note retrieval.
|
||||
|
||||
For more information, including predefined labels, see <a class="reference-link" href="Attributes/Labels.md">Labels</a>.
|
||||
2. <a class="reference-link" href="Attributes/Relations.md">Relations</a> define connections between notes, similar to links. These can be used for metadata and scripting purposes.
|
||||
|
||||
For more information, including a list of predefined relations, see <a class="reference-link" href="Attributes/Relations.md">Relations</a>.
|
||||
|
||||
These attributes play a crucial role in organizing, categorising, and enhancing the functionality of notes.
|
||||
|
||||
## Viewing the list of attributes
|
||||
|
||||
Both the labels and relations for the current note are displayed in the _Owned Attributes_ section of the <a class="reference-link" href="../Basic%20Concepts%20and%20Features/UI%20Elements/Ribbon.md">Ribbon</a>, where they can be viewed and edited. Inherited attributes are displayed in the _Inherited Attributes_ section of the ribbon, where they can only be viewed.
|
||||
|
||||
In the list of attributes, labels are prefixed with the `#` character whereas relations are prefixed with the `~` character.
|
||||
|
||||
## Multiplicity
|
||||
|
||||
Attributes in Trilium can be "multi-valued", meaning multiple attributes with the same name can co-exist.
|
||||
|
||||
## Attribute Definitions and Promoted Attributes
|
||||
|
||||
Special labels create "label/attribute" definitions, enhancing the organization and management of attributes. For more details, see <a class="reference-link" href="Attributes/Promoted%20Attributes.md">Promoted Attributes</a>.
|
||||
|
||||
## Attribute Inheritance
|
||||
|
||||
Trilium supports attribute inheritance, allowing child notes to inherit attributes from their parents. For more information, see <a class="reference-link" href="Attributes/Attribute%20Inheritance.md">Attribute Inheritance</a>.
|
||||
@@ -0,0 +1,38 @@
|
||||
# Attribute Inheritance
|
||||
Inheritance refers to the process of having a [label](Labels.md) or a [relation](Relations.md) shared across multiple notes, generally in parent-child relations (or anywhere if using templates).
|
||||
|
||||
## Standard Inheritance
|
||||
|
||||
In Trilium, attributes can be automatically inherited by child notes if they have the `isInheritable` flag set to `true`. This means the attribute (a key-value pair) is applied to the note and all its descendants.
|
||||
|
||||
To make an attribute inheritable, simply use the visual editor for <a class="reference-link" href="Labels.md">Labels</a> or <a class="reference-link" href="Relations.md">Relations</a>. Alternatively, the attribute can be manually defined where `#myLabel=value` becomes `#myLabel(inheritable)=value` when inheritable.
|
||||
|
||||
As an example, the `archived` label can be set to be inheritable, allowing you to hide a whole subtree of notes from searches and other dialogs by applying this label at the top level.
|
||||
|
||||
Standard inheritance forces all the notes that are children (and sub-children) of a note to have that particular label or relation. If there is a need to have some notes not inherit one of the labels, then _copying inheritance_ or _template inheritance_ needs to be used instead.
|
||||
|
||||
## Copying Inheritance
|
||||
|
||||
Copying inheritance differs from standard inheritance by using a `child:` prefix in the attribute name. This prefix causes new child notes to automatically receive specific attributes from the parent note. These attributes are independent of the parent and will persist even if the note is moved elsewhere.
|
||||
|
||||
If a parent note has the label `#child:exampleAttribute`, all newly created child notes (one level deep) will inherit the `#exampleAttribute` label. This can be useful for setting default properties for notes in a specific section.
|
||||
|
||||
Similarly, for relations use `~child:myRelation`.
|
||||
|
||||
Due to the way it's designed, copying inheritance cannot be used to cascade infinitely within a hierarchy. For that use case, consider using either standard inheritance or templates.
|
||||
|
||||
### Chained inheritance
|
||||
|
||||
It is possible to define labels across multiple levels of depth. For example, `#child:child:child:foo` applied to a root note would create:
|
||||
|
||||
* `#child:child:foo` on the first-level children.
|
||||
* `#child:foo` on the second-level children.
|
||||
* `#foo` on the third-level children.
|
||||
|
||||
Similarly, use `~child:child:child:foo` if dealing with relations.
|
||||
|
||||
Do note that same as simple copying inheritance, the changes will not apply retroactively to existing notes in the hierarchy, it will only apply to the newly created notes.
|
||||
|
||||
## Template Inheritance
|
||||
|
||||
Attributes can also be inherited from <a class="reference-link" href="../Templates.md">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.
|
||||
@@ -0,0 +1,32 @@
|
||||
# Promoted Attributes
|
||||
Promoted attributes are [attributes](../Attributes.md) which are considered important and thus are "promoted" onto the main note UI. See example below:
|
||||
|
||||

|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
Now, how do we make attribute to appear on the UI?
|
||||
|
||||
## Attribute definition
|
||||
|
||||
Attribute is always name-value pair where both name and value are strings.
|
||||
|
||||
_Attribute definition_ 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 _promote_ the attribute or not?
|
||||
|
||||

|
||||
|
||||
You can notice tag attribute definition. These "definition" attributes define how the "value" attributes should behave.
|
||||
|
||||
So there's one attribute for value and one for definition. But notice how definition attribute is [Inheritable](Attribute%20Inheritance.md), 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.
|
||||
|
||||
### Inverse relation
|
||||
|
||||
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 `isPartnerOf`. 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.
|
||||
|
||||
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 `isParentOf` and the other one going from child to parent might be called `isChildOf`.
|
||||
|
||||
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 `isParentOf` which defines `isChildOf` as inverse relation and then second relation definition for `isChildOf` which defines `isParentOf` as inverse relation.
|
||||
|
||||
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.
|
||||
|
After Width: | Height: | Size: 113 KiB |
|
After Width: | Height: | Size: 44 KiB |
@@ -0,0 +1,44 @@
|
||||
# Relations
|
||||
A relation is similar to a [label](Labels.md), but instead of having a text value it refers to another note.
|
||||
|
||||
## Common use cases
|
||||
|
||||
* **Metadata Relationships for personal use**: For example, linking a book note to an author note.
|
||||
This can be combined with <a class="reference-link" href="Promoted%20Attributes.md">Promoted Attributes</a> to make their display more user-friendly.
|
||||
* **Configuration**: For configuring some notes such as <a class="reference-link" href="../../Note%20Types/Render%20Note.md">Render Note</a>, or configuring <a class="reference-link" href="../Sharing.md">Sharing</a> or <a class="reference-link" href="../Templates.md">Templates</a> (see the list below).
|
||||
* **Scripting**: Attaching scripts to events or conditions related to the note.
|
||||
|
||||
## Creating a relation using the visual editor
|
||||
|
||||
1. Go to the _Owned Attributes_ section in the <a class="reference-link" href="../../Basic%20Concepts%20and%20Features/UI%20Elements/Ribbon.md">Ribbon</a>.
|
||||
2. Press the + button (_Add new attribute_) to the right.
|
||||
3. Select _Add new relation_ for the relation.
|
||||
|
||||
> [!TIP]
|
||||
> If you prefer keyboard shortcuts, press <kbd>Alt</kbd>+<kbd>L</kbd> while focused on a note or in the _Owned Attributes_ section to display the visual editor.
|
||||
|
||||
While in the visual editor:
|
||||
|
||||
* Set the desired name
|
||||
* Set the Target note (the note to point to). Unlike labels, relations cannot exist with a target note.
|
||||
* Check _Inheritable_ if the label should be inherited by the child notes as well. See <a class="reference-link" href="Attribute%20Inheritance.md">Attribute Inheritance</a> for more information.
|
||||
|
||||
## Creating a relation manually
|
||||
|
||||
In the _Owned Attributes_ section in the <a class="reference-link" href="../../Basic%20Concepts%20and%20Features/UI%20Elements/Ribbon.md">Ribbon</a>:
|
||||
|
||||
* To create a relation called `myRelation`:
|
||||
* First type `~myRelation=@` .
|
||||
* After this, an autocompletion box should appear.
|
||||
* Type the title of the note to point to and press <kbd>Enter</kbd> to confirm (or click the desired note).
|
||||
* Alternatively copy a note from the <a class="reference-link" href="../../Basic%20Concepts%20and%20Features/UI%20Elements/Note%20Tree.md">Note Tree</a> and paste it after the `=` sign (without the `@` , in this case).
|
||||
* To create an inheritable relation, follow the same steps as previously described but instead of `~myRelation` write `~myRelation(inheritable)`.
|
||||
|
||||
## Predefined relations
|
||||
|
||||
These relations are supported and used internally by Trilium.
|
||||
|
||||
> [!TIP]
|
||||
> Some relations presented here end with a `*`. That means that there are multiple relations with the same prefix, consult the specific page linked in the description of that relation for more information.
|
||||
|
||||
<figure class="table" style="width:100%;"><table class="ck-table-resized"><colgroup><col style="width:33.95%;"><col style="width:66.05%;"></colgroup><thead><tr><th>Label</th><th>Description</th></tr></thead><tbody><tr><td><code>runOn*</code></td><td>See <a class="reference-link" href="../../Scripting/Events.md">Events</a></td></tr><tr><td><code>template</code></td><td>note's attributes will be inherited even without a parent-child relationship, note's content and subtree will be added to instance notes if empty. See documentation for details.</td></tr><tr><td><code>inherit</code></td><td>note's attributes will be inherited even without a parent-child relationship. See <a class="reference-link" href="../Templates.md">Templates</a> for a similar concept. See <a class="reference-link" href="Attribute%20Inheritance.md">Attribute Inheritance</a> in the documentation.</td></tr><tr><td><code>renderNote</code></td><td>notes of type <a class="reference-link" href="../../Note%20Types/Render%20Note.md">Render Note</a> will be rendered using a code note (HTML or script) and it is necessary to point using this relation to which note should be rendered</td></tr><tr><td><code>widget_relation</code></td><td>target of this relation will be executed and rendered as a widget in the sidebar</td></tr><tr><td><code>shareCss</code></td><td>CSS note which will be injected into the share page. CSS note must be in the shared sub-tree as well. Consider using <code>share_hidden_from_tree</code> and <code>share_omit_default_css</code> as well.</td></tr><tr><td><code>shareJs</code></td><td>JavaScript note which will be injected into the share page. JS note must be in the shared sub-tree as well. Consider using <code>share_hidden_from_tree</code>.</td></tr><tr><td><code>shareTemplate</code></td><td>Embedded JavaScript note that will be used as the template for displaying the shared note. Falls back to the default template. Consider using <code>share_hidden_from_tree</code>.</td></tr><tr><td><code>shareFavicon</code></td><td>Favicon note to be set in the shared page. Typically you want to set it to share root and make it inheritable. Favicon note must be in the shared sub-tree as well. Consider using <code>share_hidden_from_tree</code>.</td></tr></tbody></table></figure>
|
||||
BIN
docs/User Guide/User Guide/Advanced Usage/Attributes_image.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
86
docs/User Guide/User Guide/Advanced Usage/Bulk Actions.md
Normal file
@@ -0,0 +1,86 @@
|
||||
# Bulk Actions
|
||||
<figure class="image"><img style="aspect-ratio:1425/654;" src="Bulk Actions_image.png" width="1425" height="654"></figure>
|
||||
|
||||
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.
|
||||
|
||||
## Interaction
|
||||
|
||||
* The first step is to select the notes in the <a class="reference-link" href="../Basic%20Concepts%20and%20Features/UI%20Elements/Note%20Tree.md">Note Tree</a>. It's possible to apply bulk actions to:
|
||||
* A single note (and potentially its child notes) simply by clicking on it (with a left click or a right click).
|
||||
* Multiple notes. See <a class="reference-link" href="../Basic%20Concepts%20and%20Features/UI%20Elements/Note%20Tree/Multiple%20selection.md">Multiple selection</a> on how to do so.
|
||||
* Right click in the <a class="reference-link" href="../Basic%20Concepts%20and%20Features/UI%20Elements/Note%20Tree.md">Note Tree</a> and select _Advanced_ → _Apply bulk actions_.
|
||||
* By default, only the selected notes will be affected. To also include all the descendants of the notes, check _Include descendants of the selected notes_. The number of affected notes at the top of the dialog will update to reflect the change.
|
||||
* Click on which action to apply from the _Available actions_ section. A detailed description of each is available in the next section.
|
||||
* For each action selected, the _Chosen actions_ section will update to reveal the entry. Each action will have its own configuration.
|
||||
* To remove an action, simply press the X button to the right of it.
|
||||
* It is possible to apply multiple actions of the same type, such as adding multiple types.
|
||||
* When all the actions are defined, press _Execute bulk actions_ to trigger all of them at once.
|
||||
* For convenience, the last bulk action configuration is saved for further use and will be restored when entering the dialog again.
|
||||
|
||||
## Actions
|
||||
|
||||
### Labels
|
||||
|
||||
These actions operate the <a class="reference-link" href="Attributes/Labels.md">Labels</a> of a note:
|
||||
|
||||
* **Add label**
|
||||
* For each note, if it doesn't already have a [label](Attributes/Labels.md) of the given name, it will create it. Keep the _New value_ field empty to create a label without a value, or complete it to assign a value.
|
||||
* If a note already has this label, its value will be updated.
|
||||
* **Update label value**
|
||||
* For each note, if it has a [label](Attributes/Labels.md) of the given name, it will change its value to the specified one. Leave _New value_ field empty to create a label without a value.
|
||||
* Notes without the label will not be affected.
|
||||
* _**Rename label**_
|
||||
* For each note, if it has a [label](Attributes/Labels.md) of the given name, it will be renamed/replaced with a label of the new name. The value of the label (if present) will be kept intact.
|
||||
* Notes without the label will not be affected.
|
||||
* **Delete label**
|
||||
* For each note, if it has a label of a given name, it will be deleted (regardless of whether it has a value or not).
|
||||
* Notes without the label will not be affected.
|
||||
|
||||
### Relations
|
||||
|
||||
These actions operate the <a class="reference-link" href="Attributes/Relations.md">Relations</a> of a note:
|
||||
|
||||
* **Add relation**
|
||||
* For each note, it will create a relation pointing to the given note.
|
||||
* Notes without this relation will not be affected.
|
||||
* **Update relation target**
|
||||
* For each note, it will modify a relation to point to the newly given note.
|
||||
* Notes without this relation will not be affected.
|
||||
* **Rename relation**
|
||||
* For each note, if it has a relation of the given name, it will be renamed/replaced with a relation of the new name. The target note of the relation will be kept intact.
|
||||
* Notes without this relation will not be affected.
|
||||
* **Delete relation**
|
||||
* For each note, if it has a relation of the given name, it will be deleted.
|
||||
* Notes without this relation will not be affected.
|
||||
|
||||
### Notes
|
||||
|
||||
* **Rename note**
|
||||
* For each note, it will change the title of the note to the given one.
|
||||
* As a more advanced use case, the note can be a “template string” which allows for dynamic values with access to the note information via <a class="reference-link" href="../Scripting/Script%20API/Frontend%20API/FNote.dat">FNote</a>, for example:
|
||||
* `NEW: ${note.title}` will prefix all notes with `NEW:` .
|
||||
* `${note.dateCreatedObj.format('MM-DD:')}: ${note.title}` will prefix the note titles with each note's creation date (in month-day format).
|
||||
* **Move note**
|
||||
* For each note, it will be moved to the specified parent note.
|
||||
* As an alternative for less complex situations, the notes can be moved directly from within the <a class="reference-link" href="../Basic%20Concepts%20and%20Features/UI%20Elements/Note%20Tree.md">Note Tree</a> via cut → paste or via the contextual menu.
|
||||
* **Delete note**
|
||||
* For each note, it will be deleted.
|
||||
* As an alternative for less complex situations, the notes can be removed directly from within the <a class="reference-link" href="../Basic%20Concepts%20and%20Features/UI%20Elements/Note%20Tree.md">Note Tree</a> by selecting them and pressing <kbd>Delete</kbd>.
|
||||
* **Delete note revisions**
|
||||
* This will delete all the <a class="reference-link" href="../Basic%20Concepts%20and%20Features/Notes/Note%20Revisions.md">Note Revisions</a> of the notes.
|
||||
|
||||
### Others
|
||||
|
||||
* **Execute script**
|
||||
* For more complex scenarios, it is possible to type in a JavaScript expression in order to apply the necessary changes.
|
||||
* Examples:
|
||||
* To apply a suffix (`- suffix` in this example), to the note title:
|
||||
|
||||
```javascript
|
||||
note.title = note.title + " - suffix";
|
||||
```
|
||||
* To alter attributes of a note based on another attribute, such as setting the `#shareAlias` label to the title of the note:
|
||||
|
||||
```javascript
|
||||
note.setLabel("shareAlias", note.title)
|
||||
```
|
||||
BIN
docs/User Guide/User Guide/Advanced Usage/Bulk Actions_image.png
Normal file
|
After Width: | Height: | Size: 53 KiB |
@@ -0,0 +1,30 @@
|
||||
# Configuration (config.ini or environment variables)
|
||||
Trilium supports configuration via a file named `config.ini` and environment variables. Please review the file named [config-sample.ini](https://github.com/TriliumNext/Notes/blob/develop/config-sample.ini) in the [Notes](https://github.com/TriliumNext/Notes) repository to see what values are supported.
|
||||
|
||||
You can provide the same values via environment variables instead of the `config.ini` file, and these environment variables use the following format:
|
||||
|
||||
1. Environment variables should be prefixed with `TRILIUM_` and use underscores to represent the INI section structure.
|
||||
2. The format is: `TRILIUM_<SECTION>_<KEY>=<VALUE>`
|
||||
3. The environment variables will override any matching values from config.ini
|
||||
|
||||
For example, if you have this in your config.ini:
|
||||
|
||||
```
|
||||
[Network]
|
||||
host=localhost
|
||||
port=8080
|
||||
```
|
||||
|
||||
You can override these values using environment variables:
|
||||
|
||||
```
|
||||
TRILIUM_NETWORK_HOST=0.0.0.0
|
||||
TRILIUM_NETWORK_PORT=9000
|
||||
```
|
||||
|
||||
The code will:
|
||||
|
||||
1. First load the `config.ini` file as before
|
||||
2. Then scan all environment variables for ones starting with `TRILIUM_`
|
||||
3. Parse these variables into section/key pairs
|
||||
4. Merge them with the config from the file, with environment variables taking precedence
|
||||
@@ -0,0 +1,6 @@
|
||||
# Cross-Origin Resource Sharing (CORS)
|
||||
By default, Trilium cannot be accessed in web browsers by requests coming from other domains/origins than Trilium itself.
|
||||
|
||||
However, it is possible to manually configure [Cross-Origin Resource Sharing (CORS)](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS) since Trilium v0.93.0 using environment variables or `config.ini`, as follows:
|
||||
|
||||
<figure class="table" style="width:100%;"><table class="ck-table-resized"><colgroup><col style="width:26.93%;"><col style="width:32.46%;"><col style="width:40.61%;"></colgroup><thead><tr><th>CORS Header</th><th>Corresponding option in <code>config.ini</code></th><th>Corresponding option in environment variables in the <code>Network</code> section</th></tr></thead><tbody><tr><td><code>Access-Control-Allow-Origin</code></td><td><code>TRILIUM_NETWORK_CORS_ALLOW_ORIGIN</code></td><td><code>corsAllowOrigin</code> </td></tr><tr><td><code>Access-Control-Allow-Methods</code></td><td><code>TRILIUM_NETWORK_CORS_ALLOW_METHODS</code></td><td><code>corsAllowMethods</code> </td></tr><tr><td><code>Access-Control-Allow-Headers</code></td><td><code>TRILIUM_NETWORK_CORS_ALLOW_HEADERS</code></td><td><code>corsAllowHeaders</code></td></tr></tbody></table></figure>
|
||||
@@ -0,0 +1,19 @@
|
||||
# Trilium instance
|
||||
A Trilium instance represents a server. If <a class="reference-link" href="../../Installation%20%26%20Setup/Synchronization.md">Synchronization</a> is set up, since multiple servers are involved (the one from the desktop client and the one the synchronisation is set up with), sometimes it can be useful to distinguish the instance you are running on.
|
||||
|
||||
## Setting the instance name
|
||||
|
||||
To set up a name for the instance, modify the `config.ini`:
|
||||
|
||||
```
|
||||
[General]
|
||||
instanceName=Hello
|
||||
```
|
||||
|
||||
## Distinguishing the instance on back-end
|
||||
|
||||
Use `api.getInstanceName()` to obtain the instance name of the current server, as specified in the config file or in environment variables.
|
||||
|
||||
## Limiting script runs based on instance
|
||||
|
||||
For a script that is run periodically or on a certain event, it's possible to limit it to certain instances without having to change the code. Just add `runOnInstance` and set as the value the instance name where the script should run. To run on multiple named instances, simply add the label multiple times.
|
||||
@@ -0,0 +1,88 @@
|
||||
# Custom Request Handler
|
||||
Trilium provides a mechanism for [scripts](../Scripting.md) 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`).
|
||||
|
||||
## Create note from outside Trilium
|
||||
|
||||
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](../Note%20Types/Code.md) containing:
|
||||
|
||||
```
|
||||
const {req, res} = api;
|
||||
const {secret, title, content} = req.body;
|
||||
|
||||
if (req.method == 'POST' && 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);
|
||||
}
|
||||
```
|
||||
|
||||
This script note has also following two attributes:
|
||||
|
||||
* label `#customRequestHandler` with value `create-note`
|
||||
* relation `~targetNote` pointing to a note where new notes should be saved
|
||||
|
||||
### Explanation
|
||||
|
||||
Let's test this by using an HTTP client to send a request:
|
||||
|
||||
```
|
||||
POST http://my.trilium.org/custom/create-note
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"secret": "secret-password",
|
||||
"title": "hello",
|
||||
"content": "world"
|
||||
}+++++++++++++++++++++++++++++++++++++++++++++++
|
||||
```
|
||||
|
||||
Notice the `/custom` 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 `customRequestHandler` [label](Attributes.md). Value of this label then contains a regular expression which will match the request path (in our case trivial regex "create-note").
|
||||
|
||||
Trilium will then find our code note created above and execute it. `api.req`, `api.res` are set to [request](https://expressjs.com/en/api.html#req) and [response](https://expressjs.com/en/api.html#res)objects from which we can get details of the request and also respond.
|
||||
|
||||
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.
|
||||
|
||||
Once we pass these checks we will just create the desired note using [Script API](../Scripting/Script%20API.md).
|
||||
|
||||
## Custom resource provider
|
||||
|
||||
Another common use case is that you want to just expose a file note - in such case you create label `customResourceProvider` (value is again path regex).
|
||||
|
||||
For more information, see [Custom Resource Providers](Custom%20Resource%20Providers.md).
|
||||
|
||||
## Advanced concepts
|
||||
|
||||
`api.req` and `api.res` are Express.js objects - you can always look into its [documentation](https://expressjs.com/en/api.html) for details.
|
||||
|
||||
### Parameters
|
||||
|
||||
REST request paths often contain parameters in the URL, e.g.:
|
||||
|
||||
```
|
||||
http://my.trilium.org/custom/notes/123
|
||||
```
|
||||
|
||||
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 `customRequestHandler` value would match it:
|
||||
|
||||
```
|
||||
notes/([0-9]+)
|
||||
```
|
||||
|
||||
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 `api.pathParams`:
|
||||
|
||||
```
|
||||
const noteId = api.pathParams[0];
|
||||
```
|
||||
|
||||
Often you also need query params (as in e.g. `http://my.trilium.org/custom/notes?noteId=123`), you can get those with standard express `req.query.noteId`.
|
||||
@@ -0,0 +1,34 @@
|
||||
# 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.
|
||||
|
||||
## Steps for creating a custom resource provider
|
||||
|
||||
1. Import a file such as an image or a font into Trilium by drag & drop.
|
||||
2. Select the file and go to the _Owned Attributes_ section.
|
||||
3. Add the label `#customResourceProvider=hello`.
|
||||
4. To test if it is working, use a browser to navigate to `<protocol>://<host>/custom/hello` (where `<protocol>` is either `http` or `https` based on your setup, and `<host>` is the host or IP to your Trilium server instance). If you are running the TriliumNext application without a server, use `http://localhost:37840` as the base URL.
|
||||
5. If everything went well, at the previous step the browser should have downloaded the file uploaded in the first step.
|
||||
|
||||
Instead of `hello`, the name can be:
|
||||
|
||||
* A path, such as `fonts/Roboto.ttf`, which would be accessible via `<host>/custom/fonts/Roboto.ttf`.
|
||||
* As a more advanced use case, a regular expression to match multiple routes, such as `hello/.*` which will be accessible via `/custom/hello/1`, `/custom/hello/2`, `/custom/hello/world`, etc.
|
||||
|
||||
## Using it in a theme
|
||||
|
||||
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:
|
||||
|
||||
```css
|
||||
@font-face {
|
||||
font-family: customFont;
|
||||
src: url("/custom/fonts/myfont.ttf");
|
||||
}
|
||||
|
||||
div {
|
||||
font-family: customFont;
|
||||
}
|
||||
```
|
||||
22
docs/User Guide/User Guide/Advanced Usage/Database.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# Database
|
||||
Your Trilium data is stored in a [SQLite](https://www.sqlite.org) 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](../Installation%20%26%20Setup/Data%20directory.md).
|
||||
|
||||
## Demo Notes
|
||||
|
||||
When first starting Trilium, it will provide a set of notes to showcase various features of the application.
|
||||
|
||||
For more information see <a class="reference-link" href="Database/Demo%20Notes.md">Demo Notes</a>.
|
||||
|
||||
## Manually Modifying the Database
|
||||
|
||||
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 [SQLite Browser](https://sqlitebrowser.org/) to work directly on the database file.
|
||||
|
||||
See [Manually altering the database](Database/Manually%20altering%20the%20database.md) for more information.
|
||||
|
||||
## How to Reset the Database
|
||||
|
||||
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.
|
||||
|
||||
To delete the database, simply go to the [data directory](../Installation%20%26%20Setup/Data%20directory.md) and delete the `document.db` file (and any other files starting with `document.db`).
|
||||
|
||||
If you do not need to preserve any configurations that might be stored in the `config.ini` file, you can just delete all of the [data directory's](../Installation%20%26%20Setup/Data%20directory.md) contents to fully restore the application to its original state. You can also review the [configuration](Configuration%20\(config.ini%20or%20e.md) file to provide all `config.ini` values as environment variables instead.
|
||||
@@ -0,0 +1,19 @@
|
||||
# Demo Notes
|
||||
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:
|
||||
|
||||
* <a class="reference-link" href="../../Note%20Types/Relation%20Map.md">Relation Map</a>
|
||||
* <a class="reference-link" href="../Advanced%20Showcases/Day%20Notes.md">Day Notes</a>
|
||||
* <a class="reference-link" href="../Advanced%20Showcases/Weight%20Tracker.md">Weight Tracker</a>
|
||||
* <a class="reference-link" href="../Advanced%20Showcases/Task%20Manager.md">Task Manager</a>
|
||||
* <a class="reference-link" href="../../Basic%20Concepts%20and%20Features/Themes.md">Themes</a>
|
||||
|
||||
### Restoring Demo Notes
|
||||
|
||||
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.
|
||||
|
||||
You can easily restore the demo notes by using Trilium's built-in import feature by importing them:
|
||||
|
||||
* Download [this .zip archive](https://github.com/TriliumNext/Notes/raw/develop/db/demo.zip) with the latest version of the demo notes
|
||||
* Right click on any note in your tree under which you would like the demo notes to be imported
|
||||
* Click "Import into note"
|
||||
* Select the .zip archive to import it
|
||||
|
After Width: | Height: | Size: 134 KiB |
@@ -0,0 +1,42 @@
|
||||
# Manually altering the database
|
||||
There are some situations where modifying the SQLite database that Trilium uses is desirable.
|
||||
|
||||
If you are doing any advanced development or troubleshooting where you manually modify the database, you might want to consider creating backups of your `document.db` file.
|
||||
|
||||
## Modifying it internally using the SQL Console
|
||||
|
||||
The SQL Console is Trilium's built-in database editor.
|
||||
|
||||
See <a class="reference-link" href="Manually%20altering%20the%20database/SQL%20Console.md">SQL Console</a>.
|
||||
|
||||
## Externally modifying the database
|
||||
|
||||
Sometimes the SQL Console cannot be used (for example if the application cannot start).
|
||||
|
||||
When making external modifications, consider closing the desktop application. If modifying the server database, then stop the service or Docker container.
|
||||
|
||||
### Using DB Browser for SQLite
|
||||
|
||||
DB Browser for SQLite is a cross-platform editor that can be used to alter the database using a graphical user interface.
|
||||
|
||||
To do so:
|
||||
|
||||
1. In the main menu, select File → Open database… and navigate to the database in the [Data directory](../../Installation%20%26%20Setup/Data%20directory.md).
|
||||
2. Select the _Execute SQL_ tab.
|
||||
3. Type in the desired SQL statement.
|
||||
4. Press the "Play" button in the toolbar underneath the "Execute SQL" tab (or F5 key).
|
||||
5. Press "Write Changes" in the main toolbar.
|
||||
6. Close the application or close the database.
|
||||
|
||||

|
||||
|
||||
### Using the SQLite CLI
|
||||
|
||||
First, start the SQLite 3 CLI by specifying the path to the database:
|
||||
|
||||
```
|
||||
sqlite3 ~/.local/share/trilium-data/document.db
|
||||
```
|
||||
|
||||
* In the prompt simply type the statement and make sure it ends with a `;` character.
|
||||
* To exit, simply type `.quit` and enter.
|
||||
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 230 B |
|
After Width: | Height: | Size: 265 B |
@@ -0,0 +1,24 @@
|
||||
# SQL Console
|
||||
The SQL Console is Trilium's built-in database editor.
|
||||
|
||||
It can be accessed by going to the [global menu](../../../Basic%20Concepts%20and%20Features/UI%20Elements) → Advanced → Open SQL Console.
|
||||
|
||||

|
||||
|
||||
### Interaction
|
||||
|
||||
* Hovering the mouse over one of the tables listed at the top of the document will show the columns and their data type.
|
||||
* Only one SQL statement can be run at once.
|
||||
* To run the statement, press the icon.
|
||||
* For queries that return a result, the data will displayed in a table.
|
||||
|
||||

|
||||
|
||||
### Saved SQL console
|
||||
|
||||
SQL queries or commands can be saved into a dedicated note.
|
||||
|
||||
To do so, simply write the query and press the button. Once saved, the note will appear in [Day Notes](../../Advanced%20Showcases/Day%20Notes.md).
|
||||
|
||||
* The SQL expression will not be displayed by default, but it can still be viewed by going to the note context menu and selecting _Note source_.
|
||||
* The expression cannot be modified. If needed, recreate it by copying the statement back into the SQL console and then saving it again.
|
||||
|
After Width: | Height: | Size: 35 KiB |
@@ -0,0 +1,32 @@
|
||||
# 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](Attributes.md). 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.
|
||||
|
||||
As an example use case, imagine you collect books you've read in a given year like this:
|
||||
|
||||
* 2022 Books
|
||||
* Neal Stephenson: Anathem, 2008
|
||||
* Franz Kafka: Die Verwandlung, 1915
|
||||
|
||||
Now, to the parent note "2022 Books" you can assign label `#titleTemplate="[Author name]: [Book title], [Publication year]"`.
|
||||
|
||||
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.
|
||||
|
||||
## Dynamic value
|
||||
|
||||
The value of `#titleTemplate` 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.
|
||||
|
||||
Second variable injected is `parentNote` which gives access to the parent [`FNote`](../Scripting/Script%20API/Frontend%20API/FNote.dat).
|
||||
|
||||
See also <a class="reference-link" href="Templates.md">Templates</a> which provides similar capabilities, including default note's content.
|
||||
|
||||
### Examples
|
||||
|
||||
* Imagine you collect server outage incidents and write some notes. It looks like this:
|
||||
* Incidents
|
||||
* 2022-05-09: System crash
|
||||
* 2022-05-15: Backup delay
|
||||
* You can automatize the date assignment by assigning a label `#titleTemplate="${now.format('YYYY-MM-DD')}: "` to the parent note "Incidents". Whenever a new child note is created, the title template is evaluated with the injected [now](https://day.js.org/docs/en/display/format) object.
|
||||
* To use a parent's attribute in the title of new notes: `#titleTemplate="${parentNote.getLabelValue('authorName')}'s literary works"`
|
||||
* To mirror the parent's note title: `${parentNote.title}`
|
||||
@@ -0,0 +1,64 @@
|
||||
# ETAPI (REST API)
|
||||
ETAPI is Trilium's public/external REST API. It is available since Trilium v0.50.
|
||||
|
||||
The documentation is in OpenAPI format, available [here](https://github.com/TriliumNext/Notes/blob/master/src/etapi/etapi.openapi.yaml).
|
||||
|
||||
## API clients
|
||||
|
||||
As an alternative to calling the API directly, there are client libraries to simplify this
|
||||
|
||||
* [trilium-py](https://github.com/Nriver/trilium-py), you can use Python to communicate with Trilium.
|
||||
|
||||
## Obtaining a token
|
||||
|
||||
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](https://github.com/TriliumNext/Notes/blob/master/src/etapi/etapi.openapi.yaml)).
|
||||
|
||||
## Authentication
|
||||
|
||||
### Via the `Authorization` header
|
||||
|
||||
```
|
||||
GET https://myserver.com/etapi/app-info
|
||||
Authorization: ETAPITOKEN
|
||||
```
|
||||
|
||||
where `ETAPITOKEN` is the token obtained in the previous step.
|
||||
|
||||
For compatibility with various tools, it's also possible to specify the value of the `Authorization` header in the format `Bearer ETAPITOKEN` (since 0.93.0).
|
||||
|
||||
### Basic authentication
|
||||
|
||||
Since v0.56 you can also use basic auth format:
|
||||
|
||||
```
|
||||
GET https://myserver.com/etapi/app-info
|
||||
Authorization: Basic BATOKEN
|
||||
```
|
||||
|
||||
* Where `BATOKEN = BASE64(username + ':' + password)` - this is a standard Basic Auth serialization
|
||||
* Where `username` is "etapi"
|
||||
* And `password` is the generated ETAPI token described above.
|
||||
|
||||
Basic Auth is meant to be used with tools which support only basic auth.
|
||||
|
||||
## Interaction using Bash scripts
|
||||
|
||||
It is possible to write simple Bash scripts to interact with Trilium. As an example, here's how to obtain the HTML content of a note:
|
||||
|
||||
```
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Configuration
|
||||
TOKEN=z1vA4fkGxjOR_ZXLrZeqHEFOv65yV3882iFCRtNIK9k9iWrHliITNSLQ=
|
||||
SERVER=http://localhost:8080
|
||||
|
||||
# Download a note by ID
|
||||
NOTE_ID="i6ra4ZshJhgN"
|
||||
curl "$SERVER/etapi/notes/$NOTE_ID/content" -H "Authorization: $TOKEN"
|
||||
```
|
||||
|
||||
Make sure to replace the values of:
|
||||
|
||||
* `TOKEN` with your ETAPI token.
|
||||
* `SERVER` with the correct protocol, host name and port to your Trilium instance.
|
||||
* `NOTE_ID` with an existing note ID to download.
|
||||
18
docs/User Guide/User Guide/Advanced Usage/Hidden Notes.md
Normal file
BIN
docs/User Guide/User Guide/Advanced Usage/Hidden Notes_image.png
Normal file
|
After Width: | Height: | Size: 8.6 KiB |
16
docs/User Guide/User Guide/Advanced Usage/Note ID.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# 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.
|
||||
|
||||
## How does the import/export affect the note IDs
|
||||
|
||||
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. This also includes other entities that are part of the import/export process such as <a class="reference-link" href="../Basic%20Concepts%20and%20Features/Notes/Attachments.md">Attachments</a>.
|
||||
|
||||
## Note collisions
|
||||
|
||||
Since the Note ID is a fixed-width randomly generated number, due to the [pigeonhole principle](https://en.wikipedia.org/wiki/Pigeonhole_principle), there is a possibility that a newly created note will have the same ID as an existing note.
|
||||
|
||||
Since the note ID is alphanumeric and the length is 12 we have $62^{12}$ unique IDs. However since we are generating them randomly, we can use a collision calculator such as the one for [Nano ID](https://alex7kom.github.io/nano-nanoid-cc/?alphabet=0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz&size=12&speed=1000&speedUnit=hour) to determine that we'd need to create 1000 notes per hour every hour for 9 centuries in order to have at least 1% probability of a note collision.
|
||||
|
||||
As such, Trilium does not take any explicit action against potential note collisions, similar to other software that makes uses of unique hashes such as [Git](https://stackoverflow.com/questions/10434326/hash-collision-in-git). If one would theoretically occur, what would most likely happen is that the existing note will be replaced by the new one.
|
||||
|
After Width: | Height: | Size: 77 KiB |
@@ -0,0 +1,32 @@
|
||||
# Note Map (Link map, Tree map)
|
||||
Note map is a visualisation of connections between notes.
|
||||
|
||||
This provides an insight into a structure ("web") of notes.
|
||||
|
||||
There are two types of note map:
|
||||
|
||||
* Link Map, which shows relations between notes.
|
||||
* Note Map, which shows the hierarchical tree structure.
|
||||
|
||||
## Link Map
|
||||
|
||||
Shows [relations](Attributes.md) between notes:
|
||||
|
||||

|
||||
|
||||
## Tree Map
|
||||
|
||||
Shows hierarchical map of notes:
|
||||
|
||||

|
||||
|
||||
## Dedicated note type
|
||||
|
||||
Apart from the note map feature which can be accessed from any note, it is also possible to create a dedicated note which will display the relations in full screen. See [Note Map](../Note%20Types/Note%20Map.md) for more information.
|
||||
|
||||
## See also
|
||||
|
||||
[Relation map](../Note%20Types/Relation%20Map.md) is a similar concept, with some differences:
|
||||
|
||||
* note map is automatically generated while relation map must be created manually
|
||||
* relation map is a type of note while a link map is just virtual visualization
|
||||
55
docs/User Guide/User Guide/Advanced Usage/Note source.md
Normal file
@@ -0,0 +1,55 @@
|
||||
# Note source
|
||||
## Understanding the source code of the different notes
|
||||
|
||||
Internally, the structure of the content of each note is different based on the <a class="reference-link" href="../Note%20Types.md">Note Types</a>.
|
||||
|
||||
For example:
|
||||
|
||||
* <a class="reference-link" href="../Note%20Types/Text.md">Text</a> notes are represented internally as HTML, using the <a class="reference-link" href="Technologies%20used/CKEditor.md">CKEditor</a> representation. Note that due to the custom plugins, some HTML elements are specific to Trilium only, for example the admonitions.
|
||||
* <a class="reference-link" href="../Note%20Types/Code.md">Code</a> notes are plain text and are represented internally as-is.
|
||||
* <a class="reference-link" href="../Note%20Types/Geo%20Map.md">Geo Map</a> notes contain only minimal information (viewport, zoom) as a JSON.
|
||||
* <a class="reference-link" href="../Note%20Types/Canvas.md">Canvas</a> notes are represented as JSON, with Trilium's own information alongside with <a class="reference-link" href="Technologies%20used/Excalidraw.md">Excalidraw</a>'s internal JSON representation format.
|
||||
* <a class="reference-link" href="../Note%20Types/Mind%20Map.md">Mind Map</a> notes are represented as JSON, with the internal format of <a class="reference-link" href="Technologies%20used/MindElixir.md">MindElixir</a>.
|
||||
|
||||
Note that some information is also stored as <a class="reference-link" href="../Basic%20Concepts%20and%20Features/Notes/Attachments.md">Attachments</a>. For example <a class="reference-link" href="../Note%20Types/Canvas.md">Canvas</a> notes use the attachments feature to store the custom libraries, and alongside with <a class="reference-link" href="../Note%20Types/Mind%20Map.md">Mind Map</a> 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.
|
||||
|
||||
Here's part of the HTML representation of this note, as it's stored in the database (but prettified).
|
||||
|
||||
```
|
||||
<h2>
|
||||
Understanding the source code of the different notes
|
||||
</h2>
|
||||
<p>
|
||||
Internally, the structure of the content of each note is different based on the
|
||||
<a class="reference-link" href="../Note%20Types.md">
|
||||
Note Types
|
||||
</a>
|
||||
.
|
||||
</p>
|
||||
```
|
||||
|
||||
## Viewing the source code
|
||||
|
||||
It is possible to view the source code of a note by pressing the contextual menu in <a class="reference-link" href="../Basic%20Concepts%20and%20Features/UI%20Elements/Note%20buttons.md">Note buttons</a> and selecting _Note source_.
|
||||
|
||||

|
||||
|
||||
The source code will be displayed in a new tab.
|
||||
|
||||
For some note types, such as text notes, the source code is also formatted in order to be more easily readable.
|
||||
|
||||
## Modifying the source code
|
||||
|
||||
It is possible to modify the source code of a note directly, however not via the _Note source_ functionality.
|
||||
|
||||
To do so:
|
||||
|
||||
1. Change the note type from the real note type (e.g. Canvas, Geo Type) to Code (plain text) or the corresponding format such as JSON or HTML.
|
||||
2. Confirm the warning about changing the note type.
|
||||
3. The source code will appear, make the necessary modifications.
|
||||
4. Change the note type back to the real note type.
|
||||
|
||||
> [!WARNING]
|
||||
> Depending on the changes made, there is a risk that the note will not render properly. It's best to save a revision before making any big changes.
|
||||
>
|
||||
> If the note does not render properly, modify the source code again or revert to a prior revision. Since the error handling for unexpected changes might not always be perfect, it be required to refresh the application.
|
||||
BIN
docs/User Guide/User Guide/Advanced Usage/Note source_image.png
Normal file
|
After Width: | Height: | Size: 24 KiB |
97
docs/User Guide/User Guide/Advanced Usage/Sharing.md
Normal file
@@ -0,0 +1,97 @@
|
||||
# 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.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
To use the sharing feature, you must have a <a class="reference-link" href="../Installation%20%26%20Setup/Server%20Installation.md">Server Installation</a> of Trilium. This is necessary because the notes will be hosted from the server.
|
||||
|
||||
## How to Share a Note
|
||||
|
||||
1. **Enable Sharing**: To share a note, toggle the `Shared` switch within the note's interface. Once sharing is enabled, an URL will appear, which you can click to access the shared note.
|
||||
|
||||

|
||||
2. **Access the Shared Note**: 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 `localhost (127.0.0.1)`.
|
||||
|
||||

|
||||
|
||||
## Sharing a Note Subtree
|
||||
|
||||
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.
|
||||
|
||||

|
||||
|
||||
## Viewing All Shared Notes
|
||||
|
||||
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.
|
||||
|
||||
## Security Considerations
|
||||
|
||||
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.
|
||||
|
||||
### Password Protection
|
||||
|
||||
To protect shared notes with a username and password, you can use the `#shareCredentials` attribute. Add this label to the note with the format `#shareCredentials="username:password"`. To protect an entire subtree, make sure the label is [inheritable](Attributes/Attribute%20Inheritance.md).
|
||||
|
||||
## Advanced Sharing Options
|
||||
|
||||
### Customizing the Appearance of Shared Notes
|
||||
|
||||
The default shared page is basic in design, but you can customize it using your own CSS:
|
||||
|
||||
* **Custom CSS**: Link a CSS <a class="reference-link" href="../Note%20Types/Code.md">Code</a> note to the shared page by adding a `~shareCss` 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 `#shareHiddenFromTree` label.
|
||||
* **Omitting Default CSS**: For extensive styling changes, use the `#shareOmitDefaultCss` label to avoid conflicts with Trilium's [default stylesheet](../Basic%20Concepts%20and%20Features/Themes.md).
|
||||
|
||||
### Adding JavaScript
|
||||
|
||||
You can inject custom JavaScript into the shared note using the `~shareJs` relation. This allows you to access note attributes or traverse the note tree using the `fetchNote()` API, which retrieves note data based on its ID.
|
||||
|
||||
Example:
|
||||
|
||||
```javascript
|
||||
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);
|
||||
}
|
||||
```
|
||||
|
||||
### Creating Human-Readable URL Aliases
|
||||
|
||||
Shared notes typically have URLs like `http://domain.tld/share/knvU8aJy4dJ7`, where the last part is the note's ID. You can make these URLs more user-friendly by adding the `#shareAlias` label to individual notes (e.g., `#shareAlias=highlighting`). This will change the URL to `http://domain.tld/share/highlighting`.
|
||||
|
||||
**Important**:
|
||||
|
||||
1. Ensure that aliases are unique.
|
||||
2. Using slashes (`/`) within aliases to create subpaths is not supported.
|
||||
|
||||
### Viewing and Managing Shared Notes
|
||||
|
||||
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.
|
||||
|
||||

|
||||
|
||||
### Setting a Custom Favicon
|
||||
|
||||
To customize the favicon for your shared pages, create a relation `~shareFavicon` pointing to a file note containing the favicon (e.g., in `.ico` format).
|
||||
|
||||
### Sharing a Note as the Root
|
||||
|
||||
You can designate a specific note or folder as the root of your shared content by adding the `#shareRoot` label. This note will be linked when visiting `[http://domain.tld/share](http://domain/share)`, making it easier to use Trilium as a fully-fledged website. Consider combining this with the `#shareIndex` label, which will display a list of all shared notes.
|
||||
|
||||
## Limitations
|
||||
|
||||
While the sharing feature is powerful, it has some limitations:
|
||||
|
||||
* **No Relation Map Support**
|
||||
* **Book Notes**: Only show a list of child notes.
|
||||
* **Code Notes**: No syntax highlighting.
|
||||
* **Static Note Tree**
|
||||
* **Protected Notes**: Cannot be shared.
|
||||
* **Include Notes**: Not supported.
|
||||
|
||||
Some of these limitations may be addressed in future updates.
|
||||
|
||||
## Attribute reference
|
||||
|
||||
<figure class="table"><table><thead><tr><th>Attribute</th><th>Description</th></tr></thead><tbody><tr><td><code>shareHiddenFromTree</code></td><td>this note is hidden from left navigation tree, but still accessible with its URL</td></tr><tr><td><code>shareExternalLink</code></td><td>note will act as a link to an external website in the share tree</td></tr><tr><td><code>shareAlias</code></td><td>define an alias using which the note will be available under <code>https://your_trilium_host/share/[your_alias]</code></td></tr><tr><td><code>shareOmitDefaultCss</code></td><td>default share page CSS will be omitted. Use when you make extensive styling changes.</td></tr><tr><td><code>shareRoot</code></td><td>marks note which is served on /share root.</td></tr><tr><td><code>shareDescription</code></td><td>define text to be added to the HTML meta tag for description</td></tr><tr><td><code>shareRaw</code></td><td>Note will be served in its raw format, without HTML wrapper. See also <a class="reference-link" href="Sharing/Serving%20directly%20the%20content%20o.md">Serving directly the content of a note</a> for an alternative method without setting an attribute.</td></tr><tr><td><code>shareDisallowRobotIndexing</code></td><td><p>Indicates to web crawlers that the page should not be indexed of this note by:</p><ul><li>Setting the <code>X-Robots-Tag: noindex</code> HTTP header.</li><li>Setting the <code>noindex, follow</code> meta tag.</li></ul></td></tr><tr><td><code>shareCredentials</code></td><td>require credentials to access this shared note. Value is expected to be in format <code>username:password</code>. Don't forget to make this inheritable to apply to child-notes/images.</td></tr><tr><td><code>shareIndex</code></td><td>Note with this label will list all roots of shared notes.</td></tr></tbody></table></figure>
|
||||
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 6.8 KiB |
@@ -0,0 +1,16 @@
|
||||
# Serving directly the content of a note
|
||||
When accessing a shared note, Trilium will render it as a web page. Sometimes it's desirable to serve the content directly so that it can be used in a script or downloaded by the user.
|
||||
|
||||
| A note displayed as a web page (HTML) | A note displayed as a raw format |
|
||||
| --- | --- |
|
||||
|  |  |
|
||||
|
||||
## By adding an attribute to the note
|
||||
|
||||
Simply add the `#shareRaw` attribute and the note will always be rendered _raw_ when accessed from the share URL.
|
||||
|
||||
## By altering the URL
|
||||
|
||||
Append `?raw` to the URL to display a note in its raw format regardless of whether the `#shareRaw` attribute is added on the note.
|
||||
|
||||

|
||||
|
After Width: | Height: | Size: 101 KiB |
|
After Width: | Height: | Size: 68 KiB |
|
After Width: | Height: | Size: 96 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
@@ -0,0 +1,4 @@
|
||||
# Technologies used
|
||||
One core aspect of Trilium that allows it to have support for multiple [Note Types](../Note%20Types.md) is the fact that it makes use of various off-the-shelf or reusable libraries.
|
||||
|
||||
The sub-pages showcase some of the technologies used, for a better understanding of how Trilium works but also to credit the developers of that particular technology.
|
||||
@@ -0,0 +1,34 @@
|
||||
# CKEditor
|
||||
## Editor core
|
||||
|
||||
The CKEditor is the WYSIWYG (standing for What You See Is What You Get) editor behind [Text](../../Note%20Types/Text.md) notes.
|
||||
|
||||
Their website is [ckeditor.com](https://ckeditor.com/).
|
||||
|
||||
CKEditor by itself is a commercial product, but the core is open-source. As described in [its documentation](https://ckeditor.com/docs/ckeditor5/latest/features/index.html), the editor supports quite a large number of features. Do note that not all the features are enabled in Trilium.
|
||||
|
||||
## Premium features
|
||||
|
||||
Some features are marked as premium in the CKEditor feature set. This means that they cannot be used without a license.
|
||||
|
||||
Trilium cannot benefit from any of these premium features as they require a commercial license, however we are in discussions with the CKEditor team to allow us to use a subset of these premium features such as [Slash commands](https://ckeditor.com/docs/ckeditor5/latest/features/slash-commands.html).
|
||||
|
||||
## Plugins
|
||||
|
||||
The CKEditor ecosystem is quite extensible, in the sense that custom plugins can be written to extend the functionality of the editor beyond its original scope.
|
||||
|
||||
Trilium makes use of such features:
|
||||
|
||||
* The math feature is added by a version of [isaul32/ckeditor5-math: Math feature for CKEditor 5.](https://github.com/isaul32/ckeditor5-math) modified by us to fit our needs.
|
||||
* We also make use of modified upstream plugins such as [ckeditor/ckeditor5-mermaid](https://github.com/ckeditor/ckeditor5-mermaid) to allow inline Mermaid code.
|
||||
* [mlewand/ckeditor5-keyboard-marker: Plugin adds support for the keyboard input element (`<kbd>`) to CKEditor 5.](https://github.com/mlewand/ckeditor5-keyboard-marker)
|
||||
* A modified version of [ThomasAitken/ckeditor5-footnotes: Footnotes plugin for CKEditor5](https://github.com/ThomasAitken/ckeditor5-footnotes) to allow footnotes.
|
||||
|
||||
Apart from that, Trilium also has its own set of specific plugins such as:
|
||||
|
||||
* <a class="reference-link" href="../../Note%20Types/Text/Cut%20to%20subnote.md">Cut to subnote</a>
|
||||
* <a class="reference-link" href="../../Note%20Types/Text/Include%20Note.md">Include Note</a>
|
||||
* Mentions, for linking pages.
|
||||
* <a class="reference-link" href="../../Basic%20Concepts%20and%20Features/Import%20%26%20Export/Markdown.md">Markdown</a>
|
||||
* [Reference links](../../Note%20Types/Text/Links.md)
|
||||
* [Admonitions](../../Note%20Types/Text/Block%20quotes%20%26%20admonitions.md), we ended up creating our own plugin but [aarkue/ckeditor5-admonition](https://github.com/aarkue/ckeditor5-admonition) was a good inspiration (including the toolbar icon).
|
||||
@@ -0,0 +1,4 @@
|
||||
# Excalidraw
|
||||
[Excalidraw](https://excalidraw.com/) is the technology behind the [Canvas](../../Note%20Types/Canvas.md) notes. The source code of the library is available on [GitHub](https://github.com/excalidraw/excalidraw).
|
||||
|
||||
We are using an unmodified version of it, so it shares the same [issues](https://github.com/excalidraw/excalidraw/issues) as the original.
|
||||
@@ -0,0 +1,10 @@
|
||||
# Leaflet
|
||||
Leaflet is the library behind [Geo map](../../Note%20Types/Geo%20Map.md) notes.
|
||||
|
||||
## Plugins
|
||||
|
||||
Leaflet is also highly customizable via external plugins.
|
||||
|
||||
Currently we use:
|
||||
|
||||
* [mpetazzoni/leaflet-gpx: A GPX track plugin for Leaflet.js](https://github.com/mpetazzoni/leaflet-gpx)
|
||||
@@ -0,0 +1,12 @@
|
||||
# MindElixir
|
||||
MindElixir is the library we are using for the [Mind Map](../../Note%20Types/Mind%20Map.md) note types.
|
||||
|
||||
The main library is available on [GitHub as mind-elixir-core](https://github.com/SSShooter/mind-elixir-core/issues).
|
||||
|
||||
The library is embedded as-is without additional modifications.
|
||||
|
||||
Issues with its functionality should generally be reported [upstream](https://github.com/ssshooter/mind-elixir-core).
|
||||
|
||||
## Plugins
|
||||
|
||||
MindElixir supports plugins, and one such plugin we are making use of is [SSShooter/node-menu: A node menu plugin of mind-elixir](https://github.com/SSShooter/node-menu), which allows editing the fonts, colors, links of nodes.
|
||||
36
docs/User Guide/User Guide/Advanced Usage/Templates.md
Normal file
@@ -0,0 +1,36 @@
|
||||
# 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:
|
||||
|
||||
1. **Attribute Inheritance**: All attributes from the template note are [inherited](Attributes/Attribute%20Inheritance.md) by the instance notes. Even attributes with `#isInheritable=false` are inherited by the instance notes, although only inheritable attributes are further inherited by the children of the instance notes.
|
||||
2. **Content Duplication**: The content of the template note is copied to the instance note, provided the instance note is empty at the time of template assignment.
|
||||
3. **Child Note Duplication**: All child notes of the template are deep-duplicated to the instance note.
|
||||
|
||||
## Example
|
||||
|
||||
A typical example would be a "Book" template note, which might include:
|
||||
|
||||
* **Promoted Attributes**: Such as publication year, author, etc. (see [promoted attributes](Attributes/Promoted%20Attributes.md)).
|
||||
* **Outline**: An outline for a book review, including sections like themes, conclusion, etc.
|
||||
* **Child Notes**: Additional notes for highlights, summary, etc.
|
||||
|
||||

|
||||
|
||||
## Instance Note
|
||||
|
||||
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:
|
||||
|
||||

|
||||
|
||||
For the template to appear in the menu, the template note must have the `#template` label. Do not confuse this with the `~template` relation, which links the instance note to the template note. If you use [workspaces](../Basic%20Concepts%20and%20Features/Navigation/Workspaces.md), you can also mark templates with `#workspaceTemplate` to display them only in the workspace.
|
||||
|
||||
Templates can also be added or changed after note creation by creating a `~template` relation pointing to the desired template note.
|
||||
|
||||
## Additional Notes
|
||||
|
||||
From a visual perspective, templates can define `#iconClass` and `#cssClass` attributes, allowing all instance notes (e.g., books) to display a specific icon and CSS style.
|
||||
|
||||
Explore the concept further in the [demo notes](Database.md), including examples like the [Relation Map](../Note%20Types/Relation%20Map.md), [Task Manager](Advanced%20Showcases/Task%20Manager.md), and [Day Notes](Advanced%20Showcases/Day%20Notes.md).
|
||||
|
||||
Additionally, see [default note title](Default%20Note%20Title.md) for creating title templates. Note templates and title templates can be combined by creating a `#titleTemplate` for a template note.
|
||||
|
After Width: | Height: | Size: 77 KiB |
BIN
docs/User Guide/User Guide/Advanced Usage/Templates_template.png
Normal file
|
After Width: | Height: | Size: 82 KiB |
|
After Width: | Height: | Size: 46 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 53 KiB |
@@ -0,0 +1,18 @@
|
||||
# Evernote
|
||||
Trilium can import ENEX files which are used by Evernote for backup/export. One ENEX file represents content (notes and resources) of one notebook.
|
||||
|
||||
## Export ENEX from Evernote
|
||||
|
||||
To export ENEX file, you need to have a _legacy_ desktop version of Evernote (i.e. not web/mobile). Right click on notebook and select export and follow the wizard.
|
||||
|
||||
## Import ENEX in Trilium
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
## Limitations
|
||||
|
||||
All resources (except for images) are created as note's attachments.
|
||||
|
||||
HTML inside ENEX files is not exactly valid so some formatting maybe broken or lost. You can report major problems into [Trilium issue tracker](https://github.com/TriliumNext/Notes/issues).
|
||||
@@ -0,0 +1,50 @@
|
||||
# Markdown
|
||||
Trilium supports Markdown for both import and export, while trying to keep compatibility as high as possible.
|
||||
|
||||
## Import
|
||||
|
||||
### Clipboard import
|
||||
|
||||
If you want to import just a chunk of markdown from clipboard, you can do it from editor block menu:
|
||||
|
||||

|
||||
|
||||
### File import
|
||||
|
||||
You can also import Markdown files from files:
|
||||
|
||||
* single markdown file (with .md extension)
|
||||
* whole tree of markdown files (packaged into [.zip](https://en.wikipedia.org/wiki/Tar_\(computing\)) archive)
|
||||
* Markdown files need to be packaged into ZIP archive because browser can't read directories, only single files.
|
||||
* You can use e.g. [7-zip](https://www.7-zip.org) to package directory of markdown files into the ZIP file
|
||||
|
||||
\[\[gifs/markdown-file-import.gif\]\]
|
||||
|
||||

|
||||
|
||||
## Export
|
||||
|
||||
### Subtree export
|
||||
|
||||
You can export whole subtree to ZIP archive which will have directory structured modelled after subtree structure:
|
||||
|
||||

|
||||
|
||||
### Single note export
|
||||
|
||||
If you want to export just single note without its subtree, you can do it from Note actions menu:
|
||||
|
||||

|
||||
|
||||
### Exporting protected notes
|
||||
|
||||
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.
|
||||
|
||||
## Supported syntax
|
||||
|
||||
* [GitHub-Flavored Markdown](https://github.github.com/gfm/) is the main syntax that Trilium is following.
|
||||
* Images are supported. When exporting, images are usually kept in the basic Markdown syntax but will use the HTML syntax if the image has a custom width. Figures are always embedded as HTML.
|
||||
* Tables are supported with the Markdown syntax. If the table is too complex or contains elements that would render as HTML, the table is also rendered as HTML.
|
||||
* <a class="reference-link" href="../../Note%20Types/Text/Block%20quotes%20%26%20admonitions.md">Admonitions</a> are supported using GitHub's format.
|
||||
* Links are supported. “Reference links” (internal links that mirror a note's title and display its icon) are embedded as HTML in order to preserve the information on import.
|
||||
* Math equations are supported using `$` and `$$` syntaxes.
|
||||
|
After Width: | Height: | Size: 332 KiB |
|
After Width: | Height: | Size: 309 KiB |
|
After Width: | Height: | Size: 714 KiB |
|
After Width: | Height: | Size: 200 KiB |
@@ -0,0 +1,50 @@
|
||||
# OneNote
|
||||
**This page describes a method to migrate via EverNote Legacy, but this app is no longer available/working.**
|
||||
|
||||
## Prep Onenote notes for best compatibility
|
||||
|
||||
* 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)
|
||||
* Make sure to use Onenote headings where applicable (These will be carried over correctly into Trilium)
|
||||
* Remove extra whitespace in Onenote (Whitespace seems to be more noticible in Trilium, so removing it now will make it look nicer in trilium)
|
||||
* 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.
|
||||
* 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).
|
||||
|
||||
## Migration Procedure
|
||||
|
||||
### Import into Evernote from OneNote:
|
||||
|
||||
* Install [Evernote Legacy](https://web.archive.org/web/20230327110646/https://help.evernote.com/hc/en-us/articles/360052560314). 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!).
|
||||
* In evernote navigate to File > Import > Onenote > Notebook > Section > OK
|
||||
|
||||
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
|
||||
|
||||
### Export from Evernote
|
||||
|
||||
* Right click on the created notebook in Evernote and choose "Export Notes…"
|
||||
* Use the default export format of .enex
|
||||
|
||||
### Cleanup enex file (optional)
|
||||
|
||||
* 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:
|
||||
|
||||
Find (using regex): `.<div.*><h1` Replace with: `<h1`
|
||||
|
||||
### Import into Trilium
|
||||
|
||||
* In Trilium, right click on the root node and choose Import (all default options should be fine).
|
||||
* Select the .enex file exported from Evernote
|
||||
* Be patient. Large .enex files may take a few minutes to process
|
||||
* Repeat import for each .enex file
|
||||
|
||||
## Other importing notes:
|
||||
|
||||
* Centered text in Onenote will be left-justified after importing into Trilium
|
||||
* 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)
|
||||
* Text colors, highlights, and formatting generally carries over well
|
||||
* Revision history will be lost, but any new revisions will be tracked in Trilium
|
||||
* 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).
|
||||
* Evernote tags are created for each "section" in OneNote and these tags are carried over to Trilium as attributes
|
||||
* If the tags are not desired, you can turn them off in the Evernote export options.
|
||||
* If the "Created with OneNote" text is not desired, do a find/replace in the enex files before importing to Trilium
|
||||
* Some links will be disabled (not clickable) when importing from enex.
|
||||
* Files, screenshots, and attachments are all preserved (This is the only one-note export option that seems to preserve all of these).
|
||||
@@ -0,0 +1,77 @@
|
||||
# Keyboard Shortcuts
|
||||
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).
|
||||
|
||||
It is also possible to configure most keyboard shortcuts in Options -> Keyboard shortcuts. Using `global:` prefix, you can assign a shortcut which will work even without Trilium being in focus (requires app restart to take effect).
|
||||
|
||||
## Note navigation
|
||||
|
||||
* <kbd><span>↑</span></kbd>, <kbd><span>↓</span></kbd> - go up/down in the list of notes, <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd><span>↑</span></kbd> and <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd><span>↓</span></kbd> work also from editor
|
||||
* <kbd><span>←</span></kbd>, <kbd><span>→</span></kbd> - collapse/expand node
|
||||
* <kbd>Alt</kbd> + <kbd><span>←</span></kbd>, <kbd>Alt</kbd> + <kbd><span>→</span></kbd> - go back / forwards in the history
|
||||
* <kbd>Ctrl</kbd> + <kbd>J</kbd> - show ["Jump to" dialog](Navigation/Note%20Navigation.md)
|
||||
* <kbd>Ctrl</kbd> + <kbd>.</kbd> - scroll to current note (useful when you scroll away from your note or your focus is currently in the editor)
|
||||
* <kbd><span>Backspace</span></kbd> - jumps to parent note
|
||||
* <kbd>Alt</kbd> + <kbd>C</kbd> - collapse whole note tree
|
||||
* <kbd>Alt</kbd> + <kbd>-</kbd> (alt with minus sign) - collapse subtree (if some subtree takes too much space on tree pane you can collapse it)
|
||||
* you can define a [label](../Advanced%20Usage/Attributes.md) `#keyboardShortcut` with e.g. value <kbd>Ctrl</kbd> + <kbd>I</kbd> . Pressing this keyboard combination will then bring you to the note on which it is defined. Note that Trilium must be reloaded/restarted (<kbd>Ctrl</kbd> + <kbd>R</kbd> ) for changes to be in effect.
|
||||
|
||||
See demo of some of these features in [note navigation](Navigation/Note%20Navigation.md).
|
||||
|
||||
## Tabs
|
||||
|
||||
* <kbd>Ctrl</kbd> + <kbd>🖱 Left click</kbd> - (or middle mouse click) on note link opens note in a new tab
|
||||
|
||||
Only in desktop (electron build):
|
||||
|
||||
* <kbd>Ctrl</kbd> + <kbd>T</kbd> - opens empty tab
|
||||
* <kbd>Ctrl</kbd> + <kbd>W</kbd> - closes active tab
|
||||
* <kbd>Ctrl</kbd> + <kbd>Tab</kbd> - activates next tab
|
||||
* <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Tab</kbd> - activates previous tab
|
||||
|
||||
## Creating notes
|
||||
|
||||
* `CTRL+O` - creates new note after the current note
|
||||
* `CTRL+P` - creates new sub-note into current note
|
||||
* `F2` - edit [prefix](Navigation/Note%20Navigation.md) of current note clone
|
||||
|
||||
## Moving / cloning notes
|
||||
|
||||
* <kbd>Ctrl</kbd> + <kbd><span>↑</span></kbd> , Ctrl + <kbd><span>↓</span></kbd> - move note up/down in the note list
|
||||
* <kbd>Ctrl</kbd> + <kbd><span>←</span></kbd> - move note up in the note tree
|
||||
* <kbd>Ctrl</kbd>+<kbd><span>→</span></kbd> - move note down in the note tree
|
||||
* <kbd>Shift</kbd>+<kbd><span>↑</span></kbd>, <kbd>Shift</kbd>`+`<kbd><span>↓</span></kbd> - multi-select note above/below
|
||||
* <kbd>Ctrl</kbd>+<kbd>A</kbd> - select all notes in the current level
|
||||
* <kbd>Shift</kbd>+<kbd>🖱 Left click</kbd> - multi select note which you clicked on
|
||||
* <kbd>Ctrl</kbd>+<kbd>C</kbd> - copies current note (or current selection) into clipboard (used for [cloning](Notes/Cloning%20Notes.md)
|
||||
* <kbd>Ctrl</kbd>+<kbd>X</kbd> - cuts current (or current selection) note into clipboard (used for moving notes)
|
||||
* <kbd>Ctrl</kbd>+<kbd>V</kbd> - 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)
|
||||
* <kbd>Del</kbd> - delete note / sub-tree
|
||||
|
||||
## Editing notes
|
||||
|
||||
* For <a class="reference-link" href="../Note%20Types/Text.md">Text</a> notes, refer to <a class="reference-link" href="../Note%20Types/Text/Keyboard%20shortcuts.md">Keyboard shortcuts</a> and <a class="reference-link" href="../Note%20Types/Text/Markdown-like%20formatting.md">Markdown-like formatting</a>.
|
||||
* <kbd>Alt</kbd>\-<kbd>F10</kbd> - bring up inline formatting toolbar (arrow keys <kbd><span>←</span></kbd>,<kbd><span>→</span></kbd> to navigate, <kbd>Enter</kbd> to apply)
|
||||
* <kbd>Alt</kbd>\-<kbd>F10</kbd> - again to bring up block formatting toolbar
|
||||
* <kbd>Enter</kbd> in tree pane switches from tree pane into note title. Enter from note title switches focus to text editor. <kbd>Ctrl</kbd>+<kbd>.</kbd> switches back from editor to tree pane.
|
||||
* <kbd>Ctrl</kbd>+<kbd>K</kbd> - create / edit [external link](../Note%20Types/Text/Links.md)
|
||||
* <kbd>Ctrl</kbd>+<kbd>L</kbd> - create [internal (note) link](../Note%20Types/Text/Links.md)
|
||||
* <kbd>Alt</kbd>+<kbd>T</kbd> - inserts current date and time at caret position
|
||||
* <kbd>Ctrl</kbd>+<kbd>.</kbd> - jump away from the editor to tree pane and scroll to current note
|
||||
|
||||
## Runtime shortcuts
|
||||
|
||||
These are hooked in Electron to be similar to native browser keyboard shortcuts.
|
||||
|
||||
* <kbd>F5</kbd>, <kbd>Ctrl</kbd>\-<kbd>R</kbd> - reloads Trilium front-end
|
||||
* <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>I</kbd> - show developer tools
|
||||
* <kbd>Ctrl</kbd>+<kbd>F</kbd> - show search dialog
|
||||
* <kbd>Ctrl</kbd>+<kbd>-</kbd> - zoom out
|
||||
* <kbd>Ctrl</kbd>+<kbd>=</kbd> - zoom in
|
||||
|
||||
## Other
|
||||
|
||||
* <kbd>Alt</kbd>+<kbd>O</kbd> - show SQL console (use only if you know what you're doing)
|
||||
* <kbd>Alt</kbd>+<kbd>M</kbd> - distraction-free mode - display only note editor, everything else is hidden
|
||||
* <kbd>F11</kbd> - toggle full screen
|
||||
* <kbd>Ctrl</kbd> + <kbd>S</kbd> - toggle [search](Navigation/Search.md) form in tree pane
|
||||
* <kbd>Alt</kbd> +<kbd>A</kbd> - show note [attributes](../Advanced%20Usage/Attributes.md) dialog
|
||||
|
After Width: | Height: | Size: 317 B |
|
After Width: | Height: | Size: 15 KiB |
@@ -0,0 +1,12 @@
|
||||
# Bookmarks
|
||||
To easily access selected notes, you can bookmark them. See demo:
|
||||
|
||||

|
||||
|
||||
## Bookmark folder
|
||||
|
||||
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:
|
||||
|
||||

|
||||
|
||||
To do this, you need to add a `#bookmarkFolder` label to the note.
|
||||
|
After Width: | Height: | Size: 52 KiB |