## 1. Project Overview & Quickstart (TriliumNext/README-ja)

# README-ja

Open-source repository TriliumNext/README-ja

### Repository Details
- **Repository:** [TriliumNext/README-ja](https://github.com/TriliumNext/README-ja)
- **Primary Language:** Code

*Note: High-volume repository documentation is actively indexed and synchronized by YakaAI.*

## 2. Official Technical Reference & Guides (TriliumNext/docs)

## File: README.md

> [!IMPORTANT]
> The docs repo is archived while we transition to a new documentation mechanism.

# TriliumNext Documentation

To import this documentation into your own instance of Trilium, [follow these instructions](Wiki/import-docs.md) 

## Table of Contents

- [Quick Start](Wiki/quick-start.md)
- [Screenshot Tour](Wiki/screenshot-tour.md)
- Basic Concepts    
    - [Note](Wiki/note.md)
        - [Text Notes](Wiki/text-notes.md)
        - [Links](Wiki/links.md)
        - [Images](Wiki/images.md)
        - [Attachments](Wiki/attachments.md)
        - [Cloning notes](Wiki/cloning-notes.md)
        - [Protected Notes](Wiki/protected-notes.md)
        - [Archived Notes](Wiki/archived-notes.md)
        - [Note Revisions](Wiki/note-revisions.md)
        - [Sorting Notes](Wiki/sorting.md)
    - Navigation
        - [Tree Concepts](Wiki/tree-concepts.md)
        - [Tree Manipulation](Wiki/tree-manipulation.md)
        - [Note Navigation](Wiki/note-navigation.md)
        - [Search](Wiki/search.md)
        - [Bookmarks](Wiki/bookmarks.md)
        - [Note Hoisting](Wiki/note-hoisting.md)
        - [Workspace](Wiki/workspace.md)
    - [Keyboard Shortcuts](Wiki/keyboard-shortcuts.md)
    - [Themes](Wiki/themes.md)
        - [Theme Gallery](Wiki)
    - Import & Export
        - [Markdown](Wiki/markdown.md)
        - [Evernote](Wiki/evernote-import.md)
        - [OneNote](Wiki/onenote.md)
- Installation & Setup
    - [Desktop Installation](Wiki/desktop-installation.md)
    - [Server Installation](Wiki/server-installation.md)
        - [Packaged Server Installation](Wiki/packaged-server-installation.md)
        - [Docker Server Installation](Wiki/docker-server-installation.md)
        - [NixOS Server Installation](Wiki/nixos-server-installation.md)
        - [Manual Server Installation](Wiki/manual-server-installation.md)
        - [Kubernettes Server Installation](Wiki/kubernetes-server-installation.md)
        - [Apache Proxy Setup](Wiki/apache-proxy-setup.md)
        - [Nginx Proxy Setup](Wiki/nginx-proxy-setup.md)
        - [TLS Configuration](Wiki/tls-configuration.md)
        - [Multi-Factor Authentication](Wiki/multi-factor-authentication.md)
    - [Synchronization](Wiki/synchronization.md)
    - [Mobile Frontend](Wiki/mobile-frontend.md)
    - [Web Clipper](Wiki/web-clipper.md)
    - [Upgrading Trilium](Wiki/upgrading-trilium.md)
    - [Backup](Wiki/backup.md)
    - [Data Directory](Wiki/data-directory.md)
- Advanced Usage 
    - [Attributes](Wiki/attributes.md)
        - [Attribute Inheritance](Wiki/attribute-inheritance.md)
        - [Promoted Attributes](Wiki/promoted-attributes.md)
        - [Template](Wiki/template.md)
    - [Relation Map](Wiki/relation-map.md)
    - [Note Map](Wiki/note-map.md)
    - [Book Note](Wiki/book-note.md)
    - [Sharing](Wiki/sharing.md)
    - [Code Notes](Wiki/code-notes.md)
        - [Scripts](Wiki/scripts.md)
        - [Script API](Wiki/script-api.md)
        - [Custom Request handler](Wiki/custom-request-handler.md)
        - [Events](Wiki/events.md)
        - [Custom Widgets](Wiki/custom-widget.md)
    - [Advanced Showcase](Wiki/advanced-showcases.md)
        - [Day Notes](Wiki/day-notes.md)
        - [Weight Tracker](Wiki/weight-tracker.md)
        - [Task Manager](Wiki/task-manager.md)
    - [ETAPI (Rest API)](Wiki/etapi.md)
    - [Default Note Title](Wiki/default-note-title.md)
    - [Database](Wiki/database.md)
- Developer Guides
    - [Frontend Basics](Wiki/frontend-basics.md)
    - [Widget Basics](Wiki/widget-basics.md)
- [FAQ](Wiki/faq.md)
- [Troubleshooting](Wiki/troubleshooting.md)

---

## File: Wiki/advanced-showcases.md

# Advanced Showcases

Trilium offers advanced functionality through [Scripts](scripts.md) and [Promoted Attributes](promoted-attributes.md). To illustrate these features, we've prepared several showcases available in the [demo notes](database.md):

* [Relation Map](relation-map.md)
* [Day Notes](day-notes.md)
* [Weight Tracker](weight-tracker.md)
* [Task Manager](task-manager.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.

---

## File: Wiki/anonymized-database.md

# Anonymized Database



In certain scenarios, understanding the structure of a database is crucial for troubleshooting issues. However, sharing your actual [database](database.md) file with personal notes is not advisable. To address this, Trilium offers a feature to anonymize the database. This feature can be accessed via Menu -> Options -> Advanced tab.

This feature creates a copy of your database with all sensitive data removed. Specifically, it strips out note titles, contents, revisions, history, and some non-system attributes while retaining the overall structure and metadata, such as modification dates. After anonymization, the database undergoes a [vacuuming process](https://sqlite.org/lang_vacuum.html) to ensure no sensitive data remnants remain in the file. The anonymized database is saved in the `anonymized` directory within the [data directory](data-directory.md), making it safe to share with bug reports.

This will create a copy of your document and remove all sensitive data (currently note titles, contents, revisions, history and some of the options, and non-system attributes) while leaving all structure and metadata (e.g. date of last change). After this is done, the database is [VACUUMed](https://sqlite.org/lang_vacuum.html) to make sure there's no stale sensitive data in the document file. The resulting file is stored in `anonymized` directory (placed in the [data directory](data-directory.md)). You can safely attach it to a bug report.

## Command Line Anonymization

If your [database](database.md) is corrupted to the point where Trilium cannot start, the anonymization process can still be executed via the command line:

```sh
node src/anonymize.js
```

Run this command from the directory containing Trilium's source files, typically found in the `resources/app` directory for desktop builds.

---

## File: Wiki/apache-proxy-setup.md

# Apache proxy setup
I've assumed you have created a DNS A record for `trilium.yourdomain.com` that you want to use for your Trilium server.

1.  Download docker image and create container

    ```text-plain
     docker pull triliumnext/notes:[VERSION]
     docker create --name trilium -t -p 127.0.0.1:8080:8080 -v ~/trilium-data:/home/node/trilium-data triliumnext/notes:[VERSION]
    ```

2.  Configure Apache proxy and websocket proxy

    1.  Enable apache proxy modules

        ```text-plain
         a2enmod ssl
         a2enmod proxy
         a2enmod proxy_http
         a2enmod proxy_wstunnel
        ```

    2.  Create a new let's encrypt certificate

        ```text-plain
         sudo certbot certonly -d trilium.mydomain.com
        ```

        Choose standalone (2) and note the location of the created certificates (typically /etc/letsencrypt/live/...)

    3.  Create a new virtual host file for apache (you may want to use `apachectl -S` to determine the server root location, mine is /etc/apache2)

        ```text-plain
         sudo nano /etc/apache2/sites-available/trilium.yourdomain.com.conf
        ```

        Paste (and customize) the following text into the configuration file

        ```text-plain
         <VirtualHost *:80>
             ServerName http://trilium.yourdomain.com
             RewriteEngine on
                 RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
         </VirtualHost>
         <VirtualHost *:443>
             ServerName https://trilium.yourdomain.com
             RewriteEngine On
             RewriteCond %{HTTP:Connection} Upgrade [NC]
             RewriteCond %{HTTP:Upgrade} websocket [NC]
             RewriteRule /(.*) ws://localhost:8080/$1 [P,L]
             AllowEncodedSlashes NoDecode
             ProxyPass / http://localhost:8080/ nocanon
             ProxyPassReverse / http://localhost:8080/
             SSLCertificateFile /etc/letsencrypt/live/trilium.yourdomain.com/fullchain.pem
             SSLCertificateKeyFile /etc/letsencrypt/live/trilium.yourdomain.com/privkey.pem
             Include /etc/letsencrypt/options-ssl-apache.conf
         </VirtualHost>
        ```

    4.  Enable the virtual host with `sudo a2ensite trilium.yourdomain.com.conf`

    5.  Reload apache2 with `sudo systemctl reload apache2`

3.  Create and enable a systemd service to start the docker container on boot

    1.  Create a new empty file called `/lib/systemd/system/trilium.service` with the contents

        ```text-plain
         [Unit]
         Description=Trilium Server
         Requires=docker.service
         After=docker.service

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

         [Install]
         WantedBy=local.target
        ```

    2.  Install, enable and start service

        ```text-plain
         sudo systemctl daemon-reload
         sudo systemctl enable trilium.service
         sudo systemctl start trilium.service
        ```

---

## File: Wiki/archived-notes.md

# Archived-notes
Archived notes are notes which have `archived` [attribute](attributes.md) - either directly or [inherited](attribute-inheritance.md).

Such notes are then by default not shown in the autocomplete and in the full text [search](search.md).

This can be useful for notes which are no longer very useful but still valuable enough to keep around without them getting too much in the way.

You can control whether archived notes are displayed in the note tree with a setting:

---

## File: Wiki/attachments.md

# Attachments

A [note](note.md) in Trilium can _own_ one or more attachments, which can be either images or files. These attachments can be displayed or linked within the note that owns them.

This can be especially useful to include dependencies for your [scripts](scripts.md). The [Weight Tracker](weight-tracker.md) shows how to use [chartjs](https://chartjs.org/) which is attached to the [script note](script-note.md).

Each note exclusively owns its attachments, meaning attachments cannot be shared or linked from one note to another. If an attachment link is copied to a different note, the attachment itself is duplicated, and the copies are managed independently thereafter.

Attachments, especially image files, are the recommended method for embedding visuals in notes. It is important to link image attachments within the text of the owning note; otherwise, they will be automatically deleted after a configurable timeout period if not referenced.

---

## File: Wiki/attribute-inheritance.md

# Attribute Inheritance in Trilium

## 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.

---

## File: Wiki/attributes.md

# Attributes in Trilium

In Trilium, attributes are key-value pairs assigned to notes, providing additional metadata or functionality. There are two primary types of attributes:

1. **Labels**: Simple key-value text records
2. **Relations**: Named links to other notes

These attributes play a crucial role in organizing, categorizing, and enhancing the functionality of notes.



## Labels

Labels in Trilium can be used for a variety of purposes:

- **Metadata**: Assign labels with optional values for categorization, such as `#year=1999`, `#genre="sci-fi"`, or `#author="Neal Stephenson"`
- **Configuration**: Labels can configure advanced features or settings
- **Scripts and Plugins**: Used to tag notes with special metadata, such as the "weight" attribute in the [Weight Tracker](weight-tracker.md)

Labels are also searchable, enhancing note retrieval.

### Common Labels for Advanced Configuration

- **`disableVersioning`**: Disables automatic versioning, ideal for large, unimportant notes like script libraries
- **`versioningLimit`**: Used to limit the number of revisions for a single note
- **`calendarRoot`**: Marks the note as the root for [day notes](day-notes.md). Only one note should carry this label
- **`archived`**: Hides notes from default search results and dialogs
- **`excludeFromExport`**: Excludes notes and their subtrees from export operations
- **`run`**: Specifies events to trigger scripts (e.g., `frontendStartup`, `hourly`)
- **`runAtHour`**: Defines specific hours for scripts to run, used with `#run=hourly`
- **`disableInclusion`**: Prevents a script from being included in parent script executions
- **`sorted`**: Automatically sorts child notes alphabetically by title
- **`top`**: Keeps the note at the top of its parent's list, useful with `sorted`
- **`hidePromotedAttributes`**: Hides certain attributes in the note's display
- **`readOnly`**: Sets the note to read-only mode, applicable to text and code notes
- **`autoReadOnlyDisabled`**: Disables automatic read-only mode for large notes
- **`appCss`**: Marks CSS notes used to modify Trilium’s appearance
- **`appTheme`**: Marks full CSS themes available in Trilium's options
- **`cssClass`**: Adds a CSS class to the note's representation in the tree
- **`iconClass`**: Adds a CSS class to the note's icon, useful for distinguishing notes visually. See [note icons](note-icons.md)
- **`pageSize`**: Specifies the number of items per page in note listings
- **`customRequestHandler` and `customResourceProvider`**: Refer to [Custom request handler](custom-request-handler.md)
- **`widget`**: Marks a note as a custom widget, added to Trilium's component tree
- **`workspace` and related attributes**: See [Workspace](workspace.md) for more details
- **`searchHome`**: Specifies the parent for new search notes
- **`inbox`**: Designates a default location for new notes created via the sidebar
- **`sqlConsoleHome`**: Default location for SQL console notes
- **`bookmarked` and `bookmarkFolder`**: See [Bookmarks](bookmarks.md)
- **`shareXXX`**: See [Sharing](sharing.md)
- **`keyboardShortcut`**: Assigns a keyboard shortcut to open the note
- **`displayRelations` and `hideRelations`**: Manages the display of note relations
- **`titleTemplate`**: See [Default note title](default-note-title.md)
- **`template`**: Makes the note available as a template
- **`toc`**: Controls the visibility of the table of contents
- **`color`**: Defines the color of the note in the tree and links
- **`hideChildrenOverview`**: Hides child notes in the parent note's editor
- **`viewType`**: Sets the view of child notes (grid or list)

## Relations

Relations define connections between notes, similar to links.

### Uses

- **Metadata Relationships**: For example, linking a book note to an author note
- **Scripting**: Attaching scripts to events or conditions related to the note

### Common Relations

- **Event-based Relations**: Such as `runOnNoteCreation` or `runOnNoteChange`, which trigger scripts on specific actions
- **Other Relations**: Include `template`, `renderNote`, `widget`, and sharing-related relations

## Multiplicity

Attributes in Trilium can be "multivalued", meaning multiple attributes with the same name can coexist.

## Attribute Definitions and Promoted Attributes

Special labels create "label/attribute" definitions, enhancing the organization and management of attributes. For more details, see [Promoted attributes](promoted-attributes.md).

## Attribute Inheritance

Trilium supports attribute inheritance, allowing child notes to inherit attributes from their parents. For more information, see [Attribute inheritance](attribute-inheritance.md).

---

## File: Wiki/backup.md

# Backup
Trilium supports simple backup scheme where it saves copy of the [document](document.md) on these events:

*   once a day
*   once a week
*   once a month
*   before DB migration to newer version

So in total you'll have at most 4 backups from different points in time which should protect you from various problems. These backups are stored by default in `backup` directory placed in the [data directory](data-directory.md).

This is only very basic backup solution, and you're encouraged to add some better backup solution - e.g. backing up the [document](document.md) to cloud / different computer etc.

Note that [synchronization](synchronization.md) provides also some backup capabilities by its nature of distributing the data to other computers.

Restoring backup
----------------

Let's assume you want to restore the weekly backup, here's how to do it:

*   find [data directory](data-directory.md) Trilium uses - easy way is to open "About Trilium Notes" from "Menu" in upper left corner and looking at "data directory"
    *   I'll refer to `~/trilium-data` as data directory from now on
*   find `~/trilium-data/backup/backup-weekly.db` - this is the [document](document.md) backup
*   at this point stop/kill Trilium
*   delete `~/trilium-data/document.db`, `~/trilium-data/document.db-wal` and `~/trilium-data/document.db-shm` (latter two files are auto generated)
*   copy and rename this `~/trilium-data/backup/backup-weekly.db` to `~/trilium-data/document.db`
*   make sure that the file is writable, e.g. with `chmod 600 document.db`
*   start Trilium again

If you have configured sync then you need to do it across all members of the sync cluster, otherwise older version (restored backup) of the document will be detected and synced to the newer version.

Disabling backup
----------------

Although this is not recommended, it is possible to disable backup in `config.ini` in the [data directory](data-directory.md):

```text-plain
[General]
... some other configs
# set to true to disable backups (e.g. because of limited space on server)
noBackup=true
```

You can also review the [configuration](configuration.md) file to provide all `config.ini` values as environment variables instead. 

See [sample config](https://github.com/TriliumNext/Notes/blob/master/config-sample.ini). %%{WARNING}%%

---

## File: Wiki/book-note.md

# Book Notes in Trilium

A **Book Note** in Trilium is a special type of [note](note.md) designed to display the contents of its child notes sequentially, creating a linear, book-like reading experience. This format is particularly useful for viewing multiple smaller notes in a cohesive, continuous manner.



In the example above, the "node.js" note on the left panel contains several child notes. The right panel displays the content of these child notes as a single continuous document.

## Features

### Linear Display

The Book Note format compiles the contents of all child notes into one continuous view. This makes it ideal for reading extensive information broken into smaller, manageable segments.

### Grid View Option

Trilium also offers a "Grid View" option within the Book Note properties. This view presents the child notes in a grid format, allowing for a more visual navigation experience.



Switching between these views can be easily managed through the Book Note's settings (or `viewType` attribu), allowing users to choose the format that best suits their reading or navigation preferences.