Merge branch 'develop' into renovate/autoprefixer-10.x
@ -1,53 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e # Fail on any command error
|
||||
|
||||
if ! command -v jq &> /dev/null; then
|
||||
echo "Missing command: jq"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! command -v fakeroot &> /dev/null; then
|
||||
echo "Missing command: fakeroot"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! command -v dpkg-deb &> /dev/null; then
|
||||
echo "Missing command: dpkg-deb"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if dpkg-deb 2>&1 | grep BusyBox &> /dev/null; then
|
||||
echo "The dpkg-deb binary provided by BusyBox is not compatible. The Debian tool needs to be used instead."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! command -v wine &> /dev/null; then
|
||||
echo "Missing command: wine"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Deleting existing builds"
|
||||
|
||||
rm -rf dist/*
|
||||
|
||||
SRC_DIR=dist/trilium-src
|
||||
|
||||
bin/copy-trilium.sh $SRC_DIR
|
||||
|
||||
# we'll just copy the same SRC dir to all the builds so we don't have to do npm install in each separately
|
||||
cp -r $SRC_DIR ./dist/trilium-linux-x64-src
|
||||
cp -r $SRC_DIR ./dist/trilium-linux-x64-server
|
||||
cp -r $SRC_DIR ./dist/trilium-windows-x64-src
|
||||
cp -r $SRC_DIR ./dist/trilium-mac-x64-src
|
||||
cp -r $SRC_DIR ./dist/trilium-mac-arm64-src
|
||||
|
||||
bin/build-win-x64.sh DONTCOPY
|
||||
|
||||
bin/build-mac-x64.sh DONTCOPY
|
||||
|
||||
bin/build-mac-arm64.sh DONTCOPY
|
||||
|
||||
bin/build-linux-x64.sh DONTCOPY
|
||||
|
||||
bin/build-server.sh DONTCOPY
|
||||
@ -1,9 +1,151 @@
|
||||
import fs from "fs/promises";
|
||||
import fsExtra from "fs-extra";
|
||||
import path from "path";
|
||||
import type NoteMeta from "./src/services/meta/note_meta.js";
|
||||
import type { NoteMetaFile } from "./src/services/meta/note_meta.js";
|
||||
import cls from "./src/services/cls.js";
|
||||
import { initializeTranslations } from "./src/services/i18n.js";
|
||||
import archiver, { type Archiver } from "archiver";
|
||||
import type { WriteStream } from "fs";
|
||||
import debounce from "./src/public/app/services/debounce.js";
|
||||
|
||||
const NOTE_ID_USER_GUIDE = "pOsGYCXsbNQG";
|
||||
const destRootPath = path.join("src", "public", "app", "doc_notes", "en", "User Guide");
|
||||
|
||||
async function startElectron() {
|
||||
await import("./electron-main.js");
|
||||
}
|
||||
|
||||
async function main() {
|
||||
await initializeTranslations();
|
||||
const zipBuffer = await createImportZip();
|
||||
await initializeDatabase();
|
||||
cls.init(() => {
|
||||
importData(zipBuffer);
|
||||
});
|
||||
|
||||
await startElectron();
|
||||
|
||||
|
||||
const events = (await import("./src/services/events.js")).default;
|
||||
const debouncer = debounce(() => {
|
||||
console.log("Exporting data");
|
||||
exportData();
|
||||
}, 10_000);;
|
||||
events.subscribe(events.ENTITY_CHANGED, async () => {
|
||||
console.log("Got entity changed");
|
||||
debouncer();
|
||||
});
|
||||
}
|
||||
|
||||
async function initializeDatabase() {
|
||||
const sqlInit = (await import("./src/services/sql_init.js")).default;
|
||||
|
||||
cls.init(() => {
|
||||
if (!sqlInit.isDbInitialized()) {
|
||||
sqlInit.createInitialDatabase();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async function importData(input: Buffer) {
|
||||
const beccaLoader = ((await import("./src/becca/becca_loader.js")).default);
|
||||
const notes = ((await import("./src/services/notes.js")).default);
|
||||
beccaLoader.load();
|
||||
|
||||
const { note } = notes.createNewNoteWithTarget("into", "none_root", {
|
||||
parentNoteId: "root",
|
||||
noteId: NOTE_ID_USER_GUIDE,
|
||||
title: "User Guide",
|
||||
content: "The sub-children of this note are automatically synced.",
|
||||
type: "text"
|
||||
});
|
||||
|
||||
const TaskContext = (await import("./src/services/task_context.js")).default;
|
||||
const { importZip } = ((await import("./src/services/import/zip.js")).default);
|
||||
const context = new TaskContext("no-report");
|
||||
await importZip(context, input, note, { preserveIds: true });
|
||||
}
|
||||
|
||||
async function createImportZip() {
|
||||
const archive = archiver("zip", {
|
||||
zlib: { level: 0 }
|
||||
});
|
||||
|
||||
archive.directory(destRootPath, "/");
|
||||
|
||||
const outputStream = fsExtra.createWriteStream("input.zip");
|
||||
archive.pipe(outputStream);
|
||||
await waitForEnd(archive, outputStream);
|
||||
|
||||
return await fsExtra.readFile("input.zip");
|
||||
}
|
||||
|
||||
function waitForEnd(archive: Archiver, stream: WriteStream) {
|
||||
return new Promise<void>(async (res, rej) => {
|
||||
stream.on("finish", () => res());
|
||||
await archive.finalize();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
async function exportData() {
|
||||
const zipFilePath = "output.zip";
|
||||
|
||||
const deferred = (await import("./src/services/utils.js")).deferred;
|
||||
|
||||
try {
|
||||
await fsExtra.remove(destRootPath);
|
||||
await fsExtra.mkdir(destRootPath);
|
||||
|
||||
// First export as zip.
|
||||
const { exportToZipFile } = (await import("./src/services/export/zip.js")).default;
|
||||
await exportToZipFile(NOTE_ID_USER_GUIDE, "markdown", zipFilePath);
|
||||
|
||||
const promise = deferred<void>()
|
||||
setTimeout(async () => {
|
||||
// Then extract the zip.
|
||||
const { readZipFile, readContent } = (await import("./src/services/import/zip.js"));
|
||||
await readZipFile(await fs.readFile(zipFilePath), async (zip, entry) => {
|
||||
// We ignore directories since they can appear out of order anyway.
|
||||
if (!entry.fileName.endsWith("/")) {
|
||||
const destPath = path.join(destRootPath, entry.fileName);
|
||||
const fileContent = await readContent(zip, entry);
|
||||
|
||||
await fsExtra.mkdirs(path.dirname(destPath));
|
||||
await fs.writeFile(destPath, fileContent);
|
||||
}
|
||||
|
||||
zip.readEntry();
|
||||
});
|
||||
promise.resolve();
|
||||
}, 1000);
|
||||
await promise;
|
||||
} finally {
|
||||
if (await fsExtra.exists(zipFilePath)) {
|
||||
await fsExtra.rm(zipFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
await cleanUpMeta();
|
||||
}
|
||||
|
||||
async function cleanUpMeta() {
|
||||
const metaPath = path.join(destRootPath, "!!!meta.json");
|
||||
const meta = JSON.parse(await fs.readFile(metaPath, "utf-8")) as NoteMetaFile;
|
||||
for (const file of meta.files) {
|
||||
traverse(file);
|
||||
}
|
||||
|
||||
function traverse(el: NoteMeta) {
|
||||
for (const child of el.children || []) {
|
||||
traverse(child);
|
||||
}
|
||||
|
||||
el.isExpanded = false;
|
||||
}
|
||||
|
||||
await fs.writeFile(metaPath, JSON.stringify(meta, null, 4));
|
||||
}
|
||||
|
||||
await main();
|
||||
|
||||
@ -0,0 +1,2 @@
|
||||
# User Guide
|
||||
The sub-children of this note are automatically synced.
|
||||
|
After Width: | Height: | Size: 113 KiB |
|
After Width: | Height: | Size: 68 KiB |
|
After Width: | Height: | Size: 77 KiB |
@ -0,0 +1,9 @@
|
||||
# Advanced Showcases
|
||||
Trilium offers advanced functionality through [Scripts](Code%20Notes/Scripts.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](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 |
|
After Width: | Height: | Size: 82 KiB |
@ -0,0 +1,63 @@
|
||||
# Task Manager
|
||||
Task Manager is a [promoted attributes](../Attributes/Promoted%20Attributes.md) and [scripts](../Code%20Notes/Scripts.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/Note/Cloning%20Notes.md) into day note to both todoDate note and doneDate note (with [prefix](../../Basic%20Concepts/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](../Code%20Notes/Events.md) handler which is run on attribute change. This [script](../Code%20Notes/Scripts.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](../Code%20Notes.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](../Code%20Notes.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.
|
||||
@ -0,0 +1,70 @@
|
||||
# Weight Tracker
|
||||

|
||||
|
||||
The `Weight Tracker` is a [Script API](../Code%20Notes/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](../Attributes/Template.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](../Code%20Notes/Scripts.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](../Code%20Notes.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](../Code%20Notes.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 |
@ -0,0 +1,25 @@
|
||||
# Attribute Inheritance
|
||||
## 1\. Standard Inheritance
|
||||
|
||||
In Trilium, attributes can be automatically inherited by child notes if they have the `isInheritable` flag set to `true`. This means the attribute (a key-value pair) is applied to the note and all its descendants.
|
||||
|
||||
### Example Use Case
|
||||
|
||||
The `archived` label can be set to be inheritable, allowing you to hide a whole subtree of notes from searches and other dialogs by applying this label at the top level.
|
||||
|
||||
## 2\. Copying Inheritance
|
||||
|
||||
Copying inheritance 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.
|
||||
|
||||
### How to Use
|
||||
|
||||
* **Syntax:** `#child:attributeName`
|
||||
* **Chained Inheritance:** You can chain this inheritance, such as `#child:child:attributeName`, where each child down the hierarchy receives the appropriate attribute.
|
||||
|
||||
### Example
|
||||
|
||||
If a parent note has the label `#child:exampleAttribute`, all newly created child notes will inherit the `#exampleAttribute` label. This can be useful for setting default properties for notes in a specific section.
|
||||
|
||||
## 3\. Template Inheritance
|
||||
|
||||
Attributes can also be inherited from [templates](Template.md). When a new note is created using a template, it inherits the attributes defined in that template. This is particularly useful for maintaining consistency across notes that follow a similar structure or function.
|
||||
@ -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 |
@ -0,0 +1,36 @@
|
||||
# Template
|
||||
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](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](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/Navigation/Workspace.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](../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: 36 KiB |
@ -0,0 +1,16 @@
|
||||
# Bulk actions
|
||||
### Execute script
|
||||
|
||||
For more complex scenarios, it is possible to type in a JavaScript expression in order to apply the necessary changes.
|
||||
|
||||
To apply a suffix (`- suffix` in this example), to the note title:
|
||||
|
||||
```javascript
|
||||
note.title = note.title + " - suffix";
|
||||
```
|
||||
|
||||
To alter attributes of a note in a bulk action, such as setting the `#shareAlias` label to the title of the note:
|
||||
|
||||
```javascript
|
||||
note.setLabel("shareAlias", note.title)
|
||||
```
|
||||
@ -0,0 +1,21 @@
|
||||
# Code Notes
|
||||
Trilium supports creating "code" notes, i.e. notes which contain some sort of formal code - be it programming language (C++, JavaScript), structured data (JSON, XML) or other types of codes (CSS etc.).
|
||||
|
||||
This can be useful for a few things:
|
||||
|
||||
* computer programmers can store code snippets as notes with syntax highlighting
|
||||
* JavaScript code notes can be executed inside Trilium for some extra functionality
|
||||
* we call such JavaScript code notes "scripts" - see [Scripts](Code%20Notes/Scripts.md)
|
||||
* JSON, XML etc. can be used as storage for structured data (typically used in conjunction with scripting)
|
||||
|
||||

|
||||
|
||||
## Extra languages
|
||||
|
||||
Trilium supports syntax highlighting for many languages, but by default displays only some of them (to reduce the number of items). You can add extra languages in Options -> Code notes.
|
||||
|
||||
## Code blocks
|
||||
|
||||
An alternative to the code note is a "code block" - feature of a text note which can add short snippets of code to the text editor. Starting with TriliumNext v0.90.12, the code blocks also support syntax highlighting.
|
||||
|
||||

|
||||
@ -0,0 +1,29 @@
|
||||
# Events
|
||||
[Script](Scripts.md) notes can be triggered by events. Note that these are backend events and thus relation need to point to the "JS backend" code note.
|
||||
|
||||
## Global events
|
||||
|
||||
Global events are attached to the script note via label. Simply create e.g. "run" label with some of these values and script note will be executed once the event occurs.
|
||||
|
||||
* `run`
|
||||
* `frontendStartup` - executes on frontend upon startup
|
||||
* `mobileStartup` - executes on mobile frontend upon startup
|
||||
* `backendStartup` - executes on backend upon startup
|
||||
* `hourly` - executes once an hour on backend
|
||||
* `daily` - executes once a day on backend
|
||||
|
||||
## Entity events
|
||||
|
||||
Other events are bound to some entity, these are defined as [relations](../Attributes.md) - meaning that script is triggered only if note has this script attached to it through relations (or it can inherit it).
|
||||
|
||||
* `runOnNoteCreation` - executes when note is created on backend
|
||||
* `runOnNoteTitleChange` - executes when note title is changed (includes note creation as well)
|
||||
* `runOnNoteContentChange` - executes when note content is changed (includes note creation as well).
|
||||
* `runOnNoteChange` - executes when note is changed (includes note creation as well)
|
||||
* `runOnNoteDeletion` - executes when note is being deleted
|
||||
* `runOnBranchCreation` - executes when a branch is created. Branch is a link between parent note and child note and is created e.g. when cloning or moving note.
|
||||
* `runOnBranchChange` (since v0.62) - executes when a branch is changed - either expanded status or prefix are changed.
|
||||
* `runOnBranchDeletion` - executes when a branch is delete. Branch is a link between parent note and child note and is deleted e.g. when moving note (old branch/link is deleted).
|
||||
* `runOnChildNoteCreation` - executes when new note is created under _this_ note
|
||||
* `runOnAttributeCreation` - executes when new attribute is created under _this_ note
|
||||
* `runOnAttributeChange` - executes when attribute is changed under _this_ note
|
||||
@ -0,0 +1,7 @@
|
||||
# Script API
|
||||
Trilium offers a "Script API" that enables scripts to perform various useful functions. There are two main APIs available:
|
||||
|
||||
* [Frontend API](https://triliumnext.github.io/Notes/frontend_api/FrontendScriptApi.html)
|
||||
* [Backend API](https://triliumnext.github.io/Notes/backend_api/BackendScriptApi.html)
|
||||
|
||||
Please note that the Script API is currently experimental and may undergo changes in future updates.
|
||||
@ -0,0 +1,54 @@
|
||||
# Scripts
|
||||
Trilium supports creating [code notes](../Code%20Notes.md), i.e. notes which allow you to store some programming code and highlight it. Special case is JavaScript code notes which can also be executed inside Trilium which can in conjunction with [Script API](Script%20API.md) provide extra functionality.
|
||||
|
||||
## Scripting
|
||||
|
||||
To go further I must explain basic architecture of Trilium - in its essence it is a classic web application - it has these two main components:
|
||||
|
||||
* frontend running in the browser (using HTML, CSS, JavaScript) - this is mainly used to interact with the user, display notes etc.
|
||||
* backend running JavaScript code in node.js runtime - this is responsible for e.g. storing notes, encrypting them etc.
|
||||
|
||||
So we have frontend and backend, each with their own set of responsibilities, but their common feature is that they both run JavaScript code. Add to this the fact, that we're able to create JavaScript \[\[code notes\]\] and we're onto something.
|
||||
|
||||
## Button use case
|
||||
|
||||
Let's take a look at our demo script (shipped with default Trilium [database](../Database.md)) - Task manager. One of the things this script does is adding a button to the Trilium interface which will allow user to easily add new Task (TODO item).
|
||||
|
||||

|
||||
|
||||
First take a look at the red circle all the way on the top - this what we want to achieve - new button in UI which will create new note representing a task/todo item.
|
||||
|
||||
Red point below the first one marks the note type we have created for this script - it's "JavaScript frontend". It's frontend because adding button to UI is clearly frontend responsibility.
|
||||
|
||||
In the note content you can see the code which calls one of the API methods, this one is specifically meant to add new buttons. Code needs to set few button properties:
|
||||
|
||||
* button title
|
||||
* icon which should appear on the button
|
||||
* optional shortcut under which you can trigger the button
|
||||
* most importantly "action" - what must happen when button is clicked
|
||||
|
||||
### Action handler
|
||||
|
||||
Saving the note to the database is backend's responsibility, so we immediately pass control to the backend and ask it to create a note. Once this is done, we show the newly created note so that the user can set the task title and maybe some attributes.
|
||||
|
||||
### Script execution
|
||||
|
||||
So we have a script which will add the button to the toolbar. But how can we execute it? One possibility is to click on "play" icon (marked by red circle). The problem with this is that this UI change is time bound by Trilium runtime so when we restart Trilium, button won't be there.
|
||||
|
||||
We need to execute it every time Trilium starts up, but we probably don't want to have to manually click on play button on every start up.
|
||||
|
||||
The solution is marked by red circle at the bottom - this note has [label](../Attributes.md) `#run=frontendStartup` - this is one of the "system" labels which Trilium understands. As you might guess, this will cause all such labeled script notes to be executed once Trilium frontend starts up.
|
||||
|
||||
(`#run=frontendStartup` does not work for [Mobile frontend](../../Installation%20%26%20Setup/Mobile%20Frontend.md) - if you want to have scripts running there, give the script `#run=mobileStartup` label)
|
||||
|
||||
### More showcases
|
||||
|
||||
You can see more scripting with explanation in [Advanced showcases](../Advanced%20Showcases.md)
|
||||
|
||||
## Events
|
||||
|
||||
See [Events](Events.md).
|
||||
|
||||
## Script API
|
||||
|
||||
See [Script API](Script%20API.md).
|
||||
|
After Width: | Height: | Size: 99 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:
|
||||
|
||||
```sh
|
||||
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,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;
|
||||
}
|
||||
```
|
||||
|
After Width: | Height: | Size: 668 B |
|
After Width: | Height: | Size: 542 B |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 635 B |
|
After Width: | Height: | Size: 508 B |
|
After Width: | Height: | Size: 134 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 542 B |
|
After Width: | Height: | Size: 508 B |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 30 KiB |
@ -0,0 +1,30 @@
|
||||
# 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.
|
||||
|
||||
As an example, 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.
|
||||
|
||||
Second variable injected is [parentNote](https://triliumnext.github.io/Notes/backend_api/BNote.html), an example could be `#titleTemplate="${parentNote.getLabelValue('authorName')}'s literary works"`.
|
||||
|
||||
See also \[\[[template](Attributes/Template.md)\]\] which provides similar capabilities, including default note's content.
|
||||
@ -0,0 +1,28 @@
|
||||
# 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).
|
||||
|
||||
[trilium-py](https://github.com/Nriver/trilium-py) is a third-party Python implementation for ETAPI client, you can use Python to communicate with Trilium.
|
||||
|
||||
## Authentication
|
||||
|
||||
All operations 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)):
|
||||
|
||||
```
|
||||
GET https://myserver.com/etapi/app-info
|
||||
Authorization: ETAPITOKEN
|
||||
```
|
||||
|
||||
Alternatively, since 0.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.
|
||||
@ -0,0 +1,25 @@
|
||||
# Note 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
|
||||
|
||||
Shows [relations](Attributes.md) between notes:
|
||||
|
||||

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

|
||||
|
||||
## See also
|
||||
|
||||
[Relation map](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
|
||||
|
After Width: | Height: | Size: 76 KiB |
@ -0,0 +1,49 @@
|
||||
# Relation Map
|
||||
Relation map is a type of [note](../Basic%20Concepts/Navigation/Tree%20Concepts.md) which visualizes notes and their [relations](Attributes.md). See an example:
|
||||
|
||||
## Development process demo
|
||||
|
||||
This is a basic example how you can create simple diagram using relation maps:
|
||||
|
||||

|
||||
|
||||
And this is how you can create it:
|
||||
|
||||

|
||||
|
||||
We start completely from scratch by first creating new note called "Development process" and changing its type to "Relation map". After that we create new notes one by one and place them by clicking into the map. We also drag [relations](Attributes.md)between notes and name them. That's all!
|
||||
|
||||
Items on the map - "Specification", "Development", "Testing" and "Demo" are actually notes which have been created under "Development process" note - you can click on them and write some content. Connections between notes are called "[relations](Attributes.md)".
|
||||
|
||||
## Family demo
|
||||
|
||||
This is more complicated demo using some advanced concepts. Resulting diagram is here:
|
||||
|
||||

|
||||
|
||||
This is how you get to it:
|
||||
|
||||

|
||||
|
||||
There are several steps here:
|
||||
|
||||
* we start with empty relation map and two existing notes representing Prince Philip and Queen Elizabeth II. These two notes already have "isPartnerOf" [relations](Attributes.md)defined.
|
||||
* There are actually two "inverse" relations (one from Philip to Elizabeth and one from Elizabeth to Philip)
|
||||
* we drag both notes to relation map and place to suitable position. Notice how the existing "isPartnerOf" relations are displayed.
|
||||
* now we create new note - we name it "Prince Charles" and place it on the relation map by clicking on the desired position. The note is by default created under the relation map note (visible in the note tree on the left).
|
||||
* we create two new relations "isChildOf" targeting both Philip and Elizabeth
|
||||
* now there's something unexpected - we can also see the relation to display another "hasChild" relation. This is because there's a [relation definition](Attributes/Promoted%20Attributes.md) which puts "isChildOf" as an "[inverse](Attributes/Promoted%20Attributes.md)" relation of "hasChildOf" (and vice versa) and thus it is created automatically.
|
||||
* we create another note for Princess Diana and create "isPartnerOf" relation from Charles. Again notice how the relation has arrows both ways - this is because "isPartnerOf" definition specifies its inverse relation as again "isPartnerOf" so the opposite relation is created automatically.
|
||||
* as the last step we pan & zoom the map to fit better to window dimensions.
|
||||
|
||||
Relation definitions mentioned above come from "Person template" note which is assigned to any child of "My Family Tree" relation note. You can play with the whole thing in the [demo notes](Database.md).
|
||||
|
||||
## Details
|
||||
|
||||
You can specify which relations should be displayed with comma delimited names of relations in `displayRelations` label.
|
||||
|
||||
Alternatively, you can specify comma delimited list of relation names in `hideRelations` which will display all relations, except for the ones defined in the label.
|
||||
|
||||
## See also
|
||||
|
||||
* [Note map](Note%20Map.md) is a similar concept
|
||||
@ -0,0 +1,101 @@
|
||||
# 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 [server installation](../Installation%20%26%20Setup/Server%20Installation.md) 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 [code note](Code%20Notes.md) 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/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.
|
||||
|
||||
## Additional Options
|
||||
|
||||
* **Raw Note Sharing**: Use the `#shareRaw` label to share a note without any HTML wrapper.
|
||||
* **Disallow Robot Indexing**: Add the `#shareDisallowRobotIndexing` label to prevent search engines from indexing the shared page by including a `noindex, follow` meta tag and `X-Robots-Tag: noindex` header.
|
||||
* **Shared Notes Index**: For text notes with the `#shareIndex` label, the content will display a list of all shared note roots.
|
||||
|
||||
## 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.
|
||||
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 6.8 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.
|
||||
|
||||
| | |
|
||||
| --- | --- |
|
||||
| <br><br>A note displayed as a web page (HTML) | <br><br>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.
|
||||
|
||||

|
||||
@ -1,56 +0,0 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="../../style.css">
|
||||
<base target="_parent">
|
||||
<title data-trilium-title>Custom resource providers</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="content">
|
||||
<h1 data-trilium-h1>Custom resource providers</h1>
|
||||
|
||||
<div class="ck-content">
|
||||
<p>A custom resource provider allows any file imported into Trilium (images,
|
||||
fonts, stylesheets) to be publicly accessible via a URL.</p>
|
||||
<p>A potential use case for this is to add embed a custom font alongside
|
||||
a theme.</p>
|
||||
<h2>Steps for creating a custom resource provider</h2>
|
||||
<ol>
|
||||
<li>Import a file such as an image or a font into Trilium by drag & drop.</li>
|
||||
<li>Select the file and go to the <i>Owned Attributes</i> section.</li>
|
||||
<li>Add the label <code>#customResourceProvider=hello</code>.</li>
|
||||
<li>To test if it is working, use a browser to navigate to <code><protocol>://<host>/custom/hello</code> (where <code><protocol></code> is
|
||||
either <code>http</code> or <code>https</code> based on your setup, and <code><host></code> is
|
||||
the host or IP to your Trilium server instance). If you are running the
|
||||
TriliumNext application without a server, use <code>http://localhost:37840</code> as
|
||||
the base URL.</li>
|
||||
<li>If everything went well, at the previous step the browser should have
|
||||
downloaded the file uploaded in the first step.</li>
|
||||
</ol>
|
||||
<p>Instead of <code>hello</code>, the name can be:</p>
|
||||
<ul>
|
||||
<li>A path, such as <code>fonts/Roboto.ttf</code>, which would be accessible
|
||||
via <code><host>/custom/fonts/Roboto.ttf</code>.</li>
|
||||
<li>As a more advanced use case, a regular expression to match multiple routes,
|
||||
such as <code>hello/.*</code> which will be accessible via <code>/custom/hello/1</code>, <code>/custom/hello/2</code>, <code>/custom/hello/world</code>,
|
||||
etc.</li>
|
||||
</ul>
|
||||
<h2>Using it in a theme</h2>
|
||||
<p>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 <code>#customResourceProvider=fonts/myfont.ttf</code> attribute.</p>
|
||||
<p>Then modify the theme CSS to point to:</p><pre><code class="language-text-css">@font-face {
|
||||
font-family: customFont;
|
||||
src: url("/custom/fonts/myfont.ttf");
|
||||
}
|
||||
|
||||
div {
|
||||
font-family: customFont;
|
||||
}</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 148 KiB |
|
After Width: | Height: | Size: 87 KiB |
|
After Width: | Height: | Size: 305 KiB |
|
After Width: | Height: | Size: 94 KiB |
|
After Width: | Height: | Size: 128 KiB |
|
After Width: | Height: | Size: 533 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 179 KiB |
|
After Width: | Height: | Size: 367 KiB |
|
After Width: | Height: | Size: 356 KiB |
|
After Width: | Height: | Size: 1.8 MiB |
|
After Width: | Height: | Size: 148 KiB |
|
After Width: | Height: | Size: 145 KiB |
|
After Width: | Height: | Size: 235 KiB |
|
After Width: | Height: | Size: 117 KiB |
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 29 KiB |
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg width="147px" height="32px" viewBox="0 0 147 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
|
||||
<!-- Generator: Sketch 3.0.4 (8053) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>button</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
|
||||
<g id="button" sketch:type="MSLayerGroup">
|
||||
<rect id="Background" fill="#7056BF" sketch:type="MSShapeGroup" x="0" y="0" width="147" height="32" rx="4"></rect>
|
||||
<g id="Icon" transform="translate(10.000000, 8.000000)" fill="#FFFFFF" sketch:type="MSShapeGroup">
|
||||
<path d="M14.819,3.216 L9.103,0.25 C8.464,-0.082 7.536,-0.081 6.898,0.25 L1.181,3.216 C0.496,3.571 0,4.365 0,5.102 L0,11.035 C0,11.774 0.497,12.566 1.181,12.921 L4.039,14.404 C4.529,14.656 5.134,14.467 5.388,13.978 C5.642,13.487 5.451,12.884 4.961,12.629 L2.106,11.148 C2.068,11.124 2.008,11.039 2,11.035 L1.996,5.143 C2.008,5.098 2.068,5.013 2.103,4.991 L7.816,2.026 C7.897,1.991 8.106,1.992 8.181,2.025 L13.894,4.989 C13.932,5.013 13.992,5.098 14,5.102 L14.003,10.995 C13.992,11.039 13.932,11.124 13.898,11.146 L11.039,12.629 C10.549,12.884 10.358,13.487 10.612,13.978 C10.79,14.32 11.14,14.517 11.501,14.517 C11.656,14.517 11.814,14.481 11.961,14.404 L14.818,12.921 C15.503,12.566 16,11.774 16,11.035 L16,5.102 C16,4.365 15.504,3.571 14.819,3.216" id="App"></path>
|
||||
<path d="M11.707,9.707 C12.098,9.316 12.098,8.684 11.707,8.293 L8.708,5.294 C8.616,5.201 8.505,5.128 8.382,5.077 C8.138,4.976 7.862,4.976 7.618,5.077 C7.495,5.128 7.385,5.201 7.292,5.294 L4.293,8.293 C3.902,8.684 3.902,9.316 4.293,9.707 C4.488,9.902 4.744,10 5,10 C5.256,10 5.512,9.902 5.707,9.707 L7,8.414 L7,15 C7,15.553 7.447,16 8,16 C8.553,16 9,15.553 9,15 L9,8.414 L10.293,9.707 C10.488,9.902 10.744,10 11,10 C11.256,10 11.512,9.902 11.707,9.707" id="Arrow"></path>
|
||||
</g>
|
||||
<path d="M81.393,21.091 C81.744,21.091 82.173,21.052 82.368,21.013 L82.368,20.09 C82.186,20.142 81.913,20.181 81.666,20.181 C80.834,20.181 80.6,19.817 80.6,19.089 L80.6,15.059 L82.381,15.059 L82.381,14.136 L80.6,14.136 L80.6,11.692 L79.482,11.692 L79.482,14.136 L78.286,14.136 L78.286,15.059 L79.482,15.059 L79.482,19.336 C79.482,20.532 79.95,21.091 81.393,21.091 Z M86.697,21.143 C88.374,21.143 89.882,19.921 89.882,17.568 C89.882,15.202 88.374,13.993 86.697,13.993 C85.007,13.993 83.499,15.202 83.499,17.568 C83.499,19.921 85.02,21.143 86.697,21.143 Z M86.697,20.194 C85.306,20.194 84.63,19.024 84.63,17.568 C84.63,16.021 85.384,14.955 86.697,14.955 C88.062,14.955 88.751,16.138 88.751,17.568 C88.751,19.141 87.997,20.194 86.697,20.194 Z M94.705,21 L95.849,21 L95.849,16.463 L100.802,16.463 L100.802,21 L101.946,21 L101.946,11.38 L100.802,11.38 L100.802,15.41 L95.849,15.41 L95.849,11.38 L94.705,11.38 L94.705,21 Z M106.834,21.143 C108.121,21.143 108.992,20.597 109.629,19.687 L108.979,19.115 C108.459,19.83 107.9,20.233 106.912,20.233 C105.781,20.233 104.884,19.401 104.845,17.854 L109.694,17.854 L109.694,17.62 C109.694,15.137 108.459,13.993 106.834,13.993 C105.391,13.993 103.727,15.072 103.727,17.568 C103.727,19.96 105.209,21.143 106.834,21.143 Z M104.871,16.983 C105.027,15.566 105.898,14.929 106.821,14.929 C107.952,14.929 108.537,15.761 108.628,16.983 L104.871,16.983 Z M111.293,21 L112.411,21 L112.411,16.567 C112.918,15.592 113.737,15.02 114.829,15.02 C114.868,15.02 115.115,15.02 115.154,15.033 L115.232,13.993 L115.089,13.993 C113.75,13.993 112.944,14.617 112.437,15.41 L112.411,15.41 L112.411,14.136 L111.293,14.136 L111.293,21 Z M119.301,21.143 C120.978,21.143 122.486,19.921 122.486,17.568 C122.486,15.202 120.978,13.993 119.301,13.993 C117.611,13.993 116.103,15.202 116.103,17.568 C116.103,19.921 117.624,21.143 119.301,21.143 Z M119.301,20.194 C117.91,20.194 117.234,19.024 117.234,17.568 C117.234,16.021 117.988,14.955 119.301,14.955 C120.666,14.955 121.355,16.138 121.355,17.568 C121.355,19.141 120.601,20.194 119.301,20.194 Z M124.072,21 L125.19,21 L125.19,18.894 L126.555,17.425 L128.583,21 L129.779,21 L127.283,16.593 L129.532,14.136 L128.258,14.136 L125.19,17.568 L125.19,11.38 L124.072,11.38 L124.072,21 Z M133.055,21.13 C134.173,21.13 135.031,20.558 135.629,19.973 L135.629,21 L136.76,21 L136.76,14.136 L135.629,14.136 L135.629,19.089 C134.914,19.765 134.238,20.194 133.406,20.194 C132.535,20.194 132.145,19.765 132.145,18.855 L132.145,14.136 L131.027,14.136 L131.027,19.089 C131.027,20.389 131.742,21.13 133.055,21.13 L133.055,21.13 Z" id="to-Heroku" fill="#B7A7D5" sketch:type="MSShapeGroup"></path>
|
||||
<path d="M34.183,21 L36.718,21 C39.773,21 41.567,19.427 41.567,16.164 C41.567,12.94 39.812,11.38 36.718,11.38 L34.183,11.38 L34.183,21 Z M35.327,19.973 L35.327,12.433 L36.835,12.433 C39.175,12.433 40.423,13.577 40.423,16.164 C40.423,18.842 39.188,19.973 36.861,19.973 L35.327,19.973 Z M46,21.143 C47.287,21.143 48.158,20.597 48.795,19.687 L48.145,19.115 C47.625,19.83 47.066,20.233 46.078,20.233 C44.947,20.233 44.05,19.401 44.011,17.854 L48.86,17.854 L48.86,17.62 C48.86,15.137 47.625,13.993 46,13.993 C44.557,13.993 42.893,15.072 42.893,17.568 C42.893,19.96 44.375,21.143 46,21.143 Z M44.037,16.983 C44.193,15.566 45.064,14.929 45.987,14.929 C47.118,14.929 47.703,15.761 47.794,16.983 L44.037,16.983 Z M50.459,23.6 L51.577,23.6 L51.577,20.116 C52.162,20.727 52.877,21.104 53.722,21.104 C55.399,21.104 56.634,19.947 56.634,17.555 C56.634,15.163 55.412,13.993 53.839,13.993 C52.812,13.993 52.097,14.513 51.577,15.085 L51.577,14.136 L50.459,14.136 L50.459,23.6 Z M53.566,20.194 C52.838,20.194 52.175,19.83 51.577,19.154 L51.577,16.008 C52.149,15.384 52.786,14.955 53.579,14.955 C54.684,14.955 55.516,15.813 55.516,17.568 C55.516,19.388 54.762,20.194 53.566,20.194 Z M58.324,21 L59.442,21 L59.442,11.38 L58.324,11.38 L58.324,21 Z M64.304,21.143 C65.981,21.143 67.489,19.921 67.489,17.568 C67.489,15.202 65.981,13.993 64.304,13.993 C62.614,13.993 61.106,15.202 61.106,17.568 C61.106,19.921 62.627,21.143 64.304,21.143 Z M64.304,20.194 C62.913,20.194 62.237,19.024 62.237,17.568 C62.237,16.021 62.991,14.955 64.304,14.955 C65.669,14.955 66.358,16.138 66.358,17.568 C66.358,19.141 65.604,20.194 64.304,20.194 Z M69.465,23.639 C70.804,23.639 71.337,22.989 71.805,21.78 L74.743,14.136 L73.612,14.136 L71.597,19.687 L71.571,19.687 L69.556,14.136 L68.373,14.136 L71.025,21.039 L70.765,21.715 C70.492,22.391 70.154,22.69 69.452,22.69 C68.971,22.69 68.633,22.625 68.438,22.573 L68.178,23.47 C68.477,23.561 68.854,23.639 69.465,23.639 L69.465,23.639 Z" id="Deploy" fill="#FFFFFF" sketch:type="MSShapeGroup"></path>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 6.6 KiB |
|
After Width: | Height: | Size: 222 KiB |
|
After Width: | Height: | Size: 332 KiB |
|
After Width: | Height: | Size: 309 KiB |
|
After Width: | Height: | Size: 714 KiB |
|
After Width: | Height: | Size: 200 KiB |
|
After Width: | Height: | Size: 61 KiB |
|
After Width: | Height: | Size: 95 KiB |
|
After Width: | Height: | Size: 41 KiB |
|
After Width: | Height: | Size: 121 KiB |
|
After Width: | Height: | Size: 562 KiB |
|
After Width: | Height: | Size: 178 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 40 KiB |
|
After Width: | Height: | Size: 86 KiB |
|
After Width: | Height: | Size: 155 KiB |
|
After Width: | Height: | Size: 211 KiB |
|
After Width: | Height: | Size: 69 KiB |
|
After Width: | Height: | Size: 716 KiB |
|
After Width: | Height: | Size: 265 KiB |
|
After Width: | Height: | Size: 95 KiB |