mirror of
https://github.com/zadam/trilium.git
synced 2026-02-02 12:39:20 +01:00
docs(user): add missing jsx / HTML code blocks
This commit is contained in:
@@ -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 />
|
||||
```
|
||||
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user