### Install Dependencies and Start Server Source: https://github.com/triliumnext/trilium/blob/main/README.md Clone the repository, install dependencies using pnpm, and start the development server. ```shell git clone https://github.com/TriliumNext/Trilium.git cd Trilium pnpm install pnpm run server:start ``` -------------------------------- ### Start TriliumNext Development Server Source: https://github.com/triliumnext/trilium/blob/main/docs/Script API/index.html Clone the repository, install dependencies, and start the development server for TriliumNext. ```bash git clone https://github.com/TriliumNext/Notes.git cd Notes npm install npm run server:start ``` -------------------------------- ### Setup Trilium Notes Project Source: https://github.com/triliumnext/trilium/blob/main/CLAUDE.md Installs project dependencies using pnpm. Ensure Corepack is enabled. ```bash corepack enable && pnpm install ``` -------------------------------- ### Install, Enable, and Start Systemd Service Source: https://github.com/triliumnext/trilium/blob/main/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Installation & Setup/Server Installation/2. Reverse proxy/Apache using Docker.html Commands to reload the systemd daemon, enable the Trilium service to start on boot, and start the service immediately. ```bash sudo systemctl daemon-reload ``` ```bash sudo systemctl enable trilium.service ``` ```bash sudo systemctl start trilium.service ``` -------------------------------- ### Install Playwright Source: https://github.com/triliumnext/trilium/blob/main/docs/Developer Guide/Developer Guide/Testing/End-to-end tests.md Installs Playwright locally before running tests. This is a one-time setup step. ```bash pnpm playwright install ``` -------------------------------- ### Install Dependencies and Edit Documentation Source: https://github.com/triliumnext/trilium/blob/main/README.md Clone the repository, install dependencies using pnpm, and run the documentation editing environment. ```shell git clone https://github.com/TriliumNext/Trilium.git cd Trilium pnpm install pnpm edit-docs:edit-docs ``` -------------------------------- ### Start Live Preview for CKEditor5 Math Source: https://github.com/triliumnext/trilium/blob/main/docs/Developer Guide/Developer Guide/Dependencies/CKEditor/ckeditor5-math.md Start a live preview server to see changes in real-time. This is useful during development for immediate feedback. ```bash yarn start ``` -------------------------------- ### Start Server and Reset Data Source: https://github.com/triliumnext/trilium/blob/main/docs/Developer Guide/Developer Guide/Concepts/Demo document.md This command sequence is used to test changes to the demo document. It first removes the existing data directory and then starts the server. ```bash rm -r data pnpm server:start ``` -------------------------------- ### Enable and Start systemd Service Source: https://github.com/triliumnext/trilium/blob/main/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Installation & Setup/Server Installation/1. Installing the server/Packaged version for Linux.html Enables the Trilium systemd service to start on boot and starts it immediately. The `-q` flag suppresses output. ```bash sudo systemctl enable --now -q trilium ``` -------------------------------- ### Install turndown-plugin-gfm Source: https://github.com/triliumnext/trilium/blob/main/packages/turndown-plugin-gfm/README.md Install the package using npm. ```bash npm install @joplin/turndown-plugin-gfm ``` -------------------------------- ### Install Node.js Dependencies and Build Source: https://github.com/triliumnext/trilium/blob/main/docs/User Guide/User Guide/Installation & Setup/Server Installation/1. Installing the server/Manually.md Navigate to the cloned directory, install all Node.js dependencies, rebuild the better-sqlite3 binary, and bundle the frontend JavaScript using webpack. ```bash cd trilium # download all node dependencies npm install # make sure the better-sqlite3 binary is there npm rebuild # bundles & minifies frontend JavaScript npm run webpack ``` -------------------------------- ### Start Development Server Source: https://github.com/triliumnext/trilium/blob/main/packages/ckeditor5-admonition/README.md Starts an HTTP server with live-reload for previewing and testing plugins. The browser opens by default, but this can be disabled. You can also specify the editor's interface language. ```bash npm run start # Disable auto-opening the browser. npm run start -- --no-open # Create the editor with the interface in German. npm run start -- --language=de ``` -------------------------------- ### Start Development Server Source: https://github.com/triliumnext/trilium/blob/main/packages/ckeditor5-footnotes/README.md Starts an HTTP server with live-reload for previewing and testing plugins. The browser opens by default, but this can be disabled. You can also specify the editor's interface language. ```bash npm run start ``` ```bash npm run start -- --no-open ``` ```bash npm run start -- --language=de ``` -------------------------------- ### Install Documentation Editor with Nix Source: https://github.com/triliumnext/trilium/blob/main/docs/README.md Install the documentation editor to your Nix profile for easy access. ```shell # Or install to your profile nix profile install .#edit-docs trilium-edit-docs ``` -------------------------------- ### Start Integration Test Server Source: https://github.com/triliumnext/trilium/blob/main/docs/Developer Guide/Developer Guide/Testing/End-to-end tests.md Starts the integration test server for E2E tests. Authentication is disabled for simplicity. ```bash pnpm e2e ``` -------------------------------- ### Start Trilium Server Docker Container (Debian) Source: https://github.com/triliumnext/trilium/blob/main/docs/Developer Guide/Developer Guide/Building/Docker.md Run this command in the `apps/server` directory to build and start the standard Debian-based Docker container for the Trilium server. ```bash pnpm docker-start-debian ``` -------------------------------- ### Example docker-compose.yaml for Trilium with Traefik Source: https://github.com/triliumnext/trilium/blob/main/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Installation & Setup/Server Installation/2. Reverse proxy/Traefik.html A complete docker-compose.yaml example for setting up the Trilium service behind a Traefik reverse proxy, including network configuration, environment variables, and Traefik labels. ```yaml services: trilium: image: triliumnext/trilium container_name: trilium networks: - traefik-proxy environment: - TRILIUM_NETWORK_TRUSTEDREVERSEPROXY=my-traefik-host-ip # e.g., 172.18.0.0/16 volumes: - /path/to/data:/home/node/trilium-data - /etc/timezone:/etc/timezone:ro - /etc/localtime:/etc/localtime:ro labels: - traefik.enable=true - traefik.http.routers.trilium.entrypoints=https - traefik.http.routers.trilium.rule=Host(`trilium.mydomain.tld`) - traefik.http.routers.trilium.tls=true - traefik.http.routers.trilium.service=trilium - traefik.http.services.trilium.loadbalancer.server.port=8080 # scheme must be HTTP instead of the usual HTTPS because of how trilium works - traefik.http.services.trilium.loadbalancer.server.scheme=http - traefik.docker.network=traefik-proxy # Tell Trilium the original request was HTTPS - traefik.http.routers.trilium.middlewares=trilium-headers@docker - traefik.http.middlewares.trilium-headers.headers.customrequestheaders.X-Forwarded-Proto=httpss networks: traefik-proxy: external: true ``` -------------------------------- ### Install http-server Source: https://github.com/triliumnext/trilium/blob/main/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Advanced Usage/Sharing/Exporting static HTML for web publishing.html Install the http-server package globally using npm. This is a Node.js-based web server used for testing static HTML exports locally. ```bash npm i -g http-server ``` -------------------------------- ### Example docker-compose.yaml for Trilium with Traefik Source: https://github.com/triliumnext/trilium/blob/main/docs/User Guide/User Guide/Installation & Setup/Server Installation/2. Reverse proxy/Traefik.md A complete docker-compose file example for setting up the Trilium service behind a Traefik reverse proxy, including network configuration, environment variables, volumes, and Traefik labels. ```yaml services: trilium: image: triliumnext/trilium container_name: trilium networks: - traefik-proxy environment: - TRILIUM_NETWORK_TRUSTEDREVERSEPROXY=my-traefik-host-ip # e.g., 172.18.0.0/16 volumes: - /path/to/data:/home/node/trilium-data - /etc/timezone:/etc/timezone:ro - /etc/localtime:/etc/localtime:ro labels: - traefik.enable=true - traefik.http.routers.trilium.entrypoints=https - traefik.http.routers.trilium.rule=Host(`trilium.mydomain.tld`) - traefik.http.routers.trilium.tls=true - traefik.http.routers.trilium.service=trilium - traefik.http.services.trilium.loadbalancer.server.port=8080 # scheme must be HTTP instead of the usual HTTPS because of how trilium works - traefik.http.services.trilium.loadbalancer.server.scheme=http - traefik.docker.network=traefik-proxy # Tell Trilium the original request was HTTPS - traefik.http.routers.trilium.middlewares=trilium-headers@docker - traefik.http.middlewares.trilium-headers.headers.customrequestheaders.X-Forwarded-Proto=https networks: traefik-proxy: external: true ``` -------------------------------- ### Install and Configure CKEditor 5 with Keyboard Marker Source: https://github.com/triliumnext/trilium/blob/main/packages/ckeditor5-keyboard-marker/README.md This snippet shows how to install the plugin via npm or yarn and then configure a ClassicEditor build to include the Kbd plugin and its corresponding button in the toolbar. ```javascript 'use strict'; // The editor creator to use. import ClassicEditorBase from '@ckeditor/ckeditor5-editor-classic/src/classiceditor'; import EssentialsPlugin from '@ckeditor/ckeditor5-essentials/src/essentials'; import AutoformatPlugin from '@ckeditor/ckeditor5-autoformat/src/autoformat'; import BoldPlugin from '@ckeditor/ckeditor5-basic-styles/src/bold'; import ItalicPlugin from '@ckeditor/ckeditor5-basic-styles/src/italic'; import HeadingPlugin from '@ckeditor/ckeditor5-heading/src/heading'; import LinkPlugin from '@ckeditor/ckeditor5-link/src/link'; import ListPlugin from '@ckeditor/ckeditor5-list/src/list'; import ParagraphPlugin from '@ckeditor/ckeditor5-paragraph/src/paragraph'; import RemoveFormat from '@ckeditor/ckeditor5-remove-format/src/removeformat'; import Kbd from '@mlewand/ckeditor5-keyboard-marker/src/Kbd'; export default class ClassicEditor extends ClassicEditorBase {} // Plugins to include in the build. ClassicEditor.builtinPlugins = [ EssentialsPlugin, AutoformatPlugin, BoldPlugin, ItalicPlugin, HeadingPlugin, LinkPlugin, ListPlugin, ParagraphPlugin, RemoveFormat, Kbd ]; ClassicEditor.defaultConfig = { toolbar: [ 'heading', '|', 'bold', 'italic', 'kbd', 'removeFormat' ], // This value must be kept in sync with the language defined in webpack.config.js. language: 'en' }; ``` -------------------------------- ### Preview Trilium Documentation Locally Source: https://github.com/triliumnext/trilium/blob/main/docs/Developer Guide/Developer Guide/Documentation.md Run this command to start a webserver for testing the documentation locally without building it first. Navigate to `localhost:9000` to view. ```bash pnpm docs:preview ``` -------------------------------- ### Start Authelia with Docker Compose Source: https://github.com/triliumnext/trilium/blob/main/apps/server/docker/authelia/README.md Initiates Authelia services using Docker Compose. Use 'docker compose logs -f authelia' to monitor the startup process. ```bash docker compose up -d # tail logs to confirm it booted: docker compose logs -f authelia ``` -------------------------------- ### Outdated glibc Error Example Source: https://github.com/triliumnext/trilium/blob/main/docs/User Guide/User Guide/Installation & Setup/Server Installation/1. Installing the server/Packaged version for Linux.md This is an example of an error message indicating an outdated glibc version, which may prevent certain Node.js modules from loading. Upgrading glibc or using an alternative installation method is recommended. ```bash Error: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /var/www/virtual/.../node_modules/@mlink/scrypt/build/Release/scrypt.node) at Object.Module._extensions..node (module.js:681:18) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) ``` -------------------------------- ### Contribute to TriliumNext Development Source: https://github.com/triliumnext/trilium/blob/main/docs/Script API/media/README.md Clone the repository, install Node.js dependencies, and start the development server to contribute to TriliumNext. ```shell git clone https://github.com/TriliumNext/Trilium.git cd Notes npm install npm run server:start ``` -------------------------------- ### Build Server Package Source: https://github.com/triliumnext/trilium/blob/main/docs/Developer Guide/Developer Guide/Building/Build deliveries locally.md Navigate to the `apps/server` directory and run this command to build the server artifacts. The built artifacts will be in `apps/server/dist` and the packaged build in `apps/server/out`. ```bash pnpm package ``` -------------------------------- ### Run Tests for CKEditor5 Math Source: https://github.com/triliumnext/trilium/blob/main/docs/Developer Guide/Developer Guide/Dependencies/CKEditor/ckeditor5-math.md Execute the test suite to ensure the plugin is functioning correctly. This command may require specific environment setup, such as having Chromium installed. ```bash yarn test ``` -------------------------------- ### Run Trilium Server with Nix Source: https://github.com/triliumnext/trilium/blob/main/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Installation & Setup/Desktop Installation/Nix flake.html Start the Trilium server application using `nix run` by specifying the server package. This allows for direct server execution without a full NixOS installation. ```bash nix run github:TriliumNext/Trilium/v0.95.0#server ``` -------------------------------- ### Get Raw Event Listeners Source: https://github.com/triliumnext/trilium/blob/main/docs/Script API/classes/Backend_Script_API._internal_.node_modules__types_xml2js.Parser.html Retrieves all listeners for an event, including wrappers created by .once(). This example demonstrates how to access and invoke these listeners, showing their behavior and how they can be used to manage event subscriptions. ```typescript import { EventEmitter } from 'node:events'; const emitter = new EventEmitter(); emitter.once('log', () => console.log('log once')); // Returns a new Array with a function `onceWrapper` which has a property // `listener` which contains the original listener bound above const listeners = emitter.rawListeners('log'); const logFnWrapper = listeners[0]; // Logs "log once" to the console and does not unbind the `once` event logFnWrapper.listener(); // Logs "log once" to the console and removes the listener logFnWrapper(); emitter.on('log', () => console.log('log persistently')); // Will return a new Array with a single function bound by `.on()` above const newListeners = emitter.rawListeners('log'); // Logs "log persistently" twice newListeners[0](); emitter.emit('log'); ``` -------------------------------- ### REST API Endpoint Example Source: https://github.com/triliumnext/trilium/blob/main/docs/Developer Guide/Developer Guide/Architecture/Backend.md Demonstrates a typical GET request handler for retrieving note data via the REST API. It accesses route parameters and uses the 'becca' instance to fetch note details. ```typescript router.get('/api/notes/:noteId', (req, res) => { const noteId = req.params.noteId const note = becca.getNote(noteId) res.json(note.getPojoWithContent()) }) ``` -------------------------------- ### pipe() - Chain tasks Source: https://github.com/triliumnext/trilium/blob/main/docs/Script API/interfaces/Frontend_Script_API._internal_.PromiseBase.html This example demonstrates chaining asynchronous tasks using pipe. The first task (an AJAX request) resolves with data, and its `userId` is then used to initiate a second AJAX request. The `pipe` method ensures that the second request only starts after the first one completes successfully. ```APIDOC ## pipe() ### Description Filters and/or chains Deferreds. This example shows chaining asynchronous tasks. ### Method pipe ### Parameters #### doneFilter - **doneFilter** (function) - A function that is called when the preceding Deferred is resolved. It typically performs another asynchronous operation and returns its Deferred. ### Request Example ```javascript var request = $.ajax( url, { dataType: "json" } ), chained = request.pipe(function( data ) { return $.ajax( url2, { data: { user: data.userId } } ); }); chained.done(function( data ) { // data retrieved from url2 as provided by the first request }); ``` ### Response #### Success Response - The `chained` Deferred will resolve with the data from the second AJAX request. ``` -------------------------------- ### Build Desktop Executable for Windows Source: https://github.com/triliumnext/trilium/blob/main/README.md Clone the repository, install dependencies using pnpm, and build the desktop app for Windows (x64). ```shell git clone https://github.com/TriliumNext/Trilium.git cd Trilium pnpm install pnpm run --filter desktop electron-forge:make --arch=x64 --platform=win32 ``` -------------------------------- ### Serve Development Build with Arguments Source: https://github.com/triliumnext/trilium/blob/main/apps/db-compare/README.md Serve a development build of the database compare tool, providing two database file paths as arguments. ```sh pnpm dev --args "apps/server/spec/db/document_v214.db" --args "apps/server/spec/db/document_v214_migrated.db" ``` -------------------------------- ### get Source: https://github.com/triliumnext/trilium/blob/main/docs/Script API/interfaces/Backend_Script_API._internal_.HeadersDefaults.html Represents the get operation with default headers. ```APIDOC ## get ### Description Represents the get operation with default headers. ### Method GET ### Endpoint Not specified, typically used with a base URL. ### Parameters This operation likely accepts parameters for the request body and query, but they are not explicitly defined here. It returns a `Partial` type. ### Request Example ```json { "example": "request body for get" } ``` ### Response #### Success Response (200) Returns a `Partial` type representing the result of the get operation. #### Response Example ```json { "example": "response body for get" } ``` ``` -------------------------------- ### Build Standalone Web App and Generate Android Project Source: https://github.com/triliumnext/trilium/blob/main/apps/mobile/README.md Use these commands for the initial setup of the mobile application. The first command builds the web assets, and the second generates the native Android project. ```bash pnpm --filter @triliumnext/mobile build pnpm --filter @triliumnext/mobile exec cap add android ``` -------------------------------- ### get Source: https://github.com/triliumnext/trilium/blob/main/docs/Script API/interfaces/Backend_Script_API._internal_.AxiosStatic.html Sends a GET request to the specified URL. ```APIDOC ## get, D = any>(url: string, config?: AxiosRequestConfig): Promise ### Description Sends an HTTP GET request to the specified URL. This is used to retrieve data from a server. ### Method GET ### Endpoint {url} ### Parameters #### Path Parameters - **url** (string) - Required - The URL to send the GET request to. #### Query Parameters - **config** (AxiosRequestConfig) - Optional - Configuration options for the request, such as headers or query parameters. ### Response #### Success Response (200) - **R** (Promise) - The response data from the server. ``` -------------------------------- ### Axios GET Method Source: https://github.com/triliumnext/trilium/blob/main/docs/Script API/classes/Backend_Script_API._internal_.Axios.html Makes a GET request to the specified URL. ```APIDOC ## get ### Description Makes a GET request to the specified URL. ### Method get, D = any>(url: string, config?: AxiosRequestConfig): Promise ### Parameters * url: string * `Optional` config: AxiosRequestConfig ### Returns Promise ``` -------------------------------- ### Example Script for Launcher Source: https://github.com/triliumnext/trilium/blob/main/apps/server/src/assets/doc_notes/en/launchbar_script_launcher.html This script demonstrates how to display a message box showing the title of the currently active note when executed by the launcher. ```javascript api.showMessage("Current note is " + api.getActiveContextNote().title); ``` -------------------------------- ### Start Trilium Desktop in Production Mode Source: https://github.com/triliumnext/trilium/blob/main/docs/Developer Guide/Developer Guide/Building/Running a development build.md Run the desktop application in production mode. ```bash pnpm desktop:start-prod ``` -------------------------------- ### WebSocket API - Client Subscription Example Source: https://github.com/triliumnext/trilium/blob/main/docs/Developer Guide/Developer Guide/Architecture/APIs.md Example of how a client can subscribe to 'entity-change' events. ```APIDOC ```typescript ws.subscribe('entity-change', (data) => { froca.processEntityChange(data) }) ``` ``` -------------------------------- ### Build Trilium Documentation Source: https://github.com/triliumnext/trilium/blob/main/docs/Developer Guide/Developer Guide/Documentation.md Run this command in the Git root to build the documentation. The output will be available in the `site` directory. ```bash pnpm docs:build ``` -------------------------------- ### Build Desktop Packages Source: https://github.com/triliumnext/trilium/blob/main/docs/Developer Guide/Developer Guide/Building/Build deliveries locally.md Run this command in the `apps/desktop` directory to generate the desktop packages. ```bash pnpm electron-forge:make ``` -------------------------------- ### GET Method Source: https://github.com/triliumnext/trilium/blob/main/docs/Script API/interfaces/Backend_Script_API._internal_.AxiosInstance.html Sends a GET request to the specified URL. It can optionally accept configuration options. ```APIDOC ## GET ### Description Sends a GET request to the specified URL. It can optionally accept configuration options. ### Method GET ### Endpoint /{url} ### Parameters #### Path Parameters - **url** (string) - Required - The URL to send the request to. #### Query Parameters None #### Request Body None ### Request Example ```json { "url": "/api/data" } ``` ### Response #### Success Response (200) - **data** (any) - The response data from the server. #### Response Example ```json { "items": ["item1", "item2"] } ``` ``` -------------------------------- ### Gutter Style Example Source: https://github.com/triliumnext/trilium/blob/main/packages/splitjs/README.md Example of a return object for gutterStyle, setting a fixed width for the gutter. ```javascript { 'width': '10px' } ``` -------------------------------- ### Build Desktop Flatpak Package Source: https://github.com/triliumnext/trilium/blob/main/docs/Developer Guide/Developer Guide/Building/Build deliveries locally.md Run this command in the `apps/desktop` directory to specifically build the Flatpak package. ```bash pnpm electron-forge:make-flatpak ``` -------------------------------- ### Start Trilium Desktop in Development Mode Source: https://github.com/triliumnext/trilium/blob/main/docs/Developer Guide/Developer Guide/Building/Running a development build.md Run the desktop application in development mode. ```bash pnpm desktop:start ``` -------------------------------- ### Install Trilium DB Dump Tool Source: https://github.com/triliumnext/trilium/blob/main/apps/dump-db/README.md Install the necessary dependencies for the dump tool using npm. ```bash npm install ``` -------------------------------- ### Start Docker Compose Container Source: https://github.com/triliumnext/trilium/blob/main/docs/User Guide/User Guide/Installation & Setup/Server Installation/1. Installing the server/Using Docker.md Starts the Trilium Docker container in detached mode using Docker Compose. ```bash docker compose up -d ``` -------------------------------- ### Start Trilium Notes Development Servers Source: https://github.com/triliumnext/trilium/blob/main/CLAUDE.md Launches development servers for the backend, Electron app, or standalone client. ```bash pnpm server:start # Dev server at http://localhost:8080 ``` ```bash pnpm desktop:start # Electron dev app ``` ```bash pnpm standalone:start # Standalone client dev ``` -------------------------------- ### Split Initialization with Options Source: https://github.com/triliumnext/trilium/blob/main/packages/splitjs/README.md Demonstrates how to initialize Split.js with various configuration options to customize the split behavior. ```APIDOC ## Split Initialization Options This section details the various configuration options available when initializing Split.js. ### `sizes` An array of initial sizes of the elements, specified as percentage values. Example: Setting the initial sizes to `25%` and `75%`. ```js Split(['#one', '#two'], { sizes: [25, 75] }) ``` ### `minSize` An array of minimum sizes of the elements, specified as pixel values. Default: `100`. Example: Setting the minimum sizes to `100px` and `300px`, respectively. ```js Split(['#one', '#two'], { minSize: [100, 300] }) ``` If a number is passed instead of an array, all elements are set to the same minimum size: ```js Split(['#one', '#two'], { minSize: 100 }) ``` ### `maxSize` An array of maximum sizes of the elements, specified as pixel values. Default: `Infinity`. Example: Setting the maximum sizes of the first element to `500px`, and not setting a maximum size on the second element. ```js Split(['#one', '#two'], { maxSize: [500, Infinity] }) ``` If a number is passed instead of an array, all elements are set to the same maximum size: ```js Split(['#one', '#two'], { maxSize: 500 }) ``` ### `expandToMin` When the split is created, if `expandToMin` is `true`, the `minSize` for each element overrides the percentage value from the `sizes` option. Default: `false`. Example: The first element (`#one`) is set to 25% width of the parent container. However, its `minSize` is `300px`. Using `expandToMin: true` means that the first element will always load at at least `300px`, even if `25%` were smaller. ```js Split(['#one', '#two'], { sizes: [25, 75], minSize: [300, 100], expandToMin: true }) ``` ### `gutterSize` Gutter size in pixels. Default: `10`. Example: Setting the gutter size to `20px`. ```js Split(['#one', '#two'], { gutterSize: 20 }) ``` ### `gutterAlign` Possible options are `'start'`, `'end'` and `'center'`. Determines how the gutter aligns between the two elements. `'start'` shrinks the first element to fit the gutter, `'end'` shrinks the second element to fit the gutter and `'center'` shrinks both elements by the same amount so the gutter sits between. Added in v1.5.3. Default: `'center'`. Example: move gutter to the side of the second element: ```js Split(['#one', '#two'], { gutterAlign: 'end' }) ``` ### `snapOffset` Snap to minimum size at this offset in pixels. Default: `30`. Example: Set to `0` to disable the snap effect. ```js Split(['#one', '#two'], { snapOffset: 0 }) ``` ### `dragInterval` Drag this number of pixels at a time. Defaults to `1` for smooth dragging, but can be set to a pixel value to give more control over the resulting sizes. Works particularly well when the `gutterSize` is set to the same size. Added in v1.5.3. Example: Drag 20px at a time: ```js Split(['#one', '#two'], { dragInterval: 20 }) ``` ### `direction` Direction to split in. Can be `'vertical'` or `'horizontal'`. Determines which CSS properties are applied (ie. width/height) to each element and gutter. Default: `'horizontal'`. Example: split vertically: ```js Split(['#one', '#two'], { direction: 'vertical' }) ``` ### `cursor` Cursor to show on the gutter (also applied to the body on dragging to prevent flickering). Defaults to `'col-resize'` for `direction: 'horizontal'` and `'row-resize'` for `direction: 'vertical'`. ```js Split(['#one', '#two'], { direction: 'vertical', cursor: 'row-resize' }) ``` ### `gutter` Optional function called to create each gutter element. The signature looks like this: ```js (index, direction, pairElement) => HTMLElement ``` Defaults to creating a `div` with `class="gutter gutter-horizontal"` or `class="gutter gutter-vertical"`, depending on the direction. The default gutter function looks like this: ```js (index, direction) => { const gutter = document.createElement('div') gutter.className = `gutter gutter-${direction}` return gutter } ``` The returned element is then inserted into the DOM, and its width or height are set. This option can be used to clone an existing DOM element, or to create a new element with custom styles. Returning a falsey value like `null` or `false` will not insert a gutter. This behavior was added in v1.4.1. An additional argument, `pairElement`, is passed to the gutter function: this is the DOM element after (to the right or below) the gutter. This argument was added in v1.4.1. This final argument makes it easy to return the gutter that has already been created, for example, if `split.destroy()` was called with the option to preserve the gutters. ```js (index, direction, pairElement) => pairElement.previousSibling ``` ``` -------------------------------- ### Example: Logging Connection Listeners Source: https://github.com/triliumnext/trilium/blob/main/docs/Script API/classes/Backend_Script_API._internal_.EventEmitter.html Demonstrates how to retrieve and inspect the listeners for a 'connection' event using the listeners() method and util.inspect for formatted output. ```javascript server.on('connection', (stream) => { console.log('someone connected!');});console.log(util.inspect(server.listeners('connection')));// Prints: [ [Function] ] ``` -------------------------------- ### Vertical Split Element Style Example Source: https://github.com/triliumnext/trilium/blob/main/packages/splitjs/README.md Example of a return object for elementStyle for a vertical split, setting the height. ```javascript { 'height': 'calc(50% - 5px)' } ``` -------------------------------- ### Nix Shell for Linux Builds with Packaging Tools Source: https://github.com/triliumnext/trilium/blob/main/docs/Developer Guide/Developer Guide/Building/Build deliveries locally.md This command sets up a Nix shell with `jq`, `fakeroot`, and `dpkg` for Linux builds on NixOS that require packaging tools. ```bash nix-shell -p jq fakeroot dpkg ``` -------------------------------- ### Horizontal Split Element Style Example Source: https://github.com/triliumnext/trilium/blob/main/packages/splitjs/README.md Example of a return object for elementStyle for a horizontal split, setting the width. ```javascript { 'width': 'calc(50% - 5px)' } ``` -------------------------------- ### Install Dependencies with pnpm Source: https://github.com/triliumnext/trilium/blob/main/docs/Developer Guide/Developer Guide/Environment Setup.md Installs all project dependencies using pnpm. It is recommended to run this after each git pull on the main branch. ```bash pnpm i ``` -------------------------------- ### Download and Install Nightly Release on Windows Source: https://github.com/triliumnext/trilium/blob/main/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Advanced Usage/Nightly release.html This PowerShell script downloads and executes the latest nightly release installer for Windows. It automatically detects the system architecture (x64 or ARM64) and handles potential errors during download or execution. The downloaded installer is cleaned up after execution. ```powershell if ($env:PROCESSOR_ARCHITECTURE -eq "ARM64") { $arch = "arm64"; } else { $arch = "x64"; } $exeUrl = "https://github.com/TriliumNext/Trilium/releases/download/nightly/TriliumNotes-main-windows-$($arch).exe"; Write-Host "Downloading $($exeUrl)" # Generate a unique path in the temp dir $guid = [guid]::NewGuid().ToString() $destination = Join-Path -Path $env:TEMP -ChildPath "$guid.exe" try { $ProgressPreference = 'SilentlyContinue' Invoke-WebRequest -Uri $exeUrl -OutFile $destination $process = Start-Process -FilePath $destination } catch { Write-Error "An error occurred: $_" } finally { # Clean up if (Test-Path $destination) { Remove-Item -Path $destination -Force } } ``` -------------------------------- ### ETAPI Request Example Source: https://github.com/triliumnext/trilium/blob/main/docs/Developer Guide/Developer Guide/Architecture/APIs.md Demonstrates how to make a request to the ETAPI using curl. Replace YOUR_TOKEN with your actual ETAPI token. ```bash curl -H "Authorization: YOUR_TOKEN" \ https://trilium.example.com/etapi/notes/noteId ``` -------------------------------- ### Install dependencies and update lock file Source: https://github.com/triliumnext/trilium/blob/main/docs/Developer Guide/Developer Guide/Building/Releasing a new version.md After updating versions, run this command to install dependencies and update the package lock file. ```bash pnpm i ``` -------------------------------- ### Create a Basic 'Hello World' Widget Source: https://github.com/triliumnext/trilium/blob/main/docs/User Guide/User Guide/Scripting/Frontend Basics/Custom Widgets/Right pane widget.md Implement a simple widget that displays a static message. The `doRenderBody` method appends a predefined HTML template to the widget's body. Ensure `parentWidget` is set to 'right-pane'. ```javascript const template = `
Hi
`; class HelloWorldWidget extends api.RightPanelWidget { get widgetTitle() { return "Title goes here"; } get parentWidget() { return "right-pane" } doRenderBody() { this.$body.empty().append($(template)); } async refreshWithNote(note) { // Do something when the note changes. } } module.exports = new HelloWorldWidget(); ``` -------------------------------- ### Code Block Example Source: https://github.com/triliumnext/trilium/blob/main/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Note Types/Text/Developer-specific formatting.html Display a snippet of code in a dedicated block, with optional syntax highlighting. This is suitable for short code examples. ```javascript function example() { // JavaScript code here } ``` -------------------------------- ### Nix Shell for Linux Builds Source: https://github.com/triliumnext/trilium/blob/main/docs/Developer Guide/Developer Guide/Building/Build deliveries locally.md This command sets up a Nix shell with `jq` for basic Linux builds on NixOS. ```bash nix-shell -p jq ``` -------------------------------- ### Install Nginx and Remove Apache Source: https://github.com/triliumnext/trilium/blob/main/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Installation & Setup/Server Installation/2. Reverse proxy/Nginx.html Installs Nginx and removes Apache2 on Ubuntu systems. This is the initial step for setting up Nginx as a reverse proxy. ```bash sudo apt-get install nginx sudo apt-get remove apache2 ``` -------------------------------- ### Constructor Source: https://github.com/triliumnext/trilium/blob/main/docs/Script API/classes/Backend_Script_API._internal_.default.html Initializes a new instance of the default class, setting up the backend cache. ```APIDOC ## new default() ### Description Initializes a new instance of the default class. ### Returns - default: A new instance of the default class. ``` -------------------------------- ### getActiveNoteDetailWidget Source: https://github.com/triliumnext/trilium/blob/main/docs/Script API/interfaces/Frontend_Script_API.Api.html Get access to the widget handling note detail. Methods like `getWidgetType()` and `getTypeWidget()` to get to the implementation of actual widget type. ```APIDOC ## getActiveNoteDetailWidget ### Description Get access to the widget handling note detail. Methods like `getWidgetType()` and `getTypeWidget()` to get to the implementation of actual widget type. ### Returns Promise<[default](../classes/Frontend_Script_API._internal_.default-2.html)"> ### Method `getActiveNoteDetailWidget()` ```