Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,11 @@ npm install
npm run server:start
```

For more details, see the [development docs](https://github.com/TriliumNext/Notes/blob/develop/docs/Developer%20Guide/Developer%20Guide/Building%20and%20deployment/Running%20a%20development%20build.md).

### Documentation

We are currently transitioning to a new documentation mechanism.
Meanwhile you can still view the [archived Docs repository](https://github.com/TriliumNext/Docs).
See the [documentation guide](https://github.com/TriliumNext/Notes/blob/develop/docs/Developer%20Guide/Developer%20Guide/Documentation.md) for details.

## 👏 Shoutouts

Expand Down
7 changes: 0 additions & 7 deletions data-docs/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,6 @@ trustedReverseProxy=false


[Session]
# Use this setting to set a custom value for the "Path" Attribute value of the session cookie.
# This can be useful, when you have several instances running on the same domain, under different paths (e.g. by using a reverse proxy).
# It prevents your instances from overwriting each others' cookies, allowing you to stay logged in multiple instances simultanteously.
# E.g. if you have instances running under https://your-domain.com/triliumNext/instanceA and https://your-domain.com/triliumNext/instanceB
# you would want to set the cookiePath value to "/triliumNext/instanceA" for your first and "/triliumNext/instanceB" for your second instance
cookiePath=/

# Use this setting to set a custom value for the "Max-Age" Attribute of the session cookie.
# This controls how long your session will be valid, before it expires and you need to log in again, when you use the "Remember Me" option.
# Value needs to be entered in Seconds.
Expand Down
35 changes: 22 additions & 13 deletions docs/Developer Guide/!!!meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -2018,10 +2018,10 @@
},
{
"isClone": false,
"noteId": "LjqM0VUL1CrU",
"noteId": "Sow7ThJozkzJ",
"notePath": [
"jdjRLhLV3TtI",
"LjqM0VUL1CrU"
"Sow7ThJozkzJ"
],
"title": "Documentation",
"notePosition": 90,
Expand All @@ -2032,26 +2032,35 @@
"attributes": [],
"format": "markdown",
"dataFileName": "Documentation.md",
"attachments": [],
"attachments": [
{
"attachmentId": "2bUrJyt2yfsd",
"title": "image.png",
"role": "image",
"mime": "image/png",
"position": 10,
"dataFileName": "Documentation_image.png"
}
],
"dirFileName": "Documentation",
"children": [
{
"isClone": false,
"noteId": "HptkyArOlRI5",
"noteId": "LjqM0VUL1CrU",
"notePath": [
"jdjRLhLV3TtI",
"LjqM0VUL1CrU",
"HptkyArOlRI5"
"Sow7ThJozkzJ",
"LjqM0VUL1CrU"
],
"title": "User-facing documentation",
"title": "Documentation references in the application",
"notePosition": 10,
"prefix": null,
"isExpanded": false,
"type": "text",
"mime": "text/html",
"attributes": [],
"format": "markdown",
"dataFileName": "User-facing documentation.md",
"dataFileName": "Documentation references in th.md",
"attachments": []
}
]
Expand All @@ -2064,7 +2073,7 @@
"dtKC3FmoWOrv"
],
"title": "Testing",
"notePosition": 100,
"notePosition": 110,
"prefix": null,
"isExpanded": false,
"type": "text",
Expand Down Expand Up @@ -2183,7 +2192,7 @@
"dHfw0XZE515z"
],
"title": "Sub-projects",
"notePosition": 110,
"notePosition": 120,
"prefix": null,
"isExpanded": false,
"type": "text",
Expand Down Expand Up @@ -2486,7 +2495,7 @@
"ibAPHul7Efvr"
],
"title": "Notes for old development",
"notePosition": 120,
"notePosition": 130,
"prefix": null,
"isExpanded": false,
"type": "text",
Expand Down Expand Up @@ -2551,7 +2560,7 @@
"QRLbiDXNxoWN"
],
"title": "Troubleshooting",
"notePosition": 130,
"notePosition": 140,
"prefix": null,
"isExpanded": false,
"type": "text",
Expand Down Expand Up @@ -2590,7 +2599,7 @@
"x6lgrdztQwVB"
],
"title": "Installation",
"notePosition": 140,
"notePosition": 150,
"prefix": null,
"isExpanded": false,
"type": "text",
Expand Down
76 changes: 63 additions & 13 deletions docs/Developer Guide/Developer Guide/Documentation.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,73 @@
# Documentation
## Hard-coded links
<figure class="image image-style-align-right"><img style="aspect-ratio:205/162;" src="Documentation_image.png" width="205" height="162"></figure>

Hard-coded links are present throughout the application, either in dialogs or in the source code as comments.
There are multiple types of documentation for Trilium:

You can identify these links by searching for:
* The _User Guide_ represents the user-facing documentation. This documentation can be browsed by users directly from within Trilium, by pressing <kbd>F1</kbd>.
* The _Developer's Guide_ represents a set of Markdown documents that present the internals of Trilium, for developers.
* _Release Notes_, this contains the change log for each released or soon-to-be-released version. The release notes are used automatically by the CI when releasing a version.
* The _Script API_, which is an automatically generated documentation for the front-end and back-end APIs for scripts.

```
https://triliumnext.github.io/Docs/Wiki/
```
## Editing documentation

## Help buttons
There are two ways to modify documentation:

There is a pattern of “?” buttons throughout the application which make use of the `data-help-page` attribute. Whenever these buttons are pressed, the user is redirected to the corresponding wiki page by prepending the wiki root URL to the `data-help-page` attribute.
* Using a special mode of Trilium.
* By manually editing the files.

Since the current wiki has a different structure than the original, for example to link to [https://github.com/TriliumNext/Docs/blob/main/Wiki/tree-concepts.md](https://github.com/TriliumNext/Docs/blob/main/Wiki/tree-concepts.md) the `data-help-page` attribute must be set to `tree-concepts.md`.
### Using `docs:edit`

For links to headings, simply add the heading after the `.md`: `tree-concepts.md#prefix`
To edit the documentation using Trilium, set up a working development environment and run the following commands:

