docs(user): add missing jsx / HTML code blocks

This commit is contained in:
Elian Doran
2026-01-03 22:56:23 +02:00
parent 20ae1f844b
commit a613980ea4
16 changed files with 260 additions and 284 deletions

View File

@@ -32,7 +32,7 @@ Common request is to allow multiple users collaborate, share notes etc. So far I
This is normally not supported - one Trilium process can open only a single instance of a [database](Advanced%20Usage/Database.md). However, you can run two Trilium processes (from one installation), each connected to a separate document. To achieve this, you need to set a location for the [data directory](Installation%20%26%20Setup/Data%20directory.md) in the `TRILIUM_DATA_DIR` environment variable and separate port on `TRILIUM_PORT` environment variable. How to do that depends on the platform, in Unix-based systems you can achieve that by running command such as this:
```
```sh
TRILIUM_DATA_DIR=/home/me/path/to/data/dir TRILIUM_PORT=12345 trilium
```
@@ -44,7 +44,7 @@ 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:
```
```plain
SqliteError: database disk image is malformed
```

View File

@@ -17,7 +17,7 @@ For a simple example, we are going to create a render note that displays the cur
To do so, first create an HTML code note with the following content:
```
```html
<h1>Current date & time</h1>
The current date & time is <span class="date"></span>
```
@@ -44,7 +44,7 @@ Here are the steps to creating a simple render note:
2. Create a child <a class="reference-link" href="Code.md">Code</a> note with JSX as the language.
As an example, use the following content:
```
```jsx
export default function() {
return (
<>

View File

@@ -13,7 +13,7 @@ Here's an example child hierarchy using <a class="reference-link" href="../../.
* _Render note with subcomponents_
Type: JSX
```javascript
```jsx
export default function() {
return (
<MyComponent />
@@ -24,7 +24,7 @@ Here's an example child hierarchy using <a class="reference-link" href="../../.
* _MyComponent_
Type: Code / JSX
```javascript
```jsx
export default function MyComponent() {
return <p>Hi</p>;
}
@@ -36,7 +36,7 @@ To export multiple components, use the `export` keyword next to each of the func
Here's how a sub-note called `MyComponents` would look like:
```javascript
```jsx
export function MyFirstComponent() {
return <p>First</p>;
}
@@ -48,7 +48,7 @@ export function MySecondComponent() {
Then in its parent note:
```javascript
```jsx
const { MyFirstComponent, MySecondComponent } = MyComponents;
export default function() {
@@ -63,7 +63,7 @@ export default function() {
Alternatively, it's also possible to use the components directly without assigning them to a `const` first:
```javascript
```jsx
<MyComponents.MyFirstComponent />
<MyComponents.MySecondComponent />
```

View File

@@ -5,7 +5,7 @@ All standard Preact hooks are available as an import in `trilium:api`.
For example:
```
```jsx
import { useState } from "trilium:preact";
const [ myState, setMyState ] = useState("Hi");
```
@@ -18,7 +18,7 @@ Trilium comes with a large set of custom hooks for Preact, all of which are also
As a replacement to <a class="reference-link" href="../Custom%20Widgets/Note%20context%20aware%20widget.md">Note context aware widget</a>, Preact exposes the current note context in the `useNoteContext` hook:
```
```jsx
import { defineWidget, useNoteContext, useNoteProperty } from "trilium:preact";
export default defineWidget({