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

@@ -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({