You can identify those by looking for:
* On most operating systems, `npm run electron:switch` followed by `npm run docs:edit`
* On NixOS, `npm run docs:edit-nix`.

* `.attr("data-help-page"`
* `data-help-page="`
> [!NOTE]
> `npm run docs:edit` acts very similar to `npm run electron:start` in the sense that you cannot both be editing documentation and starting a server. Using both `npm run electron:start` and `docs:edit` is possible, since they are using the same Electron instance.

How it works:

* At startup, the documentation from `docs/` is imported from Markdown into a in-memory session (the initialization of the database is already handled by the application).
* Each modification will trigger after 10s an export from the in-memory Trilium session back to Markdown, including the meta file.

### Manual editing

Apart from the User Guide, it's generally feasible to make small modifications directly using a Markdown editor or VS Code, for example.

When making manual modifications, avoid:

* Uploading pictures, since images are handled as Trilium attachments which are stored in the meta file.
* Changing the file or directory structure in any way, since that is also handled by the meta file. A missing file will most certainly cause a crash at start-up when attempting to edit the docs using Trilium.

### Reviewing & committing the changes

Since the documentation is tracked with Git, after making the manual or automatic modifications (wait at least 10s after making the modification) the changes will reflect in Git.

Make sure to analyze each modified file and report possible issues.

Important aspects to consider:

* The Trilium import/export mechanism is not perfect, so if you make some modifications to the documentation using `docs:edit`, at the next import/export/import cycle some whitespace might get thrown in. It's generally safe to commit the changes as-is.
* Since we are importing Markdown, editing HTML and then exporting the HTML back to Markdown there might be some edge cases where the formatting is not properly preserved. Try to identify such cases and report them in order to get them fixed (this will benefit also the users).

## Location of the documentation

