Merge branch 'develop' into build_improve-electron-forge_v3

This commit is contained in:
Elian Doran 2025-03-15 23:42:43 +02:00 committed by GitHub
commit c1acaa0159
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
44 changed files with 535 additions and 638 deletions

View File

@ -1,9 +1,9 @@
name: Dev
on:
push:
branches-ignore:
- 'develop'
- 'feature/update**'
branches: [ develop ]
pull_request:
branches: [ develop ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

View File

@ -9,7 +9,7 @@
"pOsGYCXsbNQG"
],
"title": "User Guide",
"notePosition": 90,
"notePosition": 10,
"prefix": null,
"isExpanded": false,
"type": "text",
@ -1481,13 +1481,6 @@
"type": "text",
"mime": "text/markdown",
"attributes": [
{
"type": "relation",
"name": "imageLink",
"value": "JXFeNgU8Xnp1",
"isInheritable": false,
"position": 10
},
{
"type": "relation",
"name": "internalLink",
@ -1516,13 +1509,6 @@
"isInheritable": false,
"position": 50
},
{
"type": "relation",
"name": "internalLink",
"value": "BFs8mudNFgCS",
"isInheritable": false,
"position": 60
},
{
"type": "label",
"name": "shareAlias",
@ -1648,13 +1634,6 @@
"isInheritable": false,
"position": 40
},
{
"type": "relation",
"name": "internalLink",
"value": "_lbSettings",
"isInheritable": false,
"position": 50
},
{
"type": "label",
"name": "iconClass",
@ -6553,6 +6532,13 @@
"value": "bx bx-question-mark",
"isInheritable": false,
"position": 40
},
{
"type": "relation",
"name": "internalLink",
"value": "wy8So3yZZlH9",
"isInheritable": false,
"position": 80
}
],
"format": "markdown",

View File