All documentation is stored in the [Notes](https://github.com/TriliumNext/Notes) repository:

* `docs/Developer Guide` contains Markdown documentation that can be modified either externally (using a Markdown editor, or internally using Trilium).
* `docs/Release Notes` is also stored in Markdown format and can be freely edited.
* `docs/Script API` contains auto-generated files and thus must not be modified.
* `docs/User Guide` contains also Markdown-only documentation but must generally not be edited externally.
* The reason is that the `docs:edit` feature will not only import/export this documentation, but also generate the corresponding HTML documentation and meta structure in `src/public/app/doc_notes/en/User Guide`.
* It's theoretically possible to edit the Markdown files externally and then run `docs:edit` and trigger a change in order to build the documentation, but that would not be a very productive workflow.

## Updating the Script API

As mentioned previously, the Script API is not manually editable since it is auto-generated using TypeDoc.

To update the API documentation, simply run `npm run docs:build`. Compare the changes (if any) and commit them.

Note that in order to simulate the environment a script would have, some fake source files (in the sense that they are only used for documentation) are being used as entrypoints for the documentation:

* For back-end scripts, the script is located in `src/services/backend_script_entrypoint.ts`.
* For front-end scripts, the script is located in `src/public/app/services/frontend_script_entrypoint.ts`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Documentation references in the application
## Hard-coded links

Hard-coded links are present throughout the application, either in dialogs or in the source code as comments.

You can identify these links by searching for:

```
https://triliumnext.github.io/Docs/Wiki/
```

## Help buttons

There is a pattern of “?” buttons throughout the application which make use of the `data-help-page` attribute. Whenever these buttons are pressed, the user is redirected to the corresponding wiki page by prepending the wiki root URL to the `data-help-page` attribute.

Since the current wiki has a different structure than the original, for example to link to [https://github.com/TriliumNext/Docs/blob/main/Wiki/tree-concepts.md](https://github.com/TriliumNext/Docs/blob/main/Wiki/tree-concepts.md) the `data-help-page` attribute must be set to `tree-concepts.md`.

For links to headings, simply add the heading after the `.md`: `tree-concepts.md#prefix`

You can identify those by looking for:

* `.attr("data-help-page"`
* `data-help-page="`

This file was deleted.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion docs/Release Notes/Release Notes/v0.92.8-beta.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
* Delete notes now requests confirmation.
* Modals now have a safe margin on their bottom and are scrollable.
* [Center Search results under quick search bar](https://github.com/TriliumNext/Notes/issues/1679)
* Native ARM builds for Windows are now back.

## 🌍 Internationalization

Expand All @@ -39,4 +40,6 @@

## 🛠️ Technical updates

* upgrade to express 5.1.0 by @pano9000
* upgrade to express 5.1.0 by @pano9000
* update dependency mind-elixir to v4.5.1
* remove non-working cookiePath option
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Configure Nginx proxy and HTTPS. The operating system here is Ubuntu 18.04.
ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
ssl_prefer_server_ciphers on;
access_log /var/log/nginx/access.log; #check the path of access.log, if it doesn't fit your file, change it

location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
Expand All @@ -40,10 +40,31 @@ Configure Nginx proxy and HTTPS. The operating system here is Ubuntu 18.04.
proxy_redirect http://127.0.0.1:8080 https://trilium.example.net; # change them based on your IP, port and domain
}
}

# This part is for HTTPS forced
server {
listen 80;
server_name trilium.example.net; # change to your domain
return 301 https://$server_name$request_uri;
listen 80;
server_name trilium.example.net; # change to your domain
return 301 https://$server_name$request_uri;
}
```
4. Alternatively if you want to serve the instance under a different path (useful e.g. if you want to serve multiple instances), update the location block like so:

* update the location with your desired path (make sure to not leave a trailing slash "/", if your `proxy_pass` does not end on a slash as well)
* add the `proxy_cookie_path` directive with the same path: this allows you to stay logged in at multiple instances at the same time.

```
location /trilium/instance-one {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://127.0.0.1:8080; # change it to a different port if non-default is used
proxy_cookie_path / /trilium/instance-one
proxy_read_timeout 90;
proxy_redirect http://127.0.0.1:8080 https://trilium.example.net; # change them based on your IP, port and domain
}

```
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,8 @@
"demo:edit-nix": "electron-rebuild --version 33.3.1 && cross-env NODE_OPTIONS=\"--import tsx\" TRILIUM_DATA_DIR=./data-docs TRILIUM_PORT=37741 TRILIUM_ENV=dev TRILIUM_INTEGRATION_TEST=memory-no-store nix-shell -p electron_33 --run \"electron ./electron-edit-demo.ts .\"",
"electron-forge:start": "npm run build:prepare-dist && cd ./build && electron-forge start",
"electron-forge:make": "npm run build:prepare-dist && cross-env DEBUG=electron-windows-installer:* electron-forge make ./build",
"electron-forge:package": "npm run build:prepare-dist && cd ./build && electron-forge package",
"docs:build-backend": "rimraf ./docs/backend_api && typedoc",
"docs:build-frontend": "rimraf ./docs/frontend_api && jsdoc -c jsdoc-conf.json -d ./docs/frontend_api src/public/app/entities/*.js src/public/app/services/frontend_script_api.js src/public/app/widgets/basic_widget.js src/public/app/widgets/note_context_aware_widget.js src/public/app/widgets/right_panel_widget.js",
"docs:build": "npm run docs:build-backend && npm run docs:build-frontend",
"electron-forge:package": "npm run build:prepare-dist && cd ./build && electron-forge package",
"docs:build": "typedoc",
"build:webpack": "tsx node_modules/webpack/bin/webpack.js -c webpack.config.ts --progress",
"build:webpack-stats": "tsx node_modules/webpack/bin/webpack.js -c webpack.config.ts --profile --json=webpack-stats.json",
"build:ts": "tsc -p tsconfig.build.json",
Expand Down Expand Up @@ -231,7 +229,7 @@
"lorem-ipsum": "2.0.8",
"mark.js": "8.11.1",
"mermaid": "11.6.0",
"mind-elixir": "4.5.0",
"mind-elixir": "4.5.1",
"mini-css-extract-plugin": "2.9.2",
"nodemon": "3.1.9",
"panzoom": "9.4.3",
Expand Down
Loading
Loading