@ -15,4 +15,4 @@ After importing the ENEX file, go over the imported notes and resources to be su
All resources (except for images) are created as note's attachments.
HTML inside ENEX files is not exactly valid so some formatting maybe broken or lost. You can report major problems into [Trilium issue tracker](https://github.com/TriliumNext/Notes/issues). %%{WARNING}%%
HTML inside ENEX files is not exactly valid so some formatting maybe broken or lost. You can report major problems into [Trilium issue tracker](https://github.com/TriliumNext/Notes/issues).

View File

@ -1,23 +1,17 @@
# FAQ
## Mac OS support
## macOS support
Originally, desktop builds of Trilium Notes has been available for Windows & Linux, but there has been a considerable demand for macOS build.
Originally, Trilium Notes considered the macOS build unsupported. TriliumNext commits to make the experience on macOS as good as possible.
So I made one, but I underestimated the differences and specifics of Mac platform which seems to require special handling in several places. My lack of knowledge and frankly willingness to learn & code Mac specific functionality resulted in a current state where [Trilium does not integrate well into the OS](https://github.com/TriliumNext/Notes/issues/511) 
if you find any platform-specific issues, feel free to [report them](Troubleshooting/Reporting%20issues.md).
%%{WARNING}%%.
## Translation / localisation support
macOS build is from now on considered "unsupported". I will strive to keep it fundamentally functional, but I won't work on Mac specific features or integrations. Note that this is more of an acknowledgment of an existing state rather than sudden change of direction.
The original Trilium Notes application did not support multiple languages. Since we believe that internationalisation is a core part of an application, we have added support for it.
Of course, PRs are welcome.
Contributions to translations are welcome.
## Translation / localization support
Trilium is currently available only in English. Translation to other languages is not planned in the near/medium term because it brings a significant maintenance overhead. This decision might be revisited once Trilium stabilizes into a more mature product.
For Chinese, there's an unofficial fork [here](https://github.com/Nriver/trilium-translation). Use at your own risk.
## Multi user support
## Multi-user support
Common request is to allow multiple users collaborate, share notes etc. So far I'm resisting this because of these reasons:
@ -41,7 +35,9 @@ No.
These general purpose sync apps are not suitable to sync database files which are open and being worked on by another application. The result is that they will corrupt the database file, resulting in data loss and this message in the Trilium logs:
> SqliteError: database disk image is malformed
```
SqliteError: database disk image is malformed
```
The only supported way to sync Trilium's data across the network is to use a [sync/web server](Installation%20%26%20Setup/Synchronization.md).

View File

@ -18,7 +18,7 @@ Let's assume you want to restore the weekly backup, here's how to do it:
* find [data directory](Data%20directory.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](#root/xjSsCcvVZf6H)backup
* find `~/trilium-data/backup/backup-weekly.db` - this is the [document](#root/xjSsCcvVZf6H) 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`
@ -40,4 +40,4 @@ noBackup=true
You can also review the [configuration](../Advanced%20Usage/Configuration%20\(config.ini%20or%20e.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}%%
See [sample config](https://github.com/TriliumNext/Notes/blob/master/config-sample.ini).

View File

@ -9,7 +9,8 @@ If you need help installing Docker, reference the [Docker Installation Docs](htt
**Note:** Trilium's Docker container requires root privileges to operate correctly.
> \[!WARNING\] If you're using a SMB/CIFS share or folder as your Trilium data directory, [you'll need](https://github.com/TriliumNext/Notes/issues/415#issuecomment-2344824400) to add the mount options of `nobrl` and `noperm` when mounting your SMB share.
> [!WARNING]
> If you're using a SMB/CIFS share or folder as your Trilium data directory, [you'll need](https://github.com/TriliumNext/Notes/issues/415#issuecomment-2344824400) to add the mount options of `nobrl` and `noperm` when mounting your SMB share.
## Running with Docker Compose

View File

@ -5,7 +5,7 @@ The recommended way is to use a Helm chart.
## Root privileges
> \[!NOTE\]
> [!NOTE]
> The Trilium container at this time needs to be run with root privileges. It will swap to UID and GID `1000:1000` to run the `node` process after execution though, so the main process doesn't run with root privileges.
The Trilium docker container needs to be run with root privileges. The node process inside the container will be started with reduced privileges (uid:gid 1000:1000) after some initialization logic. Please make sure that you don't use a security context (PodSecurityContext) which changes the user ID. To use a different uid:gid for file storage and the application, please use the `USER_UID` & `USER_GID` environment variables.

View File

@ -25,10 +25,12 @@ sudo apt install libpng16-16 libpng-dev pkg-config autoconf libtool build-essent
### Download
You can either download source code zip/tar from [https://github.com/TriliumNext/Notes/releases/latest\]\]](https://github.com/TriliumNext/Notes/releases/latest%5D%5D) %%{WARNING}%%or clone git repository **from stable branch** with
You can either download source code zip/tar from [https://github.com/TriliumNext/Notes/releases/latest](https://github.com/TriliumNext/Notes/releases/latest).
For the latest version including betas, clone Git repository **from** `**master**` **branch** with:
```
git clone -b stable https://github.com/triliumnext/notes.git %%{WARNING}%%
git clone -b master https://github.com/triliumnext/notes.git
```
## Installation

View File

@ -3,9 +3,9 @@ This is essentially Trilium sources + node modules + node.js runtime packaged in
## Steps
* ssh into your server
* use `wget` (or `curl` or whatever) to download latest [trilium-linux-x64-server-\[VERSION\].xz](https://github.com/TriliumNext/Notes/releases/latest)%%{WARNING}%% (notice -server suffix) on your server
* unpack the archive, e.g. using `tar -xf -d trilium-linux-x64-server-[VERSION].tar.xz`
* SSH into your server
* use `wget` (or `curl`) to download latest `TriliumNextNotes-Server-[VERSION]-linux-x64.tar.xz` (notice `-Server` suffix) on your server.
* unpack the archive, e.g. using `tar -xf -d TriliumNextNotes-Server-[VERSION]-linux-x64.tar.xz`
* `cd trilium-linux-x64-server`
* `./trilium.sh`
* you can open the browser and open http://\[your-server-hostname\]:8080 and you should see Trilium initialization page
@ -20,7 +20,7 @@ The problem with above steps is that once you close the SSH connection, the Tril
* After downloading, extract and move Trilium:
```
tar -xvf trilium-linux-x64-server-[VERSION].tar.xz
tar -xvf TriliumNextNotes-Server-[VERSION]-linux-x64.tar.xz
sudo mv trilium-linux-x64-server /opt/trilium
```

View File

@ -24,7 +24,7 @@ If there's multiple clippings from the same page (and on the same day), then the
**Extension is available from:**
* [Project release page](https://github.com/TriliumNext/web-clipper/releases) - .xpi for Firefox and .zip for Chromium based browsers.
* %%{WARNING}%% [Chrome Web Store](https://chromewebstore.google.com/detail/trilium-web-clipper/dfhgmnfclbebfobmblelddiejjcijbjm)
* [Chrome Web Store](https://chromewebstore.google.com/detail/trilium-web-clipper/dfhgmnfclbebfobmblelddiejjcijbjm)
## Configuration

View File

@ -52,18 +52,22 @@ For each note of the calendar, the following attributes can be used:
| `#calendar:color` | Similar to `#color`, but applies the color only for the event in the calendar and not for other places such as the note tree. |
| `#iconClass` | If present, the icon of the note will be displayed to the left of the event title. |
| `#calendar:title` | Changes the title of an event to point to an attribute of the note other than the title, either a label (e.g. `#assignee`) or a relation (e.g. `~for`). See _Advanced use-cases_ for more information. |
| `#calendar:promotedAttributes` | Allows displaying the value of one or more promoted attributes in the calendar like this: ![](13_Calendar%20View_image.png) <br> <br>`<br>#label:weight="promoted,number,single,precision=1"<br>#label:mood="promoted,alias=Mood,single,text"<br>#calendar:promotedAttributes="label:weight,label:mood" <br>` <br> <br>It can also be used with relations, case in which it will display the title of the target note: <br> <br>`<br>#relation:assignee="promoted,alias=Assignee,single,text"<br>#calendar:promotedAttributes="relation:assignee" <br>~assignee=@My assignee<br>` |
| `#calendar:startDate` | Allows using a different label to represent the start date, other than `#startDate` (e.g. `#expiryDate`). The label name must be prefixed with `#`. If the label is not defined for a note, the default will be used instead. |
| `#calendar:endDate` | Allows using a different label to represent the start date, other than `#endDate`. The label name must be prefixed with `#`. If the label is not defined for a note, the default will be used instead. |
| `#calendar:displayedAttributes` | Allows displaying the value of one or more attributes in the calendar like this: <br><br>![](13_Calendar%20View_image.png)<br><br>```<br>#weight="70"<br>#Mood="Good"<br>#calendar:displayedAttributes="weight,Mood"<br>```<br><br>It can also be used with relations, case in which it will display the title of the target note:<br><br>```<br>~assignee=@My assignee<br>#calendar:displayedAttributes="assignee"<br>``` |
| `#calendar:startDate` | Allows using a different label to represent the start date, other than `startDate` (e.g. `expiryDate`). The label name **must not be** prefixed with `#`. If the label is not defined for a note, the default will be used instead. |
| `#calendar:endDate` | Allows using a different label to represent the start date, other than `endDate`. The label name **must not be** prefixed with `#`. If the label is not defined for a note, the default will be used instead. |
## How the calendar works
![](17_Calendar%20View_image.png)The calendar displays all the child notes of the book that have a `#startDate`. An `#endDate` can optionally be added.
![](17_Calendar%20View_image.png)
The calendar displays all the child notes of the book that have a `#startDate`. An `#endDate` can optionally be added.
If editing the start date and end date from the note itself is desirable, the following attributes can be added to the book note:
```
#viewType=calendar #label:startDate(inheritable)="promoted,alias=Start Date,single,date" #label:endDate(inheritable)="promoted,alias=End Date,single,date" #hidePromotedAttributes
#viewType=calendar #label:startDate(inheritable)="promoted,alias=Start Date,single,date"
#label:endDate(inheritable)="promoted,alias=End Date,single,date"
#hidePromotedAttributes
```
This will result in:

View File

@ -1,5 +1,5 @@
# Content language & Right-to-left support
![](Content%20language%20&%20Right-t.png)
![](api/images/4yHAD34xyvAl/Content%20language%20&%20Right-t.png)
A language hint can be provided for text notes. This option informs the browser or the desktop application about the language the note is written in (for example this might help with spellchecking), and it also determines whether the text is displayed from right-to-left for languages such as Arabic, Hebrew, etc.

View File

@ -9,16 +9,11 @@
1. [Server installation](Installation%20%26%20Setup/Server%20Installation.md)
2. [Mobile frontend](Installation%20%26%20Setup/Mobile%20Frontend.md) (optional)
3. [![Deploy](Attachments/home-button.svg)](https://heroku.com/deploy?template=https://github.com/feilongfl/trilium-heroku) %%{WARNING}%%
4. [PikaPods managed hosting](https://www.pikapods.com/pods?run=trilium-next)
3. [PikaPods managed hosting](https://www.pikapods.com/pods?run=trilium-next)
**Combination of server and desktop/laptop** - Install the application on both a server, for web access and data synchronization, and desktop instance(s). This allows all the data to be stored on the server and either accessed from the web browser, or the desktop application. The desktop application will sync and store the data locally so that it can be used when offline.
**Combination of server and desktop/laptop** - Install the application on both a server, for web access and data synchronisation, and desktop instance(s). This allows all the data to be stored on the server and either accessed from the web browser, or the desktop application. The desktop application will sync and store the data locally so that it can be used when offline.
1. [Server installation](Installation%20%26%20Setup/Server%20Installation.md)
2. [Mobile frontend](Installation%20%26%20Setup/Mobile%20Frontend.md) (optional)
3. [Desktop installation](Installation%20%26%20Setup/Desktop%20Installation.md)
4. [Synchronization](Installation%20%26%20Setup/Synchronization.md)
## Basic concepts
1. Understand [Note](Basic%20Concepts/Note.md)
4. [Synchronization](Installation%20%26%20Setup/Synchronization.md)

View File

@ -27,6 +27,7 @@
margin: 1.25em 0;
margin-right: 14px;
position: relative;
overflow: hidden;
}
.ck-content .admonition p:last-child {

138
package-lock.json generated
View File

@ -20,7 +20,6 @@
"@mermaid-js/layout-elk": "0.1.7",
"@mind-elixir/node-menu": "1.0.4",
"@triliumnext/express-partial-content": "1.0.1",
"@types/html-minifier": "4.0.5",
"archiver": "7.0.1",
"async-mutex": "0.5.0",
"autocomplete.js": "0.38.1",
@ -53,7 +52,6 @@
"fs-extra": "11.3.0",
"helmet": "8.0.0",
"html": "1.0.0",
"html-minifier": "4.0.0",
"html2plaintext": "2.1.4",
"http-proxy-agent": "7.0.2",
"https-proxy-agent": "7.0.6",
@ -5247,16 +5245,6 @@
"@types/node": "*"
}
},
"node_modules/@types/clean-css": {
"version": "4.2.11",
"resolved": "https://registry.npmjs.org/@types/clean-css/-/clean-css-4.2.11.tgz",
"integrity": "sha512-Y8n81lQVTAfP2TOdtJJEsCoYl1AnOkqDqMvXb9/7pfgZZ7r8YrEyurrAvAoAjHOGXKRybay+5CsExqIH6liccw==",
"license": "MIT",
"dependencies": {
"@types/node": "*",
"source-map": "^0.6.0"
}
},
"node_modules/@types/cls-hooked": {
"version": "4.3.9",
"resolved": "https://registry.npmjs.org/@types/cls-hooked/-/cls-hooked-4.3.9.tgz",
@ -5705,17 +5693,6 @@
"dev": true,
"license": "MIT"
},
"node_modules/@types/html-minifier": {
"version": "4.0.5",
"resolved": "https://registry.npmjs.org/@types/html-minifier/-/html-minifier-4.0.5.tgz",
"integrity": "sha512-LfE7f7MFd+YUfZnlBz8W43P4NgSObWiqyKapANsWCj63Aqeqli8/9gVsGP4CwC8jPpTTYlTopKCk9rJSuht/ew==",
"license": "MIT",
"dependencies": {
"@types/clean-css": "*",
"@types/relateurl": "*",
"@types/uglify-js": "*"
}
},
"node_modules/@types/http-cache-semantics": {
"version": "4.0.4",
"resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.4.tgz",
@ -5957,12 +5934,6 @@
"@types/node": "*"
}
},
"node_modules/@types/relateurl": {
"version": "0.2.33",
"resolved": "https://registry.npmjs.org/@types/relateurl/-/relateurl-0.2.33.tgz",
"integrity": "sha512-bTQCKsVbIdzLqZhLkF5fcJQreE4y1ro4DIyVrlDNSCJRRwHhB8Z+4zXXa8jN6eDvc2HbRsEYgbvrnGvi54EpSw==",
"license": "MIT"
},
"node_modules/@types/responselike": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.3.tgz",
@ -6133,15 +6104,6 @@
"dev": true,
"license": "MIT"
},
"node_modules/@types/uglify-js": {
"version": "3.17.5",
"resolved": "https://registry.npmjs.org/@types/uglify-js/-/uglify-js-3.17.5.tgz",
"integrity": "sha512-TU+fZFBTBcXj/GpDpDaBmgWk/gn96kMZ+uocaFUlV2f8a6WdMzzI44QBCmGcCiYR0Y6ZlNRiyUyKKt5nl/lbzQ==",
"license": "MIT",
"dependencies": {
"source-map": "^0.6.1"
}
},
"node_modules/@types/unist": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz",
@ -8080,16 +8042,6 @@
"node": ">=6"
}
},
"node_modules/camel-case": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/camel-case/-/camel-case-3.0.0.tgz",
"integrity": "sha512-+MbKztAYHXPr1jNTSKQF52VpcFjwY5RkR7fxksV8Doo4KAYc5Fl4UJRgthBbTmEx8C54DqahhbLJkDwjI3PI/w==",
"license": "MIT",
"dependencies": {
"no-case": "^2.2.0",
"upper-case": "^1.1.1"
}
},
"node_modules/caniuse-lite": {
"version": "1.0.30001703",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001703.tgz",
@ -8331,18 +8283,6 @@
"license": "MIT",
"optional": true
},
"node_modules/clean-css": {
"version": "4.2.4",
"resolved": "https://registry.npmjs.org/clean-css/-/clean-css-4.2.4.tgz",
"integrity": "sha512-EJUDT7nDVFDvaQgAo2G/PJvxmp1o/c6iXLbswsBbUFXi1Nr+AjA2cKmfbKDMjMvzEe75g3P6JkaDDAKk96A85A==",
"license": "MIT",
"dependencies": {
"source-map": "~0.6.0"
},
"engines": {
"node": ">= 4.0"
}
},
"node_modules/clean-stack": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz",
@ -13034,33 +12974,6 @@
"dev": true,
"license": "MIT"
},
"node_modules/html-minifier": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/html-minifier/-/html-minifier-4.0.0.tgz",
"integrity": "sha512-aoGxanpFPLg7MkIl/DDFYtb0iWz7jMFGqFhvEDZga6/4QTjneiD8I/NXL1x5aaoCp7FSIT6h/OhykDdPsbtMig==",
"license": "MIT",
"dependencies": {
"camel-case": "^3.0.0",
"clean-css": "^4.2.1",
"commander": "^2.19.0",
"he": "^1.2.0",
"param-case": "^2.1.1",
"relateurl": "^0.2.7",
"uglify-js": "^3.5.1"
},
"bin": {
"html-minifier": "cli.js"
},
"engines": {
"node": ">=6"
}
},
"node_modules/html-minifier/node_modules/commander": {
"version": "2.20.3",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
"license": "MIT"
},
"node_modules/html2plaintext": {
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/html2plaintext/-/html2plaintext-2.1.4.tgz",
@ -14803,12 +14716,6 @@
"dev": true,
"license": "MIT"
},
"node_modules/lower-case": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/lower-case/-/lower-case-1.1.4.tgz",
"integrity": "sha512-2Fgx1Ycm599x+WGpIYwJOvsjmXFzTSc34IwDWALRA/8AopUKAVPwfJ+h5+f85BCp0PWmmJcWzEpxOpoXycMpdA==",
"license": "MIT"
},
"node_modules/lowercase-keys": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz",
@ -16032,15 +15939,6 @@
"dev": true,
"license": "MIT"
},
"node_modules/no-case": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/no-case/-/no-case-2.3.2.tgz",
"integrity": "sha512-rmTZ9kz+f3rCvK2TD1Ue/oZlns7OGoIWP4fc3llxxRXlOkHKoWPPWJOfFYpITabSow43QJbRIoHQXtt10VldyQ==",
"license": "MIT",
"dependencies": {
"lower-case": "^1.1.1"
}
},
"node_modules/node-abi": {
"version": "3.71.0",
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.71.0.tgz",
@ -16671,15 +16569,6 @@
"wheel": "^1.0.0"
}
},
"node_modules/param-case": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/param-case/-/param-case-2.1.1.tgz",
"integrity": "sha512-eQE845L6ot89sk2N8liD8HAuH4ca6Vvr7VWAWwt7+kvvG5aBcPmmphQ68JsEG2qa9n1TykS2DLeMt363AAH8/w==",
"license": "MIT",
"dependencies": {
"no-case": "^2.2.0"
}
},
"node_modules/parent-module": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
@ -18227,15 +18116,6 @@
"integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==",
"license": "MIT"
},
"node_modules/relateurl": {
"version": "0.2.7",
"resolved": "https://registry.npmjs.org/relateurl/-/relateurl-0.2.7.tgz",
"integrity": "sha512-G08Dxvm4iDN3MLM0EsP62EDV9IuhXPR6blNz6Utcp7zyV3tr4HVNINt6MpaRWbxoOHT3Q7YN2P+jaHX8vUbgog==",
"license": "MIT",
"engines": {
"node": ">= 0.10"
}
},
"node_modules/repeat-string": {
"version": "1.6.1",
"resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz",
@ -20778,18 +20658,6 @@
"integrity": "sha512-UsUk3byDzKd04EyoZ7U4DOlxQaD14JUKQl6/P7wiX4FNvUfm3XL246n9W5AmqwW5RSFJ27NAuM0iLscAOYUiGQ==",
"license": "MIT"
},
"node_modules/uglify-js": {
"version": "3.19.3",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.19.3.tgz",
"integrity": "sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ==",
"license": "BSD-2-Clause",
"bin": {
"uglifyjs": "bin/uglifyjs"
},
"engines": {
"node": ">=0.8.0"
}
},
"node_modules/uid-safe": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/uid-safe/-/uid-safe-2.1.5.tgz",
@ -20994,12 +20862,6 @@
"browserslist": ">= 4.21.0"
}
},
"node_modules/upper-case": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/upper-case/-/upper-case-1.1.3.tgz",
"integrity": "sha512-WRbjgmYzgXkCV7zNVpy5YgrHgbBv126rMALQQMrmzOVC4GM2waQ9x7xtm8VU+1yF2kWyPzI9zbZ48n4vSxwfSA==",
"license": "MIT"
},
"node_modules/uri-js": {
"version": "4.4.1",
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",

View File

@ -80,7 +80,6 @@
"@mermaid-js/layout-elk": "0.1.7",
"@mind-elixir/node-menu": "1.0.4",
"@triliumnext/express-partial-content": "1.0.1",
"@types/html-minifier": "4.0.5",
"archiver": "7.0.1",
"async-mutex": "0.5.0",
"autocomplete.js": "0.38.1",
@ -113,7 +112,6 @@
"fs-extra": "11.3.0",
"helmet": "8.0.0",
"html": "1.0.0",
"html-minifier": "4.0.0",
"html2plaintext": "2.1.4",
"http-proxy-agent": "7.0.2",
"https-proxy-agent": "7.0.6",

View File

@ -9,9 +9,9 @@
"pOsGYCXsbNQG"
],
"title": "User Guide",
"notePosition": 110,
"notePosition": 10,
"prefix": null,
"isExpanded": false,
"isExpanded": true,
"type": "text",
"mime": "text/html",
"attributes": [],
@ -1481,13 +1481,6 @@
"type": "text",
"mime": "text/markdown",
"attributes": [
{
"type": "relation",
"name": "imageLink",
"value": "JXFeNgU8Xnp1",
"isInheritable": false,
"position": 10
},
{
"type": "relation",
"name": "internalLink",
@ -1516,13 +1509,6 @@
"isInheritable": false,
"position": 50
},
{
"type": "relation",
"name": "internalLink",
"value": "BFs8mudNFgCS",
"isInheritable": false,
"position": 60
},
{
"type": "label",
"name": "shareAlias",
@ -1552,7 +1538,7 @@
"title": "Basic Concepts",
"notePosition": 60,
"prefix": null,
"isExpanded": false,
"isExpanded": true,
"type": "text",
"mime": "text/html",
"attributes": [
@ -1648,13 +1634,6 @@
"isInheritable": false,
"position": 40
},
{
"type": "relation",
"name": "internalLink",
"value": "_lbSettings",
"isInheritable": false,
"position": 50
},
{
"type": "label",
"name": "iconClass",
@ -3073,7 +3052,7 @@
"title": "Import & Export",
"notePosition": 90,
"prefix": null,
"isExpanded": false,
"isExpanded": true,
"type": "text",
"mime": "text/html",
"attributes": [],
@ -5554,7 +5533,7 @@
"title": "Installation & Setup",
"notePosition": 160,
"prefix": null,
"isExpanded": false,
"isExpanded": true,
"type": "text",
"mime": "text/html",
"attributes": [
@ -5629,7 +5608,7 @@
"title": "Server Installation",
"notePosition": 20,
"prefix": null,
"isExpanded": false,
"isExpanded": true,
"type": "text",
"mime": "text/markdown",
"attributes": [
@ -5742,7 +5721,7 @@
"title": "1. Installing the server",
"notePosition": 10,
"prefix": null,
"isExpanded": false,
"isExpanded": true,
"type": "text",
"mime": "text/html",
"attributes": [],
@ -6553,6 +6532,13 @@
"value": "bx bx-question-mark",
"isInheritable": false,
"position": 40
},
{
"type": "relation",
"name": "internalLink",
"value": "wy8So3yZZlH9",
"isInheritable": false,
"position": 80
}
],
"format": "html",

View File

@ -28,8 +28,7 @@
<h2>Limitations</h2>
<p>All resources (except for images) are created as note's attachments.</p>
<p>HTML inside ENEX files is not exactly valid so some formatting maybe broken
or lost. You can report major problems into <a href="https://github.com/TriliumNext/Notes/issues">Trilium issue tracker</a>.
%%{WARNING}%%</p>
or lost. You can report major problems into <a href="https://github.com/TriliumNext/Notes/issues">Trilium issue tracker</a>.</p>
</div>
</div>
</body>

View File

@ -13,27 +13,16 @@
<h1 data-trilium-h1>FAQ</h1>
<div class="ck-content">
<h2>Mac OS support</h2>
<p>Originally, desktop builds of Trilium Notes has been available for Windows
&amp; Linux, but there has been a considerable demand for macOS build.</p>
<p>So I made one, but I underestimated the differences and specifics of Mac
platform which seems to require special handling in several places. My
lack of knowledge and frankly willingness to learn &amp; code Mac specific
functionality resulted in a current state where <a href="https://github.com/TriliumNext/Notes/issues/511">Trilium does not integrate well into the OS</a> </p>
<p>%%{WARNING}%%.</p>
<p>macOS build is from now on considered "unsupported". I will strive to
keep it fundamentally functional, but I won't work on Mac specific features
or integrations. Note that this is more of an acknowledgment of an existing
state rather than sudden change of direction.</p>
<p>Of course, PRs are welcome.</p>
<h2>Translation / localization support</h2>
<p>Trilium is currently available only in English. Translation to other languages
is not planned in the near/medium term because it brings a significant
maintenance overhead. This decision might be revisited once Trilium stabilizes
into a more mature product.</p>
<p>For Chinese, there's an unofficial fork <a href="https://github.com/Nriver/trilium-translation">here</a>.
Use at your own risk.</p>
<h2>Multi user support</h2>
<h2>macOS support</h2>
<p>Originally, Trilium Notes considered the macOS build unsupported. TriliumNext
commits to make the experience on macOS as good as possible.</p>
<p>if you find any platform-specific issues, feel free to <a href="Troubleshooting/Reporting%20issues.html">report them</a>.</p>
<h2>Translation / localisation support</h2>
<p>The original Trilium Notes application did not support multiple languages.
Since we believe that internationalisation is a core part of an application,
we have added support for it.</p>
<p>Contributions to translations are welcome.</p>
<h2>Multi-user support</h2>
<p>Common request is to allow multiple users collaborate, share notes etc.
So far I'm resisting this because of these reasons:</p>
<ul>
@ -68,10 +57,7 @@
<p>These general purpose sync apps are not suitable to sync database files
which are open and being worked on by another application. The result is
that they will corrupt the database file, resulting in data loss and this
message in the Trilium logs:</p>
<blockquote>
<p>SqliteError: database disk image is malformed</p>
</blockquote>
message in the Trilium logs:</p><pre><code class="language-text-x-trilium-auto">SqliteError: database disk image is malformed</code></pre>
<p>The only supported way to sync Trilium's data across the network is to
use a <a href="Installation%20%26%20Setup/Synchronization.html">sync/web server</a>.</p>
<h2>Why database instead of flat files?</h2>

View File

@ -63,8 +63,7 @@
noBackup=true</code></pre>
<p>You can also review the <a href="../Advanced%20Usage/Configuration%20(config.ini%20or%20e.html">configuration</a> file
to provide all <code>config.ini</code> values as environment variables instead.</p>
<p>See <a href="https://github.com/TriliumNext/Notes/blob/master/config-sample.ini">sample config</a>.
%%{WARNING}%%</p>
<p>See <a href="https://github.com/TriliumNext/Notes/blob/master/config-sample.ini">sample config</a>.</p>
</div>
</div>
</body>

View File

@ -23,12 +23,12 @@
</p>
<p><strong>Note:</strong> Trilium's Docker container requires root privileges
to operate correctly.</p>
<blockquote>
<p>[!WARNING] If you're using a SMB/CIFS share or folder as your Trilium
data directory, <a href="https://github.com/TriliumNext/Notes/issues/415#issuecomment-2344824400">you'll need</a> to
add the mount options of <code>nobrl</code> and <code>noperm</code> when mounting
your SMB share.</p>
</blockquote>
<aside class="admonition warning">
<p>If you're using a SMB/CIFS share or folder as your Trilium data directory,
<a
href="https://github.com/TriliumNext/Notes/issues/415#issuecomment-2344824400">you'll need</a>to add the mount options of <code>nobrl</code> and <code>noperm</code> when
mounting your SMB share.</p>
</aside>
<h2>Running with Docker Compose</h2>
<h3>Grab the latest docker-compose.yml:</h3><pre><code class="language-text-x-trilium-auto">wget https://raw.githubusercontent.com/TriliumNext/Notes/master/docker-compose.yml</code></pre>
<p>Optionally, edit the <code>docker-compose.yml</code> file to configure the

View File

@ -18,12 +18,11 @@
own Kubernetes deployment.</p>
<p>The recommended way is to use a Helm chart.</p>
<h2>Root privileges</h2>
<blockquote>
<p>[!NOTE]
<br>The Trilium container at this time needs to be run with root privileges.
<aside class="admonition note">
<p>The Trilium container at this time needs to be run with root privileges.
It will swap to UID and GID <code>1000:1000</code> to run the <code>node</code> process
after execution though, so the main process doesn't run with root privileges.</p>
</blockquote>
</aside>
<p>The Trilium docker container needs to be run with root privileges. The
node process inside the container will be started with reduced privileges
(uid:gid 1000:1000) after some initialization logic. Please make sure that

View File

@ -29,8 +29,8 @@
its derivatives (like Ubuntu) below:</p><pre><code class="language-text-x-trilium-auto">sudo apt install libpng16-16 libpng-dev pkg-config autoconf libtool build-essential nasm libx11-dev libxkbfile-dev</code></pre>
<h2>Installation</h2>
<h3>Download</h3>
<p>You can either download source code zip/tar from <a href="https://github.com/TriliumNext/Notes/releases/latest%5D%5D">https://github.com/TriliumNext/Notes/releases/latest]]</a> %%{WARNING}%%or
clone git repository <strong>from stable branch</strong> with</p><pre><code class="language-text-x-trilium-auto">git clone -b stable https://github.com/triliumnext/notes.git %%{WARNING}%%</code></pre>
<p>You can either download source code zip/tar from <a href="https://github.com/TriliumNext/Notes/releases/latest">https://github.com/TriliumNext/Notes/releases/latest</a>.</p>
<p>For the latest version including betas, clone Git repository <strong>from </strong><code><strong>master</strong></code><strong> branch</strong> with:</p><pre><code class="language-text-x-trilium-auto">git clone -b master https://github.com/triliumnext/notes.git</code></pre>
<h2>Installation</h2><pre><code class="language-text-x-trilium-auto">cd trilium
# download all node dependencies

View File

@ -17,12 +17,10 @@
into one 7z file.</p>
<h2>Steps</h2>
<ul>
<li>ssh into your server</li>
<li>use <code>wget</code> (or <code>curl</code> or whatever) to download latest
<a
href="https://github.com/TriliumNext/Notes/releases/latest">trilium-linux-x64-server-[VERSION].xz</a>%%{WARNING}%% (notice -server
suffix) on your server</li>
<li>unpack the archive, e.g. using <code>tar -xf -d trilium-linux-x64-server-[VERSION].tar.xz</code>
<li>SSH into your server</li>
<li>use <code>wget</code> (or <code>curl</code>) to download latest <code>TriliumNextNotes-Server-[VERSION]-linux-x64.tar.xz</code> (notice <code>-Server</code> suffix)
on your server.</li>
<li>unpack the archive, e.g. using <code>tar -xf -d TriliumNextNotes-Server-[VERSION]-linux-x64.tar.xz</code>
</li>
<li><code>cd trilium-linux-x64-server</code>
</li>
@ -41,7 +39,7 @@
<h2>Configure Trilium to auto-run on boot with systemd</h2>
<ul>
<li>After downloading, extract and move Trilium:</li>
</ul><pre><code class="language-text-x-trilium-auto">tar -xvf trilium-linux-x64-server-[VERSION].tar.xz
</ul><pre><code class="language-text-x-trilium-auto">tar -xvf TriliumNextNotes-Server-[VERSION]-linux-x64.tar.xz
sudo mv trilium-linux-x64-server /opt/trilium</code></pre>
<ul>
<li>Create the service:</li>

View File

@ -42,7 +42,7 @@
<ul>
<li><a href="https://github.com/TriliumNext/web-clipper/releases">Project release page</a> -
.xpi for Firefox and .zip for Chromium based browsers.</li>
<li>%%{WARNING}%% <a href="https://chromewebstore.google.com/detail/trilium-web-clipper/dfhgmnfclbebfobmblelddiejjcijbjm">Chrome Web Store</a>
<li><a href="https://chromewebstore.google.com/detail/trilium-web-clipper/dfhgmnfclbebfobmblelddiejjcijbjm">Chrome Web Store</a>
</li>
</ul>
<h2>Configuration</h2>

View File

@ -21,34 +21,36 @@
<p>Unlike other Book view types, the Calendar view also allows some kind
of interaction, such as moving events around as well as creating new ones.</p>
<h2>Creating a calendar</h2>
<table>
<thead>
<tr>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>
<img src="3_Calendar View_image.png" alt="">
</td>
<td>The Calendar View works only for Book note types. To create a new note,
right click on the note tree on the left and select Insert note after,
or Insert child note and then select <em>Book</em>.</td>
</tr>
<tr>
<td>2</td>
<td>
<img src="5_Calendar View_image.png" alt="">
</td>
<td>Once created, the “View type” of the Book needs changed to “Calendar”,
by selecting the “Book Properties” tab in the ribbon.</td>
</tr>
</tbody>
</table>
<figure class="table">
<table>
<thead>
<tr>
<th>&nbsp;</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>
<img src="3_Calendar View_image.png" alt="">
</td>
<td>The Calendar View works only for Book note types. To create a new note,
right click on the note tree on the left and select Insert note after,
or Insert child note and then select <em>Book</em>.</td>
</tr>
<tr>
<td>2</td>
<td>
<img src="5_Calendar View_image.png" alt="">
</td>
<td>Once created, the “View type” of the Book needs changed to “Calendar”,
by selecting the “Book Properties” tab in the ribbon.</td>
</tr>
</tbody>
</table>
</figure>
<h2>Creating a new event/note</h2>
<ul>
<li>Clicking on a day will create a new child note and assign it to that particular
@ -81,226 +83,242 @@
</ul>
<h2>Configuring the calendar</h2>
<p>The following attributes can be added to the book type:</p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>#calendar:hideWeekends</code>
</td>
<td>When present (regardless of value), it will hide Saturday and Sundays
from the calendar.</td>
</tr>
<tr>
<td><code>#calendar:weekNumbers</code>
</td>
<td>When present (regardless of value), it will show the number of the week
on the calendar.</td>
</tr>
<tr>
<td><code>~child:template</code>
</td>
<td>Defines the template for newly created notes in the calendar (via dragging
or clicking).</td>
</tr>
</tbody>
</table>
<figure class="table">
<table>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>#calendar:hideWeekends</code>
</td>
<td>When present (regardless of value), it will hide Saturday and Sundays
from the calendar.</td>
</tr>
<tr>
<td><code>#calendar:weekNumbers</code>
</td>
<td>When present (regardless of value), it will show the number of the week
on the calendar.</td>
</tr>
<tr>
<td><code>~child:template</code>
</td>
<td>Defines the template for newly created notes in the calendar (via dragging
or clicking).</td>
</tr>
</tbody>
</table>
</figure>
<p>In addition, the first day of the week can be either Sunday or Monday
and can be adjusted from the application settings.</p>
<h2>Configuring the calendar events</h2>
<p>For each note of the calendar, the following attributes can be used:</p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>#startDate</code>
</td>
<td>The date the event starts, which will display it in the calendar. The
format is <code>YYYY-MM-DD</code> (year, month and day separated by a minus
sign).</td>
</tr>
<tr>
<td><code>#endDate</code>
</td>
<td>Similar to <code>startDate</code>, mentions the end date if the event spans
across multiple days. The date is inclusive, so the end day is also considered.
The attribute can be missing for single-day events.</td>
</tr>
<tr>
<td><code>#color</code>
</td>
<td>Displays the event with a specified color (named such as <code>red</code>, <code>gray</code> or
hex such as <code>#FF0000</code>). This will also change the color of the
note in other places such as the note tree.</td>
</tr>
<tr>
<td><code>#calendar:color</code>
</td>
<td>Similar to <code>#color</code>, but applies the color only for the event
in the calendar and not for other places such as the note tree.</td>
</tr>
<tr>
<td><code>#iconClass</code>
</td>
<td>If present, the icon of the note will be displayed to the left of the
event title.</td>
</tr>
<tr>
<td><code>#calendar:title</code>
</td>
<td>Changes the title of an event to point to an attribute of the note other
than the title, either a label (e.g. <code>#assignee</code>) or a relation
(e.g. <code>~for</code>). See <em>Advanced use-cases</em> for more information.</td>
</tr>
<tr>
<td><code>#calendar:promotedAttributes</code>
</td>
<td>Allows displaying the value of one or more promoted attributes in the
calendar like this:
<img src="13_Calendar View_image.png" alt="">
<br>
<br><code>&lt;br&gt;#label:weight="promoted,number,single,precision=1"&lt;br&gt;#label:mood="promoted,alias=Mood,single,text"&lt;br&gt;#calendar:promotedAttributes="label:weight,label:mood" &lt;br&gt;</code>
<br>
<br>It can also be used with relations, case in which it will display the
title of the target note:
<br>
<br><code>&lt;br&gt;#relation:assignee="promoted,alias=Assignee,single,text"&lt;br&gt;#calendar:promotedAttributes="relation:assignee" &lt;br&gt;~assignee=@My assignee&lt;br&gt;</code>
</td>
</tr>
<tr>
<td><code>#calendar:startDate</code>
</td>
<td>Allows using a different label to represent the start date, other than <code>#startDate</code> (e.g. <code>#expiryDate</code>).
The label name must be prefixed with <code>#</code>. If the label is not
defined for a note, the default will be used instead.</td>
</tr>
<tr>
<td><code>#calendar:endDate</code>
</td>
<td>Allows using a different label to represent the start date, other than <code>#endDate</code>.
The label name must be prefixed with <code>#</code>. If the label is not
defined for a note, the default will be used instead.</td>
</tr>
</tbody>
</table>
<h2>How the calendar works</h2>
<p>
<img src="17_Calendar View_image.png" alt="">The calendar displays all the child notes of the book that have a <code>#startDate</code>.
An <code>#endDate</code> can optionally be added.</p>
<p>If editing the start date and end date from the note itself is desirable,
the following attributes can be added to the book note:</p><pre><code class="language-text-x-trilium-auto">#viewType=calendar #label:startDate(inheritable)="promoted,alias=Start Date,single,date" #label:endDate(inheritable)="promoted,alias=End Date,single,date" #hidePromotedAttributes </code></pre>
<p>This will result in:</p>
<p>
<img src="14_Calendar View_image.png" alt="">
</p>
<p>When not used in a Journal, the calendar is recursive. That is, it will
look for events not just in its child notes but also in the children of
these child notes.</p>
<h2>Use-cases</h2>
<h3>Using with the Journal / calendar</h3>
<p>It is possible to integrate the calendar view into the Journal with day
notes. In order to do so change the note type of the Journal note (calendar
root) to Book and then select the Calendar View.</p>
<p>Based on the <code>#calendarRoot</code> (or <code>#workspaceCalendarRoot</code>)
attribute, the calendar will know that it's in a calendar and apply the
following:</p>
<ul>
<li>The calendar events are now rendered based on their <code>dateNote</code> attribute
rather than <code>startDate</code>.</li>
<li>Interactive editing such as dragging over an empty era or resizing an
event is no longer possible.</li>
<li>Clicking on the empty space on a date will automatically open that day's
note or create it if it does not exist.</li>
<li>Direct children of a day note will be displayed on the calendar despite
not having a <code>dateNote</code> attribute. Children of the child notes
will not be displayed.</li>
</ul>
<p>
<img src="12_Calendar View_image.png" alt="">
</p>
<h3>Using a different attribute as event title</h3>
<p>By default, events are displayed on the calendar by their note title.
However, it is possible to configure a different attribute to be displayed
instead.</p>
<p>To do so, assign <code>#calendar:title</code> to the child note (not the
calendar/book note), with the value being <code>#name</code> where <code>name</code> can
be any label. The attribute can also come through inheritance such as a
template attribute. If the note does not have the requested label, the
title of the note will be used instead.</p>
<table>
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>
<img src="7_Calendar View_image.png" alt="">
</td>
<td>
<img src="9_Calendar View_image.png" alt="">
</td>
</tr>
</tbody>
</table>
<h3>Using a relation attribute as event title</h3>
<p>Similarly to using an attribute, use <code>#calendar:title</code> and set
it to <code>~name</code> where <code>name</code> is the name of the relation
to use.</p>
<p>Moreover, if there are more relations of the same name, they will be displayed
as multiple events coming from the same note.</p>
<table>
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>
<img src="8_Calendar View_image.png" alt="">
</td>
<td>
<img src="10_Calendar View_image.png" alt="">
</td>
</tr>
</tbody>
</table>
<p>Note that it's even possible to have a <code>#calendar:title</code> on the
target note (e.g. “John Smith”) which will try to render an attribute of
it. Note that it's not possible to use a relation here as well for safety
reasons (an accidental recursion  of attributes could cause the application
to loop infinitely).</p>
<table>
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>
<img src="15_Calendar View_image.png" alt="">
</td>
<td>
<img src="2_Calendar View_image.png" alt="">
</td>
</tr>
</tbody>
</table>
<figure
class="table">
<table>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>#startDate</code>
</td>
<td>The date the event starts, which will display it in the calendar. The
format is <code>YYYY-MM-DD</code> (year, month and day separated by a minus
sign).</td>
</tr>
<tr>
<td><code>#endDate</code>
</td>
<td>Similar to <code>startDate</code>, mentions the end date if the event spans
across multiple days. The date is inclusive, so the end day is also considered.
The attribute can be missing for single-day events.</td>
</tr>
<tr>
<td><code>#color</code>
</td>
<td>Displays the event with a specified color (named such as <code>red</code>, <code>gray</code> or
hex such as <code>#FF0000</code>). This will also change the color of the
note in other places such as the note tree.</td>
</tr>
<tr>
<td><code>#calendar:color</code>
</td>
<td>Similar to <code>#color</code>, but applies the color only for the event
in the calendar and not for other places such as the note tree.</td>
</tr>
<tr>
<td><code>#iconClass</code>
</td>
<td>If present, the icon of the note will be displayed to the left of the
event title.</td>
</tr>
<tr>
<td><code>#calendar:title</code>
</td>
<td>Changes the title of an event to point to an attribute of the note other
than the title, either a label (e.g. <code>#assignee</code>) or a relation
(e.g. <code>~for</code>). See <em>Advanced use-cases</em> for more information.</td>
</tr>
<tr>
<td><code>#calendar:displayedAttributes</code>
</td>
<td>
<p>Allows displaying the value of one or more attributes in the calendar
like this:&nbsp;</p>
<p>
<img src="13_Calendar View_image.png" alt="">
</p><pre><code class="language-text-x-trilium-auto">#weight="70"
#Mood="Good"
#calendar:displayedAttributes="weight,Mood"</code></pre>
<p>It can also be used with relations, case in which it will display the
title of the target note:</p><pre><code class="language-text-x-trilium-auto">~assignee=@My assignee
#calendar:displayedAttributes="assignee"</code></pre>
</td>
</tr>
<tr>
<td><code>#calendar:startDate</code>
</td>
<td>Allows using a different label to represent the start date, other than <code>startDate</code> (e.g. <code>expiryDate</code>).
The label name <strong>must not be</strong> prefixed with <code>#</code>.
If the label is not defined for a note, the default will be used instead.</td>
</tr>
<tr>
<td><code>#calendar:endDate</code>
</td>
<td>Allows using a different label to represent the start date, other than <code>endDate</code>.
The label name <strong>must not be</strong> prefixed with <code>#</code>.
If the label is not defined for a note, the default will be used instead.</td>
</tr>
</tbody>
</table>
</figure>
<h2>How the calendar works</h2>
<p>
<img src="17_Calendar View_image.png" alt="">
</p>
<p>The calendar displays all the child notes of the book that have a <code>#startDate</code>.
An <code>#endDate</code> can optionally be added.</p>
<p>If editing the start date and end date from the note itself is desirable,
the following attributes can be added to the book note:</p><pre><code class="language-text-x-trilium-auto">#viewType=calendar #label:startDate(inheritable)="promoted,alias=Start Date,single,date"
#label:endDate(inheritable)="promoted,alias=End Date,single,date"
#hidePromotedAttributes </code></pre>
<p>This will result in:</p>
<p>
<img src="14_Calendar View_image.png" alt="">
</p>
<p>When not used in a Journal, the calendar is recursive. That is, it will
look for events not just in its child notes but also in the children of
these child notes.</p>
<h2>Use-cases</h2>
<h3>Using with the Journal / calendar</h3>
<p>It is possible to integrate the calendar view into the Journal with day
notes. In order to do so change the note type of the Journal note (calendar
root) to Book and then select the Calendar View.</p>
<p>Based on the <code>#calendarRoot</code> (or <code>#workspaceCalendarRoot</code>)
attribute, the calendar will know that it's in a calendar and apply the
following:</p>
<ul>
<li>The calendar events are now rendered based on their <code>dateNote</code> attribute
rather than <code>startDate</code>.</li>
<li>Interactive editing such as dragging over an empty era or resizing an
event is no longer possible.</li>
<li>Clicking on the empty space on a date will automatically open that day's
note or create it if it does not exist.</li>
<li>Direct children of a day note will be displayed on the calendar despite
not having a <code>dateNote</code> attribute. Children of the child notes
will not be displayed.</li>
</ul>
<p>
<img src="12_Calendar View_image.png" alt="">
</p>
<h3>Using a different attribute as event title</h3>
<p>By default, events are displayed on the calendar by their note title.
However, it is possible to configure a different attribute to be displayed
instead.</p>
<p>To do so, assign <code>#calendar:title</code> to the child note (not the
calendar/book note), with the value being <code>#name</code> where <code>name</code> can
be any label. The attribute can also come through inheritance such as a
template attribute. If the note does not have the requested label, the
title of the note will be used instead.</p>
<figure class="table">
<table>
<thead>
<tr>
<th>&nbsp;</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<img src="7_Calendar View_image.png" alt="">
</td>
<td>
<img src="9_Calendar View_image.png" alt="">
</td>
</tr>
</tbody>
</table>
</figure>
<h3>Using a relation attribute as event title</h3>
<p>Similarly to using an attribute, use <code>#calendar:title</code> and set
it to <code>~name</code> where <code>name</code> is the name of the relation
to use.</p>
<p>Moreover, if there are more relations of the same name, they will be displayed
as multiple events coming from the same note.</p>
<figure class="table">
<table>
<thead>
<tr>
<th>&nbsp;</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<img src="8_Calendar View_image.png" alt="">
</td>
<td>
<img src="10_Calendar View_image.png" alt="">
</td>
</tr>
</tbody>
</table>
</figure>
<p>Note that it's even possible to have a <code>#calendar:title</code> on the
target note (e.g. “John Smith”) which will try to render an attribute of
it. Note that it's not possible to use a relation here as well for safety
reasons (an accidental recursion &nbsp;of attributes could cause the application
to loop infinitely).</p>
<figure class="table">
<table>
<thead>
<tr>
<th>&nbsp;</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<img src="15_Calendar View_image.png" alt="">
</td>
<td>
<img src="2_Calendar View_image.png" alt="">
</td>
</tr>
</tbody>
</table>
</figure>
</div>
</div>
</body>

View File

@ -14,7 +14,7 @@
<div class="ck-content">
<p>
<img src="api/images/ZOupAe21YiqT/Content language &amp; Right-t.png"
<img src="api/images/4yHAD34xyvAl/Content language &amp; Right-t.png"
alt="">
</p>
<p>A language hint can be provided for text notes. This option informs the

View File

@ -27,12 +27,11 @@
<li><a href="Installation%20%26%20Setup/Server%20Installation.html">Server installation</a>
</li>
<li><a href="Installation%20%26%20Setup/Mobile%20Frontend.html">Mobile frontend</a> (optional)</li>
<li><a href="https://heroku.com/deploy?template=https://github.com/feilongfl/trilium-heroku"><img src="Attachments/home-button.svg" alt="Deploy"></a>%%{WARNING}%%</li>
<li><a href="https://www.pikapods.com/pods?run=trilium-next">PikaPods managed hosting</a>
</li>
</ol>
<p><strong>Combination of server and desktop/laptop</strong> - Install the
application on both a server, for web access and data synchronization,
application on both a server, for web access and data synchronisation,
and desktop instance(s). This allows all the data to be stored on the server
and either accessed from the web browser, or the desktop application. The
desktop application will sync and store the data locally so that it can
@ -46,11 +45,6 @@
<li><a href="Installation%20%26%20Setup/Synchronization.html">Synchronization</a>
</li>
</ol>
<h2>Basic concepts</h2>
<ol>
<li>Understand <a href="Basic%20Concepts/Note.html">Note</a>
</li>
</ol>
</div>
</div>
</body>

View File

@ -17,6 +17,32 @@
margin: 0 !important;
}
.ck-content .admonition {
--accent-color: var(--card-border-color);
border: 1px solid var(--accent-color);
box-shadow: var(--card-box-shadow);
background: var(--card-background-color);
border-radius: 0.5em;
padding: 1em;
margin: 1.25em 0;
margin-right: 14px;
position: relative;
}
.ck-content .admonition p:last-child {
margin-bottom: 0;
}
.ck-content .admonition p, h2 {
margin-top: 0;
}
.ck-content .admonition.note { --accent-color: #69c7ff; }
.ck-content .admonition.tip { --accent-color: #40c025; }
.ck-content .admonition.important { --accent-color: #9839f7; }
.ck-content .admonition.caution { --accent-color: #ff2e2e; }
.ck-content .admonition.warning { --accent-color: #e2aa03; }
/*
* CKEditor 5 (v41.0.0) content styles.
* Generated on Fri, 26 Jan 2024 10:23:49 GMT.

View File

@ -6,15 +6,15 @@ import appContext from "../components/app_context.js";
import { t } from "./i18n.js";
interface UploadFilesOptions {
safeImport: boolean;
shrinkImages: boolean;
textImportedAsText: boolean;
codeImportedAsCode: boolean;
explodeArchives: boolean;
replaceUnderscoresWithSpaces: boolean;
safeImport?: boolean;
shrinkImages: boolean | "true" | "false";
textImportedAsText?: boolean;
codeImportedAsCode?: boolean;
explodeArchives?: boolean;
replaceUnderscoresWithSpaces?: boolean;
}
export async function uploadFiles(entityType: string, parentNoteId: string, files: string[], options: UploadFilesOptions) {
export async function uploadFiles(entityType: string, parentNoteId: string, files: string[] | File[], options: UploadFilesOptions) {
if (!["notes", "attachments"].includes(entityType)) {
throw new Error(`Unrecognized import entity type '${entityType}'.`);
}

View File

@ -117,7 +117,7 @@ export const MIME_TYPES_DICT: readonly MimeTypeDefinition[] = Object.freeze([
{ title: "PEG.js", mime: "null" },
{ title: "Perl", mime: "text/x-perl", default: true },
{ title: "PGP", mime: "application/pgp" },
{ title: "PHP", mime: "text/x-php", default: true },
{ title: "PHP", mime: "text/x-php", default: true, highlightJs: "php" },
{ title: "Pig", mime: "text/x-pig" },
{ title: "PLSQL", mime: "text/x-plsql", highlightJs: "sql" },
{ title: "PostgreSQL", mime: "text/x-pgsql", highlightJs: "pgsql" },
@ -135,7 +135,7 @@ export const MIME_TYPES_DICT: readonly MimeTypeDefinition[] = Object.freeze([
{ title: "Ruby", mime: "text/x-ruby", highlightJs: "ruby", default: true },
{ title: "Rust", mime: "text/x-rustsrc", highlightJs: "rust" },
{ title: "SAS", mime: "text/x-sas", highlightJs: "sas" },
{ title: "Sass", mime: "text/x-sass" },
{ title: "Sass", mime: "text/x-sass", highlightJs: "scss" },
{ title: "Scala", mime: "text/x-scala" },
{ title: "Scheme", mime: "text/x-scheme" },
{ title: "SCSS", mime: "text/x-scss", highlightJs: "scss" },
@ -169,7 +169,7 @@ export const MIME_TYPES_DICT: readonly MimeTypeDefinition[] = Object.freeze([
{ title: "TTCN", mime: "text/x-ttcn" },
{ title: "Turtle", mime: "text/turtle" },
{ title: "Twig", mime: "text/x-twig", highlightJs: "twig" },
{ title: "TypeScript-JSX", mime: "text/typescript-jsx" },
{ title: "TypeScript-JSX", mime: "text/typescript-jsx", highlightJs: "typescript" },
{ title: "TypeScript", mime: "application/typescript", highlightJs: "typescript" },
{ title: "VB.NET", mime: "text/x-vb", highlightJs: "vbnet" },
{ title: "VBScript", mime: "text/vbscript", highlightJs: "vbscript" },

View File

@ -27,14 +27,19 @@ const TPL = `
</div>`;
export default class ProtectedSessionPasswordDialog extends BasicWidget {
private modal!: bootstrap.Modal;
private $passwordForm!: JQuery<HTMLElement>;
private $passwordInput!: JQuery<HTMLElement>;
doRender() {
this.$widget = $(TPL);
this.modal = Modal.getOrCreateInstance(this.$widget);
this.modal = Modal.getOrCreateInstance(this.$widget[0]);
this.$passwordForm = this.$widget.find(".protected-session-password-form");
this.$passwordInput = this.$widget.find(".protected-session-password");
this.$passwordForm.on("submit", () => {
const password = this.$passwordInput.val();
const password = String(this.$passwordInput.val());
this.$passwordInput.val("");
protectedSessionService.setupProtectedSession(password);

View File

@ -1,6 +1,6 @@
import { formatDateTime } from "../../utils/formatters.js";
import { t } from "../../services/i18n.js";
import appContext from "../../components/app_context.js";
import appContext, { type EventData } from "../../components/app_context.js";
import BasicWidget from "../basic_widget.js";
import dialogService from "../../services/dialog.js";
import froca from "../../services/froca.js";
@ -28,10 +28,23 @@ const TPL = `
</div>
</div>`;
// TODO: Deduplicate with server.
interface RecentChangesRow {
noteId: string;
date: string;
}
export default class RecentChangesDialog extends BasicWidget {
private ancestorNoteId?: string;
private modal!: bootstrap.Modal;
private $content!: JQuery<HTMLElement>;
private $eraseDeletedNotesNow!: JQuery<HTMLElement>;
doRender() {
this.$widget = $(TPL);
this.modal = Modal.getOrCreateInstance(this.$widget);
this.modal = Modal.getOrCreateInstance(this.$widget[0]);
this.$content = this.$widget.find(".recent-changes-content");
this.$eraseDeletedNotesNow = this.$widget.find(".erase-deleted-notes-now-button");
@ -44,7 +57,7 @@ export default class RecentChangesDialog extends BasicWidget {
});
}
async showRecentChangesEvent({ ancestorNoteId }) {
async showRecentChangesEvent({ ancestorNoteId }: EventData<"showRecentChanges">) {
this.ancestorNoteId = ancestorNoteId;
await this.refresh();
@ -57,7 +70,7 @@ export default class RecentChangesDialog extends BasicWidget {
this.ancestorNoteId = hoistedNoteService.getHoistedNoteId();
}
const recentChangesRows = await server.get(`recent-changes/${this.ancestorNoteId}`);
const recentChangesRows = await server.get<RecentChangesRow[]>(`recent-changes/${this.ancestorNoteId}`);
// preload all notes into cache
await froca.getNotes(
@ -110,7 +123,7 @@ export default class RecentChangesDialog extends BasicWidget {
}
} else {
const note = await froca.getNote(change.noteId);
const notePath = note.getBestNotePathString();
const notePath = note?.getBestNotePathString();
if (notePath) {
$noteLink = await linkService.createLink(notePath, {
@ -118,7 +131,7 @@ export default class RecentChangesDialog extends BasicWidget {
showNotePath: true
});
} else {
$noteLink = $("<span>").text(note.title);
$noteLink = $("<span>").text(note?.title ?? "");
}
}
@ -131,9 +144,7 @@ export default class RecentChangesDialog extends BasicWidget {
appContext.tabManager.getActiveContext().setNote(change.noteId);
}
})
.addClass(() => {
if (change.current_isDeleted) return "deleted-note";
})
.toggleClass("deleted-note", !!change.current_isDeleted)
.append($("<span>").text(formattedTime).attr("title", change.date))
.append($noteLink.addClass("note-title"))
);
@ -143,7 +154,7 @@ export default class RecentChangesDialog extends BasicWidget {
}
}
groupByDate(rows) {
groupByDate(rows: RecentChangesRow[]) {
const groupedByDate = new Map();
for (const row of rows) {

View File

@ -1,3 +1,4 @@
import type { EventData } from "../../components/app_context.js";
import { t } from "../../services/i18n.js";
import server from "../../services/server.js";
import utils from "../../services/utils.js";
@ -79,6 +80,10 @@ const TPL = `<div class="sort-child-notes-dialog modal mx-auto" tabindex="-1" ro
</div>`;
export default class SortChildNotesDialog extends BasicWidget {
private parentNoteId?: string;
private $form!: JQuery<HTMLElement>;
doRender() {
this.$widget = $(TPL);
this.$form = this.$widget.find(".sort-child-notes-form");
@ -96,7 +101,7 @@ export default class SortChildNotesDialog extends BasicWidget {
});
}
async sortChildNotesEvent({ node }) {
async sortChildNotesEvent({ node }: EventData<"sortChildNotes">) {
this.parentNoteId = node.data.noteId;
utils.openDialog(this.$widget);

View File

@ -5,6 +5,7 @@ import importService from "../../services/import.js";
import options from "../../services/options.js";
import BasicWidget from "../basic_widget.js";
import { Modal, Tooltip } from "bootstrap";
import type { EventData } from "../../components/app_context.js";
const TPL = `
<div class="upload-attachments-dialog modal fade mx-auto" tabindex="-1" role="dialog">
@ -42,6 +43,15 @@ const TPL = `
</div>`;
export default class UploadAttachmentsDialog extends BasicWidget {
private parentNoteId: string | null;
private modal!: bootstrap.Modal;
private $form!: JQuery<HTMLElement>;
private $noteTitle!: JQuery<HTMLElement>;
private $fileUploadInput!: JQuery<HTMLInputElement>;
private $uploadButton!: JQuery<HTMLElement>;
private $shrinkImagesCheckbox!: JQuery<HTMLElement>;
constructor() {
super();
@ -50,7 +60,7 @@ export default class UploadAttachmentsDialog extends BasicWidget {
doRender() {
this.$widget = $(TPL);
this.modal = Modal.getOrCreateInstance(this.$widget);
this.modal = Modal.getOrCreateInstance(this.$widget[0]);
this.$form = this.$widget.find(".upload-attachment-form");
this.$noteTitle = this.$widget.find(".upload-attachment-note-title");
@ -61,7 +71,9 @@ export default class UploadAttachmentsDialog extends BasicWidget {
this.$form.on("submit", () => {
// disabling so that import is not triggered again.
this.$uploadButton.attr("disabled", "disabled");
this.uploadAttachments(this.parentNoteId);
if (this.parentNoteId) {
this.uploadAttachments(this.parentNoteId);
}
return false;
});
@ -73,12 +85,12 @@ export default class UploadAttachmentsDialog extends BasicWidget {
}
});
Tooltip.getOrCreateInstance(this.$widget.find('[data-bs-toggle="tooltip"]'), {
Tooltip.getOrCreateInstance(this.$widget.find('[data-bs-toggle="tooltip"]')[0], {
html: true
});
}
async showUploadAttachmentsDialogEvent({ noteId }) {
async showUploadAttachmentsDialogEvent({ noteId }: EventData<"showUploadAttachmentsDialog">) {
this.parentNoteId = noteId;
this.$fileUploadInput.val("").trigger("change"); // to trigger upload button disabling listener below
@ -89,10 +101,12 @@ export default class UploadAttachmentsDialog extends BasicWidget {
utils.openDialog(this.$widget);
}
async uploadAttachments(parentNoteId) {
const files = Array.from(this.$fileUploadInput[0].files); // shallow copy since we're resetting the upload button below
async uploadAttachments(parentNoteId: string) {
const files = Array.from(this.$fileUploadInput[0].files ?? []); // shallow copy since we're resetting the upload button below
const boolToString = ($el) => ($el.is(":checked") ? "true" : "false");
function boolToString($el: JQuery<HTMLElement>): "true" | "false" {
return ($el.is(":checked") ? "true" : "false");
}
const options = {
shrinkImages: boolToString(this.$shrinkImagesCheckbox)

View File

@ -39,8 +39,8 @@ describe("Building events", () => {
it("supports custom start date", async () => {
const noteIds = buildNotes([
{ title: "Note 1", "#myStartDate": "2025-05-05", "#calendar:startDate": "#myStartDate" },
{ title: "Note 2", "#startDate": "2025-05-07", "#calendar:startDate": "#myStartDate" },
{ title: "Note 1", "#myStartDate": "2025-05-05", "#calendar:startDate": "myStartDate" },
{ title: "Note 2", "#startDate": "2025-05-07", "#calendar:startDate": "myStartDate" },
]);
const events = await CalendarView.buildEvents(noteIds);
@ -59,10 +59,10 @@ describe("Building events", () => {
it("supports custom start date and end date", async () => {
const noteIds = buildNotes([
{ title: "Note 1", "#myStartDate": "2025-05-05", "#myEndDate": "2025-05-05", "#calendar:startDate": "#myStartDate", "#calendar:endDate": "#myEndDate" },
{ title: "Note 2", "#myStartDate": "2025-05-07", "#endDate": "2025-05-08", "#calendar:startDate": "#myStartDate", "#calendar:endDate": "#myEndDate" },
{ title: "Note 3", "#startDate": "2025-05-05", "#myEndDate": "2025-05-05", "#calendar:startDate": "#myStartDate", "#calendar:endDate": "#myEndDate" },
{ title: "Note 4", "#startDate": "2025-05-07", "#myEndDate": "2025-05-08", "#calendar:startDate": "#myStartDate", "#calendar:endDate": "#myEndDate" },
{ title: "Note 1", "#myStartDate": "2025-05-05", "#myEndDate": "2025-05-05", "#calendar:startDate": "myStartDate", "#calendar:endDate": "myEndDate" },
{ title: "Note 2", "#myStartDate": "2025-05-07", "#endDate": "2025-05-08", "#calendar:startDate": "myStartDate", "#calendar:endDate": "myEndDate" },
{ title: "Note 3", "#startDate": "2025-05-05", "#myEndDate": "2025-05-05", "#calendar:startDate": "myStartDate", "#calendar:endDate": "myEndDate" },
{ title: "Note 4", "#startDate": "2025-05-07", "#myEndDate": "2025-05-08", "#calendar:startDate": "myStartDate", "#calendar:endDate": "myEndDate" },
]);
const events = await CalendarView.buildEvents(noteIds);
@ -75,8 +75,8 @@ describe("Building events", () => {
it("supports label as custom title", async () => {
const noteIds = buildNotes([
{ title: "Note 1", "#myTitle": "My Custom Title 1", "#startDate": "2025-05-05", "#calendar:title": "#myTitle" },
{ title: "Note 2", "#startDate": "2025-05-07", "#calendar:title": "#myTitle" },
{ title: "Note 1", "#myTitle": "My Custom Title 1", "#startDate": "2025-05-05", "#calendar:title": "myTitle" },
{ title: "Note 2", "#startDate": "2025-05-07", "#calendar:title": "myTitle" },
]);
const events = await CalendarView.buildEvents(noteIds);
@ -88,8 +88,8 @@ describe("Building events", () => {
it("supports relation as custom title", async () => {
const noteIds = buildNotes([
{ id: "mySharedTitle", title: "My shared title" },
{ title: "Note 1", "~myTitle": "mySharedTitle", "#startDate": "2025-05-05", "#calendar:title": "~myTitle" },
{ title: "Note 2", "#startDate": "2025-05-07", "#calendar:title": "~myTitle" },
{ title: "Note 1", "~myTitle": "mySharedTitle", "#startDate": "2025-05-05", "#calendar:title": "myTitle" },
{ title: "Note 2", "#startDate": "2025-05-07", "#calendar:title": "myTitle" },
]);
const events = await CalendarView.buildEvents(noteIds);
@ -100,23 +100,9 @@ describe("Building events", () => {
it("supports relation as custom title with custom label", async () => {
const noteIds = buildNotes([
{ id: "mySharedTitle", title: "My custom title", "#myTitle": "My shared custom title", "#calendar:title": "#myTitle" },
{ title: "Note 1", "~myTitle": "mySharedTitle", "#startDate": "2025-05-05", "#calendar:title": "~myTitle" },
{ title: "Note 2", "#startDate": "2025-05-07", "#calendar:title": "~myTitle" },
]);
const events = await CalendarView.buildEvents(noteIds);
expect(events).toHaveLength(2);
expect(events[0]).toMatchObject({ title: "My shared custom title", start: "2025-05-05" });
expect(events[1]).toMatchObject({ title: "Note 2", start: "2025-05-07" });
});
it("discards relation as custom title with custom relation", async () => {
const noteIds = buildNotes([
{ id: "myParentNote", title: "My parent note" },
{ id: "mySharedTitle", title: "My custom title", "~myTitle": "myParentNote", "#calendar:title": "~myTitle" },
{ title: "Note 1", "~myTitle": "mySharedTitle", "#startDate": "2025-05-05", "#calendar:title": "~myTitle" },
{ title: "Note 2", "#startDate": "2025-05-07", "#calendar:title": "~myTitle" },
{ id: "mySharedTitle", title: "My custom title", "#myTitle": "My shared custom title", "#calendar:title": "myTitle" },
{ title: "Note 1", "~myTitle": "mySharedTitle", "#startDate": "2025-05-05", "#calendar:title": "myTitle" },
{ title: "Note 2", "#startDate": "2025-05-07", "#calendar:title": "myTitle" },
]);
const events = await CalendarView.buildEvents(noteIds);
@ -135,15 +121,15 @@ describe("Promoted attributes", () => {
"#mood": "happy",
"#label:weight": "promoted,number,single,precision=1",
"#label:mood": "promoted,alias=Mood,single,text",
"#calendar:promotedAttributes": "label:weight,label:mood"
"#calendar:displayedAttributes": "weight,mood"
});
const event = await CalendarView.buildEvent(note, "2025-04-04");
expect(event).toHaveLength(1);
expect(event[0]?.promotedAttributes).toMatchObject({
weight: "75",
Mood: "happy"
})
expect(event[0]?.promotedAttributes).toMatchObject([
[ "weight", "75" ],
[ "mood", "happy" ]
]);
});
it("supports relations", async () => {
@ -152,14 +138,14 @@ describe("Promoted attributes", () => {
"~assignee": buildNote({
"title": "Target note"
}).noteId,
"#calendar:promotedAttributes": "relation:assignee",
"#calendar:displayedAttributes": "assignee",
"#relation:assignee": "promoted,alias=Assignee,single,text",
});
const event = await CalendarView.buildEvent(note, "2025-04-04");
expect(event).toHaveLength(1);
expect(event[0]?.promotedAttributes).toMatchObject({
"Assignee": "Target note"
})
expect(event[0]?.promotedAttributes).toMatchObject([
[ "assignee", "Target note" ]
])
});
});

View File

@ -1733,6 +1733,7 @@ footer.file-footer button {
margin-right: 14px;
position: relative;
padding-left: 2.5em;
overflow: hidden;
}
.ck-content .admonition p:last-child {

View File

@ -272,7 +272,7 @@ describe("data_dir.ts unit tests", async () => {
});
describe("#getDataDirs()", () => {
const envKeys: Omit<keyof ReturnType<typeof getDataDirs>, "TRILIUM_DATA_DIR">[] = ["DOCUMENT_PATH", "BACKUP_DIR", "LOG_DIR", "ANONYMIZED_DB_DIR", "CONFIG_INI_PATH"];
const envKeys: Omit<keyof ReturnType<typeof getDataDirs>, "TRILIUM_DATA_DIR">[] = ["DOCUMENT_PATH", "BACKUP_DIR", "LOG_DIR", "ANONYMIZED_DB_DIR", "CONFIG_INI_PATH", "TMP_DIR"];
const setMockedEnv = (prefix: string | null) => {
envKeys.forEach((key) => {

View File

@ -40,12 +40,7 @@ describe("markdown", () => {
# another one
Hello, world
`, "title");
expect(result).toBe(trimIndentation`\
<h2>Hello</h2>
<h2>world</h2>
<h2>another one</h2>
<p>Hello, world</p>
`);
expect(result).toBe(`<h2>Hello</h2><h2>world</h2><h2>another one</h2><p>Hello, world</p>`);
});
@ -54,7 +49,7 @@ describe("markdown", () => {
# What's new
Hi there
`, "What's new")
expect(result).toBe(`\n<p>Hi there</p>\n`);
expect(result).toBe(`<p>Hi there</p>`);
});
it("trims unnecessary whitespace", () => {
@ -67,10 +62,16 @@ Title
code block 1
second line 2
\`\`\`
* Hello
* world
1. Hello
2. World
`;
const expected = `\
<h2>Heading 1</h2><p>Title</p><pre><code class="language-text-x-trilium-auto">code block 1
second line 2</code></pre>`;
second line 2</code></pre><ul><li>Hello</li><li>world</li></ul><ol><li>Hello</li><li>World</li></ol>`;
expect(markdownService.renderToHtml(input, "Troubleshooting")).toBe(expected);
});
@ -98,7 +99,7 @@ second line 2</code></pre>`;
After`;
const expected = `<p>Before</p><aside class="admonition note"><p>This is a note.</p></aside><aside class="admonition tip"><p>This is a tip.</p></aside><aside class="admonition important"><p>This is a very important information.</p></aside><aside class="admonition caution"><p>This is a caution.</p></aside><aside class="admonition warning"><h2>Title goes here</h2><p>This is a warning.</p></aside><p>After</p>`;
expect(markdownService.renderToHtml(input, "Title")).toBe(expected);
expect(markdownService.renderToHtml(input, "Title")).toStrictEqual(expected);
});
});

View File

@ -1,36 +1,61 @@
"use strict";
import { parse, Renderer, type Tokens } from "marked";
import { minify as minifyHtml } from "html-minifier";
// Keep renderer code up to date with https://github.com/markedjs/marked/blob/master/src/Renderer.ts.
const renderer = new Renderer({ async: false });
renderer.code = ({ text, lang, escaped }: Tokens.Code) => {
if (!text) {
return "";
/**
* Keep renderer code up to date with https://github.com/markedjs/marked/blob/master/src/Renderer.ts.
*/
class CustomMarkdownRenderer extends Renderer {
heading(data: Tokens.Heading): string {
return super.heading(data).trimEnd();
}
const ckEditorLanguage = getNormalizedMimeFromMarkdownLanguage(lang);
return `<pre><code class="language-${ckEditorLanguage}">${text}</code></pre>`;
};
renderer.blockquote = ({ tokens }: Tokens.Blockquote) => {
const body = renderer.parser.parse(tokens);
paragraph(data: Tokens.Paragraph): string {
return super.paragraph(data).trimEnd();
}
const admonitionMatch = /^<p>\[\!([A-Z]+)\]/.exec(body);
if (Array.isArray(admonitionMatch) && admonitionMatch.length === 2) {
const type = admonitionMatch[1].toLowerCase();
if (ADMONITION_TYPE_MAPPINGS[type]) {
const bodyWithoutHeader = body
.replace(/^<p>\[\!([A-Z]+)\]/, "<p>")
.replace(/^<p><\/p>/, ""); // Having a heading will generate an empty paragraph that we need to remove.
return `<aside class="admonition ${type}">\n${bodyWithoutHeader}</aside>\n`;
code({ text, lang }: Tokens.Code): string {
if (!text) {
return "";
}
const ckEditorLanguage = getNormalizedMimeFromMarkdownLanguage(lang);
return `<pre><code class="language-${ckEditorLanguage}">${text}</code></pre>`;
}
return `<blockquote>\n${body}</blockquote>\n`;
};
list(token: Tokens.List): string {
return super.list(token)
.replace("\n", "") // we replace the first one only.
.trimEnd();
}
listitem(item: Tokens.ListItem): string {
return super.listitem(item).trimEnd();
}
blockquote({ tokens }: Tokens.Blockquote): string {
const body = renderer.parser.parse(tokens);
const admonitionMatch = /^<p>\[\!([A-Z]+)\]/.exec(body);
if (Array.isArray(admonitionMatch) && admonitionMatch.length === 2) {
const type = admonitionMatch[1].toLowerCase();
if (ADMONITION_TYPE_MAPPINGS[type]) {
const bodyWithoutHeader = body
.replace(/^<p>\[\!([A-Z]+)\]\s*/, "<p>")
.replace(/^<p><\/p>/, ""); // Having a heading will generate an empty paragraph that we need to remove.
return `<aside class="admonition ${type}">${bodyWithoutHeader.trim()}</aside>`;
}
}
return `<blockquote>${body}</blockquote>`;
}
}
const renderer = new CustomMarkdownRenderer({ async: false });
import htmlSanitizer from "../html_sanitizer.js";
import importUtils from "./utils.js";
@ -46,9 +71,6 @@ function renderToHtml(content: string, title: string) {
// h1 handling needs to come before sanitization
html = importUtils.handleH1(html, title);
html = htmlSanitizer.sanitize(html);
html = minifyHtml(html, {
collapseWhitespace: true
});
return html;
}

View File

@ -87,7 +87,7 @@ describe("processNoteContent", () => {
it("supports markdown note with UTF-16", async () => {
const { importedNote } = await testImport("UTF-16LE Text Note.md", "text/markdown");
expect(importedNote.mime).toBe("text/html");
expect(importedNote.getContent().toString()).toBe("<h2>Hello world</h2>\n<p>Plain text goes here.</p>\n");
expect(importedNote.getContent().toString()).toBe("<h2>Hello world</h2><p>Plain text goes here.</p>");
});
it("supports excalidraw note", async () => {

View File

@ -13,9 +13,9 @@ export function getHelpHiddenSubtreeData() {
const appDir = path.join(srcRoot, "public", isDev ? "app" : "app-dist");
const helpDir = path.join(appDir, "doc_notes", "en", "User Guide");
const metaFilePath = path.join(helpDir, "!!!meta.json");
const metaFileContent = JSON.parse(fs.readFileSync(metaFilePath).toString("utf-8"));
try {
const metaFileContent = JSON.parse(fs.readFileSync(metaFilePath).toString("utf-8"));
return parseNoteMetaFile(metaFileContent as NoteMetaFile);
} catch (e) {
console.warn(e);

View File

@ -27,6 +27,7 @@ describe("Share API test", () => {
it("requests password for password-protected share", async () => {
await supertest(app)
.get("/share/YjlPRj2E9fOV")
.expect(401)
.expect("WWW-Authenticate", 'Basic realm="User Visible Realm", charset="UTF-8"');
expect(cannotSetHeadersCount).toBe(0);
});

View File

@ -131,6 +131,7 @@ function renderImageAttachment(image: SNote, res: Response, attachmentName: stri
function register(router: Router) {
function renderNote(note: SNote, req: Request, res: Response) {
if (!note) {
console.log("Unable to find note ", note);
res.status(404).render("share/404");
return;
}