feat(docs): improve documentation for code notes, code blocks

This commit is contained in:
Elian Doran 2025-03-12 12:13:51 +02:00
parent 4f87bd101e
commit e9175d60ec
No known key found for this signature in database
77 changed files with 1535 additions and 685 deletions

View File

@ -634,249 +634,6 @@
}
]
},
{
"isClone": false,
"noteId": "6f9hih2hXXZk",
"notePath": [
"pOsGYCXsbNQG",
"tC7s2alapj8V",
"6f9hih2hXXZk"
],
"title": "Code Notes",
"notePosition": 60,
"prefix": null,
"isExpanded": false,
"type": "text",
"mime": "text/markdown",
"attributes": [
{
"type": "relation",
"name": "internalLink",
"value": "CdNpE2pqjmI6",
"isInheritable": false,
"position": 10
},
{
"type": "label",
"name": "shareAlias",
"value": "code-notes",
"isInheritable": false,
"position": 20
}
],
"format": "markdown",
"dataFileName": "Code Notes.md",
"attachments": [
{
"attachmentId": "hajUVeLs3EOM",
"title": "image.png",
"role": "image",
"mime": "image/jpg",
"position": 10,
"dataFileName": "Code Notes_image.png"
},
{
"attachmentId": "OTcapNOcNaBL",
"title": "image.png",
"role": "image",
"mime": "image/jpg",
"position": 10,
"dataFileName": "1_Code Notes_image.png"
}
],
"dirFileName": "Code Notes",
"children": [
{
"isClone": false,
"noteId": "CdNpE2pqjmI6",
"notePath": [
"pOsGYCXsbNQG",
"tC7s2alapj8V",
"6f9hih2hXXZk",
"CdNpE2pqjmI6"
],
"title": "Scripts",
"notePosition": 10,
"prefix": null,
"isExpanded": false,
"type": "text",
"mime": "text/markdown",
"attributes": [
{
"type": "relation",
"name": "internalLink",
"value": "6f9hih2hXXZk",
"isInheritable": false,
"position": 10
},
{
"type": "relation",
"name": "internalLink",
"value": "GLks18SNjxmC",
"isInheritable": false,
"position": 20
},
{
"type": "relation",
"name": "internalLink",
"value": "zEY4DaJG4YT5",
"isInheritable": false,
"position": 30
},
{
"type": "relation",
"name": "internalLink",
"value": "5668rwcirq1t",
"isInheritable": false,
"position": 40
},
{
"type": "relation",
"name": "internalLink",
"value": "GPERMystNGTB",
"isInheritable": false,
"position": 50
},
{
"type": "relation",
"name": "imageLink",
"value": "DVJl4l3T8EG2",
"isInheritable": false,
"position": 60
},
{
"type": "relation",
"name": "internalLink",
"value": "wX4HbRucYSDD",
"isInheritable": false,
"position": 70
},
{
"type": "relation",
"name": "internalLink",
"value": "RDslemsQ6gCp",
"isInheritable": false,
"position": 80
},
{
"type": "label",
"name": "shareAlias",
"value": "scripts",
"isInheritable": false,
"position": 20
}
],
"format": "markdown",
"dataFileName": "Scripts.md",
"attachments": []
},
{
"isClone": false,
"noteId": "GLks18SNjxmC",
"notePath": [
"pOsGYCXsbNQG",
"tC7s2alapj8V",
"6f9hih2hXXZk",
"GLks18SNjxmC"
],
"title": "Script API",
"notePosition": 20,
"prefix": null,
"isExpanded": false,
"type": "text",
"mime": "text/markdown",
"attributes": [
{
"type": "label",
"name": "shareAlias",
"value": "script-api",
"isInheritable": false,
"position": 10
}
],
"format": "markdown",
"dataFileName": "Script API.md",
"attachments": []
},
{
"isClone": false,
"noteId": "GPERMystNGTB",
"notePath": [
"pOsGYCXsbNQG",
"tC7s2alapj8V",
"6f9hih2hXXZk",
"GPERMystNGTB"
],
"title": "Events",
"notePosition": 40,
"prefix": null,
"isExpanded": false,
"type": "text",
"mime": "text/markdown",
"attributes": [
{
"type": "relation",
"name": "internalLink",
"value": "zEY4DaJG4YT5",
"isInheritable": false,
"position": 10
},
{
"type": "relation",
"name": "internalLink",
"value": "CdNpE2pqjmI6",
"isInheritable": false,
"position": 20
},
{
"type": "label",
"name": "shareAlias",
"value": "events",
"isInheritable": false,
"position": 30
}
],
"format": "markdown",
"dataFileName": "Events.md",
"attachments": []
},
{
"isClone": false,
"noteId": "MgibgPcfeuGz",
"notePath": [
"pOsGYCXsbNQG",
"tC7s2alapj8V",
"6f9hih2hXXZk",
"MgibgPcfeuGz"
],
"title": "Custom Widgets",
"notePosition": 50,
"prefix": null,
"isExpanded": false,
"type": "text",
"mime": "text/markdown",
"attributes": [
{
"type": "relation",
"name": "imageLink",
"value": "3sCPPL0LEC1S",
"isInheritable": false,
"position": 10
},
{
"type": "label",
"name": "shareAlias",
"value": "custom-widget",
"isInheritable": false,
"position": 20
}
],
"format": "markdown",
"dataFileName": "Custom Widgets.md",
"attachments": []
}
]
},
{
"isClone": false,
"noteId": "5668rwcirq1t",
@ -1944,6 +1701,71 @@
"dataFileName": "1_Global menu_image.png"
}
]
},
{
"isClone": false,
"noteId": "BlN9DFI679QC",
"notePath": [
"pOsGYCXsbNQG",
"gh7bpGYxajRS",
"Vc8PjrjAGuOp",
"BlN9DFI679QC"
],
"title": "Ribbon",
"notePosition": 20,
"prefix": null,
"isExpanded": false,
"type": "text",
"mime": "text/html",
"attributes": [
{
"type": "relation",
"name": "internalLink",
"value": "4TIF1oA4VQRO",
"isInheritable": false,
"position": 10
}
],
"format": "markdown",
"dataFileName": "Ribbon.md",
"attachments": [
{
"attachmentId": "JCiJ3vRhgXY9",
"title": "image.png",
"role": "image",
"mime": "image/jpg",
"position": 10,
"dataFileName": "Ribbon_image.png"
}
]
},
{
"isClone": false,
"noteId": "4TIF1oA4VQRO",
"notePath": [
"pOsGYCXsbNQG",
"gh7bpGYxajRS",
"Vc8PjrjAGuOp",
"4TIF1oA4VQRO"
],
"title": "Options",
"notePosition": 30,
"prefix": null,
"isExpanded": false,
"type": "text",
"mime": "text/html",
"attributes": [
{
"type": "label",
"name": "iconClass",
"value": "bx bx-cog",
"isInheritable": false,
"position": 10
}
],
"format": "markdown",
"dataFileName": "Options.md",
"attachments": []
}
]
},
@ -3498,6 +3320,13 @@
"name": "shareAlias",
"value": "text-notes",
"isInheritable": false,
"position": 10
},
{
"type": "label",
"name": "sorted",
"value": "",
"isInheritable": false,
"position": 20
}
],
@ -3523,6 +3352,87 @@
],
"dirFileName": "Text",
"children": [
{
"isClone": false,
"noteId": "QxEyIjRBizuC",
"notePath": [
"pOsGYCXsbNQG",
"KSZ04uQ2D1St",
"iPIMuisry3hd",
"QxEyIjRBizuC"
],
"title": "Code blocks",
"notePosition": 10,
"prefix": null,
"isExpanded": false,
"type": "text",
"mime": "text/html",
"attributes": [
{
"type": "relation",
"name": "internalLink",
"value": "nRhnJkTT8cPs",
"isInheritable": false,
"position": 20
},
{
"type": "relation",
"name": "internalLink",
"value": "4TIF1oA4VQRO",
"isInheritable": false,
"position": 30
},
{
"type": "relation",
"name": "internalLink",
"value": "s8alTXmpFR61",
"isInheritable": false,
"position": 40
},
{
"type": "label",
"name": "iconClass",
"value": "bx bx-code",
"isInheritable": false,
"position": 50
},
{
"type": "relation",
"name": "internalLink",
"value": "6f9hih2hXXZk",
"isInheritable": false,
"position": 60
}
],
"format": "markdown",
"dataFileName": "Code blocks.md",
"attachments": [
{
"attachmentId": "7HhhhyZ4AS0A",
"title": "image.png",
"role": "image",
"mime": "image/png",
"position": 10,
"dataFileName": "Code blocks_image.png"
},
{
"attachmentId": "DyHSLO958cdd",
"title": "image.png",
"role": "image",
"mime": "image/jpg",
"position": 10,
"dataFileName": "1_Code blocks_image.png"
},
{
"attachmentId": "kE8PPw7iyuu9",
"title": "image.png",
"role": "image",
"mime": "image/png",
"position": 10,
"dataFileName": "2_Code blocks_image.png"
}
]
},
{
"isClone": false,
"noteId": "veGu4faJErEM",
@ -3533,7 +3443,7 @@
"veGu4faJErEM"
],
"title": "Content language",
"notePosition": 10,
"notePosition": 20,
"prefix": null,
"isExpanded": false,
"type": "text",
@ -3545,6 +3455,13 @@
"value": "BMf2nEbYlcUt",
"isInheritable": false,
"position": 10
},
{
"type": "label",
"name": "iconClass",
"value": "bx bx-align-right",
"isInheritable": false,
"position": 20
}
],
"format": "markdown",
@ -3560,6 +3477,81 @@
}
]
},
{
"isClone": false,
"noteId": "nRhnJkTT8cPs",
"notePath": [
"pOsGYCXsbNQG",
"KSZ04uQ2D1St",
"iPIMuisry3hd",
"nRhnJkTT8cPs"
],
"title": "Formatting toolbar",
"notePosition": 30,
"prefix": null,
"isExpanded": false,
"type": "text",
"mime": "text/html",
"attributes": [
{
"type": "relation",
"name": "internalLink",
"value": "BlN9DFI679QC",
"isInheritable": false,
"position": 10
},
{
"type": "label",
"name": "iconClass",
"value": "bx bx-text",
"isInheritable": false,
"position": 20
},
{
"type": "relation",
"name": "internalLink",
"value": "4TIF1oA4VQRO",
"isInheritable": false,
"position": 30
}
],
"format": "markdown",
"dataFileName": "Formatting toolbar.md",
"attachments": [
{
"attachmentId": "CZ8ENj2LsBsA",
"title": "image.png",
"role": "image",
"mime": "image/jpg",
"position": 10,
"dataFileName": "Formatting toolbar_image.png"
},
{
"attachmentId": "iu9xb3VivIIl",
"title": "image.png",
"role": "image",
"mime": "image/jpg",
"position": 10,
"dataFileName": "1_Formatting toolbar_image.png"
},
{
"attachmentId": "MMeih4nJVgNk",
"title": "image.png",
"role": "image",
"mime": "image/jpg",
"position": 10,
"dataFileName": "2_Formatting toolbar_image.png"
},
{
"attachmentId": "SGaPJHzNyLLV",
"title": "image.png",
"role": "image",
"mime": "image/jpg",
"position": 10,
"dataFileName": "3_Formatting toolbar_image.png"
}
]
},
{
"isClone": false,
"noteId": "S6Xx8QIWTV66",
@ -3570,7 +3562,7 @@
"S6Xx8QIWTV66"
],
"title": "Lists",
"notePosition": 20,
"notePosition": 40,
"prefix": null,
"isExpanded": false,
"type": "text",
@ -3641,30 +3633,296 @@
},
{
"isClone": false,
"noteId": "FVuX89AJuFSw",
"noteId": "6f9hih2hXXZk",
"notePath": [
"pOsGYCXsbNQG",
"KSZ04uQ2D1St",
"FVuX89AJuFSw"
"6f9hih2hXXZk"
],
"title": "Code",
"notePosition": 30,
"notePosition": 40,
"prefix": null,
"isExpanded": false,
"type": "text",
"mime": "text/html",
"mime": "text/markdown",
"attributes": [
{
"type": "label",
"name": "shareAlias",
"value": "code-notes",
"isInheritable": false,
"position": 20
},
{
"type": "relation",
"name": "internalLink",
"value": "CdNpE2pqjmI6",
"isInheritable": false,
"position": 30
},
{
"type": "relation",
"name": "internalLink",
"value": "iPIMuisry3hd",
"isInheritable": false,
"position": 40
},
{
"type": "relation",
"name": "internalLink",
"value": "QxEyIjRBizuC",
"isInheritable": false,
"position": 50
},
{
"type": "relation",
"name": "internalLink",
"value": "BlN9DFI679QC",
"isInheritable": false,
"position": 60
},
{
"type": "relation",
"name": "internalLink",
"value": "4TIF1oA4VQRO",
"isInheritable": false,
"position": 70
},
{
"type": "relation",
"name": "internalLink",
"value": "s8alTXmpFR61",
"isInheritable": false,
"position": 80
},
{
"type": "label",
"name": "iconClass",
"value": "bx bx-code",
"isInheritable": false,
"position": 10
"position": 90
}
],
"format": "markdown",
"dataFileName": "Code.md",
"attachments": []
"attachments": [
{
"attachmentId": "hajUVeLs3EOM",
"title": "image.png",
"role": "image",
"mime": "image/jpg",
"position": 10,
"dataFileName": "Code_image.png"
},
{
"attachmentId": "iKJbcEUkME1a",
"title": "image.png",
"role": "image",
"mime": "image/jpg",
"position": 10,
"dataFileName": "1_Code_image.png"
},
{
"attachmentId": "OTcapNOcNaBL",
"title": "image.png",
"role": "image",
"mime": "image/jpg",
"position": 10,
"dataFileName": "2_Code_image.png"
}
],
"dirFileName": "Code",
"children": [
{
"isClone": false,
"noteId": "CdNpE2pqjmI6",
"notePath": [
"pOsGYCXsbNQG",
"KSZ04uQ2D1St",
"6f9hih2hXXZk",
"CdNpE2pqjmI6"
],
"title": "Scripts",
"notePosition": 10,
"prefix": null,
"isExpanded": false,
"type": "text",
"mime": "text/markdown",
"attributes": [
{
"type": "relation",
"name": "internalLink",
"value": "6f9hih2hXXZk",
"isInheritable": false,
"position": 10
},
{
"type": "relation",
"name": "internalLink",
"value": "GLks18SNjxmC",
"isInheritable": false,
"position": 20
},
{
"type": "relation",
"name": "internalLink",
"value": "zEY4DaJG4YT5",
"isInheritable": false,
"position": 30
},
{
"type": "relation",
"name": "internalLink",
"value": "5668rwcirq1t",
"isInheritable": false,
"position": 40
},
{
"type": "relation",
"name": "internalLink",
"value": "GPERMystNGTB",
"isInheritable": false,
"position": 50
},
{
"type": "relation",
"name": "imageLink",
"value": "DVJl4l3T8EG2",
"isInheritable": false,
"position": 60
},
{
"type": "relation",
"name": "internalLink",
"value": "wX4HbRucYSDD",
"isInheritable": false,
"position": 70
},
{
"type": "relation",
"name": "internalLink",
"value": "RDslemsQ6gCp",
"isInheritable": false,
"position": 80
},
{
"type": "label",
"name": "shareAlias",
"value": "scripts",
"isInheritable": false,
"position": 20
}
],
"format": "markdown",
"dataFileName": "Scripts.md",
"attachments": []
},
{
"isClone": false,
"noteId": "GLks18SNjxmC",
"notePath": [
"pOsGYCXsbNQG",
"KSZ04uQ2D1St",
"6f9hih2hXXZk",
"GLks18SNjxmC"
],
"title": "Script API",
"notePosition": 20,
"prefix": null,
"isExpanded": false,
"type": "text",
"mime": "text/markdown",
"attributes": [
{
"type": "label",
"name": "shareAlias",
"value": "script-api",
"isInheritable": false,
"position": 10
}
],
"format": "markdown",
"dataFileName": "Script API.md",
"attachments": []
},
{
"isClone": false,
"noteId": "GPERMystNGTB",
"notePath": [
"pOsGYCXsbNQG",
"KSZ04uQ2D1St",
"6f9hih2hXXZk",
"GPERMystNGTB"
],
"title": "Events",
"notePosition": 40,
"prefix": null,
"isExpanded": false,
"type": "text",
"mime": "text/markdown",
"attributes": [
{
"type": "relation",
"name": "internalLink",
"value": "zEY4DaJG4YT5",
"isInheritable": false,
"position": 10
},
{
"type": "relation",
"name": "internalLink",
"value": "CdNpE2pqjmI6",
"isInheritable": false,
"position": 20
},
{
"type": "label",
"name": "shareAlias",
"value": "events",
"isInheritable": false,
"position": 30
}
],
"format": "markdown",
"dataFileName": "Events.md",
"attachments": []
},
{
"isClone": false,
"noteId": "MgibgPcfeuGz",
"notePath": [
"pOsGYCXsbNQG",
"KSZ04uQ2D1St",
"6f9hih2hXXZk",
"MgibgPcfeuGz"
],
"title": "Custom Widgets",
"notePosition": 50,
"prefix": null,
"isExpanded": false,
"type": "text",
"mime": "text/markdown",
"attributes": [
{
"type": "relation",
"name": "imageLink",
"value": "3sCPPL0LEC1S",
"isInheritable": false,
"position": 10
},
{
"type": "label",
"name": "shareAlias",
"value": "custom-widget",
"isInheritable": false,
"position": 20
}
],
"format": "markdown",
"dataFileName": "Custom Widgets.md",
"attachments": []
}
]
},
{
"isClone": false,
@ -3675,7 +3933,7 @@
"m523cpzocqaD"
],
"title": "Saved Search",
"notePosition": 50,
"notePosition": 60,
"prefix": null,
"isExpanded": false,
"type": "text",
@ -3723,7 +3981,7 @@
"joqzSrDccPKf"
],
"title": "Relation Map",
"notePosition": 60,
"notePosition": 70,
"prefix": null,
"isExpanded": false,
"type": "text",
@ -3750,7 +4008,7 @@
"bdUJEHsAPYQR"
],
"title": "Note Map",
"notePosition": 70,
"notePosition": 80,
"prefix": null,
"isExpanded": false,
"type": "text",
@ -3777,7 +4035,7 @@
"HcABDtFCkbFN"
],
"title": "Render Note",
"notePosition": 90,
"notePosition": 100,
"prefix": null,
"isExpanded": false,
"type": "text",
@ -3804,7 +4062,7 @@
"GTwFsgaA0lCt"
],
"title": "Book",
"notePosition": 110,
"notePosition": 120,
"prefix": null,
"isExpanded": false,
"type": "text",
@ -4054,7 +4312,7 @@
"s1aBHPd79XYj"
],
"title": "Mermaid Diagrams",
"notePosition": 120,
"notePosition": 130,
"prefix": null,
"isExpanded": false,
"type": "text",
@ -4161,7 +4419,7 @@
"grjYqerjn243"
],
"title": "Canvas",
"notePosition": 140,
"notePosition": 150,
"prefix": null,
"isExpanded": false,
"type": "text",
@ -4197,7 +4455,7 @@
"1vHRoWCEjj0L"
],
"title": "Web View",
"notePosition": 150,
"notePosition": 160,
"prefix": null,
"isExpanded": false,
"type": "text",
@ -4224,7 +4482,7 @@
"gBbsAeiuUxI5"
],
"title": "Mind Map",
"notePosition": 160,
"notePosition": 170,
"prefix": null,
"isExpanded": false,
"type": "text",
@ -4251,7 +4509,7 @@
"81SGnPGMk7Xc"
],
"title": "Geo map",
"notePosition": 170,
"notePosition": 180,
"prefix": null,
"isExpanded": false,
"type": "text",
@ -6192,6 +6450,25 @@
"format": "markdown",
"dataFileName": "Synchronization fails with 504.md",
"attachments": []
},
{
"isClone": false,
"noteId": "s8alTXmpFR61",
"notePath": [
"pOsGYCXsbNQG",
"BgmBlOIl72jZ",
"s8alTXmpFR61"
],
"title": "Refreshing the application",
"notePosition": 60,
"prefix": null,
"isExpanded": false,
"type": "text",
"mime": "text/html",
"attributes": [],
"format": "markdown",
"dataFileName": "Refreshing the application.md",
"attachments": []
}
]
},

View File

@ -1,5 +1,5 @@
# Advanced Showcases
Trilium offers advanced functionality through [Scripts](Code%20Notes/Scripts.md) and [Promoted Attributes](Attributes/Promoted%20Attributes.md). To illustrate these features, we've prepared several showcases available in the [demo notes](Database.md):
Trilium offers advanced functionality through [Scripts](../Note%20Types/Code/Scripts.md) and [Promoted Attributes](Attributes/Promoted%20Attributes.md). To illustrate these features, we've prepared several showcases available in the [demo notes](Database.md):
* [Relation Map](Relation%20Map.md)
* [Day Notes](Advanced%20Showcases/Day%20Notes.md)

View File

@ -1,5 +1,5 @@
# Task Manager
Task Manager is a [promoted attributes](../Attributes/Promoted%20Attributes.md) and [scripts](../Code%20Notes/Scripts.md)showcase present in the [demo notes](../Database.md).
Task Manager is a [promoted attributes](../Attributes/Promoted%20Attributes.md) and [scripts](../../Note%20Types/Code/Scripts.md)showcase present in the [demo notes](../Database.md).
## Demo
@ -15,7 +15,7 @@ New tasks are created in the TODO note which has `~child:template` [relation](..
### Attributes
Task template defines several [promoted attributes](../Attributes/Promoted%20Attributes.md) - todoDate, doneDate, tags, location. Importantly it also defines `~runOnAttributeChange` relation - [event](../Code%20Notes/Events.md) handler which is run on attribute change. This [script](../Code%20Notes/Scripts.md) handles when e.g. we fill out the doneDate attribute - meaning the task is done and should be moved to "Done" note and removed from TODO, locations and tags.
Task template defines several [promoted attributes](../Attributes/Promoted%20Attributes.md) - todoDate, doneDate, tags, location. Importantly it also defines `~runOnAttributeChange` relation - [event](../../Note%20Types/Code/Events.md) handler which is run on attribute change. This [script](../../Note%20Types/Code/Scripts.md) handles when e.g. we fill out the doneDate attribute - meaning the task is done and should be moved to "Done" note and removed from TODO, locations and tags.
### New task button
@ -46,7 +46,7 @@ api.addButtonToToolbar({
In the demo screenshot above you may notice that TODO tasks are in red color and DONE tasks are green.
This is done by having this CSS [code note](../Code%20Notes.md) which defines extra CSS classes:
This is done by having this CSS [code note](../../Note%20Types/Code.md) which defines extra CSS classes:
```
span.fancytree-node.todo .fancytree-title {
@ -58,6 +58,6 @@ span.fancytree-node.done .fancytree-title {
}
```
This [code note](../Code%20Notes.md) has `#appCss` [label](../Attributes.md)which is recognized by Trilium on startup and loaded as CSS into the application.
This [code note](../../Note%20Types/Code.md) has `#appCss` [label](../Attributes.md)which is recognized by Trilium on startup and loaded as CSS into the application.
Second part of this functionality is based in event handler described above which assigns `#cssClass` label to the task to either "done" or "todo" based on the task status.

View File

@ -1,21 +1,21 @@
# Weight Tracker
![](Weight%20Tracker_image.png)
The `Weight Tracker` is a [Script API](../Code%20Notes/Script%20API.md) showcase present in the [demo notes](../Database.md).
The `Weight Tracker` is a [Script API](../../Note%20Types/Code/Script%20API.md) showcase present in the [demo notes](../Database.md).
By adding `weight` as a [promoted attribute](../Attributes/Promoted%20Attributes.md) in the [template](../Attributes/Template.md) from which [day notes](Day%20Notes.md) are created, you can aggregate the data and plot weight change over time.
## Implementation
The `Weight Tracker` note in the screenshot above is of the type `Render Note`. That type of note doesn't have any useful content itself. Instead it is a placeholder where a [script](../Code%20Notes/Scripts.md) can render its output.
The `Weight Tracker` note in the screenshot above is of the type `Render Note`. That type of note doesn't have any useful content itself. Instead it is a placeholder where a [script](../../Note%20Types/Code/Scripts.md) can render its output.
Scripts for `Render Notes` are defined in a [relation](../Attributes.md) called `~renderNote`. In this example, it's the `Weight Tracker`'s child `Implementation`. The Implementation consists of two [code notes](../Code%20Notes.md) that contain some HTML and JavaScript respectively, which load all the notes with a `weight` attribute and display their values in a chart.
Scripts for `Render Notes` are defined in a [relation](../Attributes.md) called `~renderNote`. In this example, it's the `Weight Tracker`'s child `Implementation`. The Implementation consists of two [code notes](../../Note%20Types/Code.md) that contain some HTML and JavaScript respectively, which load all the notes with a `weight` attribute and display their values in a chart.
To actually render the chart, we're using a third party library called [chart.js](https://www.chartjs.org/)which is imported as an attachment, since it's not built into Trilium.
### Code
Here's the content of the script which is placed in a [code note](../Code%20Notes.md) of type `JS Frontend`:
Here's the content of the script which is placed in a [code note](../../Note%20Types/Code.md) of type `JS Frontend`:
```
async function getChartData() {

View File

@ -1,21 +0,0 @@
# Code Notes
Trilium supports creating "code" notes, i.e. notes which contain some sort of formal code - be it programming language (C++, JavaScript), structured data (JSON, XML) or other types of codes (CSS etc.).
This can be useful for a few things:
* computer programmers can store code snippets as notes with syntax highlighting
* JavaScript code notes can be executed inside Trilium for some extra functionality
* we call such JavaScript code notes "scripts" - see [Scripts](Code%20Notes/Scripts.md)
* JSON, XML etc. can be used as storage for structured data (typically used in conjunction with scripting)
![](Code%20Notes_image.png)
## Extra languages
Trilium supports syntax highlighting for many languages, but by default displays only some of them (to reduce the number of items). You can add extra languages in Options -> Code notes.
## Code blocks
An alternative to the code note is a "code block" - feature of a text note which can add short snippets of code to the text editor. Starting with TriliumNext v0.90.12, the code blocks also support syntax highlighting.
![](1_Code%20Notes_image.png)

View File

@ -1,11 +1,11 @@
# Custom Request Handler
Trilium provides a mechanism for [scripts](Code%20Notes/Scripts.md) to open a public REST endpoint. This opens a way for various integrations with other services - a simple example would be creating new note from Slack by issuing a slash command (e.g. `/trilium buy milk`).
Trilium provides a mechanism for [scripts](../Note%20Types/Code/Scripts.md) to open a public REST endpoint. This opens a way for various integrations with other services - a simple example would be creating new note from Slack by issuing a slash command (e.g. `/trilium buy milk`).
## Create note from outside Trilium
Let's take a look at an example. The goal is to provide a REST endpoint to which we can send title and content and Trilium will create a note.
We'll start with creating a JavaScript backend [code note](Code%20Notes.md) containing:
We'll start with creating a JavaScript backend [code note](../Note%20Types/Code.md) containing:
```
const {req, res} = api;
@ -53,7 +53,7 @@ Trilium will then find our code note created above and execute it. `api.req`, `a
In the code note we check the request method and then use trivial authentication - keep in mind that these endpoints are by default totally unauthenticated, and you need to take care of this yourself.
Once we pass these checks we will just create the desired note using [Script API](Code%20Notes/Script%20API.md).
Once we pass these checks we will just create the desired note using [Script API](../Note%20Types/Code/Script%20API.md).
## Custom resource provider

View File

@ -40,7 +40,7 @@ To protect shared notes with a username and password, you can use the `#shareCre
The default shared page is basic in design, but you can customize it using your own CSS:
* **Custom CSS**: Link a CSS [code note](Code%20Notes.md) to the shared page by adding a `~shareCss` relation to the note. If you want this style to apply to the entire subtree, make the label inheritable. You can hide the CSS code note from the tree navigation by adding the `#shareHiddenFromTree` label.
* **Custom CSS**: Link a CSS [code note](../Note%20Types/Code.md) to the shared page by adding a `~shareCss` relation to the note. If you want this style to apply to the entire subtree, make the label inheritable. You can hide the CSS code note from the tree navigation by adding the `#shareHiddenFromTree` label.
* **Omitting Default CSS**: For extensive styling changes, use the `#shareOmitDefaultCss` label to avoid conflicts with Trilium's [default stylesheet](../Basic%20Concepts/Themes.md).
### Adding JavaScript

View File

@ -49,7 +49,7 @@ Only in desktop (electron build):
## Editing notes
Trilium uses CKEditor 5 for the [text notes](../Note%20Types/Text.md) and CodeMirror 5 for [code notes](../Advanced%20Usage/Code%20Notes.md). Check the documentation of these projects to see all their built-in keyboard shortcuts.
Trilium uses CKEditor 5 for the [text notes](../Note%20Types/Text.md) and CodeMirror 5 for [code notes](../Note%20Types/Code.md). Check the documentation of these projects to see all their built-in keyboard shortcuts.
* `ALT-F10` - bring up inline formatting toolbar (arrow keys `<-`,`->` to navigate, `ENTER` to apply)
* `ALT-F10` - again to bring up block formatting toolbar

View File

@ -4,10 +4,10 @@ Note is a central entity in Trilium. Main attributes of note are title and conte
### Note types
* [text note](../Note%20Types/Text.md) - this is default note type which allows you to put rich text, images etc.
* [code note](../Advanced%20Usage/Code%20Notes.md) - some kind of formal code, typically programming language (e.g. JavaScript) or data structure (e.g. JSON)
* [code note](../Note%20Types/Code.md) - some kind of formal code, typically programming language (e.g. JavaScript) or data structure (e.g. JSON)
* [image note](https://github.com/TriliumNext/Notes/wiki/Images) - represents single image
* file note - represents uploaded file (e.g. docx MS Word document).
* render HTML note - this works as an output screen of attached [scripts](../Advanced%20Usage/Code%20Notes/Scripts.md)
* render HTML note - this works as an output screen of attached [scripts](../Note%20Types/Code/Scripts.md)
* [saved search](../Note%20Types/Saved%20Search.md) note - contains saved search query and dynamically displays result of the search as its sub-notes
* [relation map](../Advanced%20Usage/Relation%20Map.md) note - visualizes notes and their relations
* [book note](../Note%20Types/Book.md) - displays its children notes, useful for reading many short notes

View File

@ -1,7 +1,7 @@
# Attachments
A [note](../Note.md) in Trilium can _own_ one or more attachments, which can be either images or files. These attachments can be displayed or linked within the note that owns them.
This can be especially useful to include dependencies for your [scripts](../../Advanced%20Usage/Code%20Notes/Scripts.md). The [Weight Tracker](../../Advanced%20Usage/Advanced%20Showcases/Weight%20Tracker.md) shows how to use [chartjs](https://chartjs.org/) which is attached to the [script note](#root/HcUYTojFohtb).
This can be especially useful to include dependencies for your [scripts](../../Note%20Types/Code/Scripts.md). The [Weight Tracker](../../Advanced%20Usage/Advanced%20Showcases/Weight%20Tracker.md) shows how to use [chartjs](https://chartjs.org/) which is attached to the [script note](#root/HcUYTojFohtb).
Each note exclusively owns its attachments, meaning attachments cannot be shared or linked from one note to another. If an attachment link is copied to a different note, the attachment itself is duplicated, and the copies are managed independently thereafter.

View File

@ -1,5 +1,5 @@
# Read-Only Notes
Both [text](../../Note%20Types/Text.md) and [code](../../Advanced%20Usage/Code%20Notes.md) notes in Trilium can be set to read-only. When a note is in read-only mode, it is presented to the user in a non-editable view, with the option to switch to editing mode if needed.
Both [text](../../Note%20Types/Text.md) and [code](../../Note%20Types/Code.md) notes in Trilium can be set to read-only. When a note is in read-only mode, it is presented to the user in a non-editable view, with the option to switch to editing mode if needed.
## Setting Read-Only Mode with a Label

View File

@ -9,7 +9,7 @@ Trilium comes with a couple pre-installed color themes, with the default being a
Trilium supports custom user themes, allowing you to personalize the application's appearance. To create a custom theme, follow these steps:
1. **Create a CSS Code Note**: Start by creating a new [code note](../Advanced%20Usage/Code%20Notes.md) with the `CSS` type.
1. **Create a CSS Code Note**: Start by creating a new [code note](../Note%20Types/Code.md) with the `CSS` type.
2. **Annotate with** `**#appTheme**`: Add the [attribute](../Advanced%20Usage/Attributes.md) `#appTheme=my-theme-name` to your note, where `my-theme-name` is the name of your custom theme.
3. **Define Your Styles**: Write your custom CSS within the note. Below is an example of a custom theme:
@ -95,7 +95,7 @@ In addition to full themes, Trilium allows for custom CSS that isn't tied to a t
To use custom CSS:
1. **Create a CSS Code Note**: Create a new [code note](../Advanced%20Usage/Code%20Notes.md) with the `CSS` type.
1. **Create a CSS Code Note**: Create a new [code note](../Note%20Types/Code.md) with the `CSS` type.
2. **Add the** `**appCss**` **Label**: Annotate the note with the `#appCss` [label](../Advanced%20Usage/Attributes.md).
3. **Write Your CSS**: Add your custom CSS rules to the note.

View File

@ -0,0 +1,8 @@
# Ribbon
![](Ribbon_image.png)
The ribbon allows changing options, attributes and viewing information about the current note.
## Settings
It is possible to change whether some ribbon items will be automatically open when navigating to a new note. To do so, in [Settings](Options.md), go to _Appearance_ and look for the _Ribbon widgets_ section.

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -1,7 +1,7 @@
# Frontend Basics
## Frontend API
The frontend api supports two styles, regular scripts that are run with the current app and note context, and widgets that export an object to Trilium to be used in the UI. In both cases, the frontend api of Trilium is available to scripts running in the frontend context as global variable `api`. The members and methods of the api can be seen on the [Script API](../Advanced%20Usage/Code%20Notes/Script%20API.md) page.
The frontend api supports two styles, regular scripts that are run with the current app and note context, and widgets that export an object to Trilium to be used in the UI. In both cases, the frontend api of Trilium is available to scripts running in the frontend context as global variable `api`. The members and methods of the api can be seen on the [Script API](../Note%20Types/Code/Script%20API.md) page.
## Scripts

View File

@ -85,7 +85,7 @@ After reloading Trilium, the button should now appear at the bottom left of the
### Step 4: Adding User Interaction
Lets make the button interactive by showing a message when its clicked. We'll use the `api.showMessage` method from the [Script API](../Advanced%20Usage/Code%20Notes/Script%20API.md).
Lets make the button interactive by showing a message when its clicked. We'll use the `api.showMessage` method from the [Script API](../Note%20Types/Code/Script%20API.md).
```
class MyWidget extends api.BasicWidget {

View File

@ -23,7 +23,7 @@ Common request is to allow multiple users collaborate, share notes etc. So far I
* it's a huge feature, or rather a Pandora's box of collaboration features like user management, permissions, conflict resolution, real-time editing of a note by multiple people etc. This would be a huge amount of work. Trilium Notes is project made mostly by one person in free time and that's unlikely to change in the future.
* given its size it would probably pivot the attention away from my main focus which is a personal note-taking
* the assumption that only single person has access to the app simplifies many things, or just outright makes them possible. In multi-user app, our [scripting](Advanced%20Usage/Code%20Notes/Scripts.md)support would be a XSS security hole, while with the single user assumption it's an endless customizable tool.
* the assumption that only single person has access to the app simplifies many things, or just outright makes them possible. In multi-user app, our [scripting](Note%20Types/Code/Scripts.md)support would be a XSS security hole, while with the single user assumption it's an endless customizable tool.
## How to open multiple documents in one Trilium instance

View File

@ -31,4 +31,4 @@ Trilium decides automatically whether to use mobile or desktop frontend. If this
## Scripting
You can alter the behavior with [scripts](../Advanced%20Usage/Code%20Notes/Scripts.md) just like for normal frontend. For script notes to be executed, they need to have labeled `#run=mobileStartup`.
You can alter the behavior with [scripts](../Note%20Types/Code/Scripts.md) just like for normal frontend. For script notes to be executed, they need to have labeled `#run=mobileStartup`.

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 68 KiB

View File

@ -0,0 +1,27 @@
# Code
Trilium supports creating "code" notes, i.e. notes which contain some sort of formal code - be it programming language (C++, JavaScript), structured data (JSON, XML) or other types of codes (CSS etc.).
This can be useful for a few things:
* computer programmers can store code snippets as notes with syntax highlighting
* JavaScript code notes can be executed inside Trilium for some extra functionality
* we call such JavaScript code notes "scripts" - see [Scripts](Code/Scripts.md)
* JSON, XML etc. can be used as storage for structured data (typically used in conjunction with scripting)
For shorter snippets of code that can be embedded in [Text](Text.md) notes, see [Code blocks](Text/Code%20blocks.md).
![](Code_image.png)
## Adjusting the language of a code note
In the [Ribbon](../Basic%20Concepts/UI%20Elements/Ribbon.md), look for the _Note type_ selector and click it to reveal the possible note types. Inside of it there will be a section called _Code_, select any one of the languages.
![](1_Code_image.png)
## Adjusting the list of languages
Trilium supports syntax highlighting for many languages, but by default displays only some of them. The supported languages can be adjusted by going to [Options](../Basic%20Concepts/UI%20Elements/Options.md), then _Code Notes_ and looking for the _Available MIME types in the dropdown_ section. Simply check any of the items to add them to the list, or un-check them to remove them from the list.
Note that the list of languages is not immediately refreshed, you'd have to manually [refresh the application](../Troubleshooting/Refreshing%20the%20application.md).
The list of languages is also shared with the [Code blocks](Text/Code%20blocks.md) feature of [Text](Text.md) notes.

View File

@ -14,7 +14,7 @@ Global events are attached to the script note via label. Simply create e.g. "run
## Entity events
Other events are bound to some entity, these are defined as [relations](../Attributes.md) - meaning that script is triggered only if note has this script attached to it through relations (or it can inherit it).
Other events are bound to some entity, these are defined as [relations](../../Advanced%20Usage/Attributes.md) - meaning that script is triggered only if note has this script attached to it through relations (or it can inherit it).
* `runOnNoteCreation` - executes when note is created on backend
* `runOnNoteTitleChange` - executes when note title is changed (includes note creation as well)

View File

@ -1,5 +1,5 @@
# Scripts
Trilium supports creating [code notes](../Code%20Notes.md), i.e. notes which allow you to store some programming code and highlight it. Special case is JavaScript code notes which can also be executed inside Trilium which can in conjunction with [Script API](Script%20API.md) provide extra functionality.
Trilium supports creating [code notes](../Code.md), i.e. notes which allow you to store some programming code and highlight it. Special case is JavaScript code notes which can also be executed inside Trilium which can in conjunction with [Script API](Script%20API.md) provide extra functionality.
## Scripting
@ -12,7 +12,7 @@ So we have frontend and backend, each with their own set of responsibilities, bu
## Button use case
Let's take a look at our demo script (shipped with default Trilium [database](../Database.md)) - Task manager. One of the things this script does is adding a button to the Trilium interface which will allow user to easily add new Task (TODO item).
Let's take a look at our demo script (shipped with default Trilium [database](../../Advanced%20Usage/Database.md)) - Task manager. One of the things this script does is adding a button to the Trilium interface which will allow user to easily add new Task (TODO item).
![](../../Attachments/button-script.png)
@ -37,13 +37,13 @@ So we have a script which will add the button to the toolbar. But how can we exe
We need to execute it every time Trilium starts up, but we probably don't want to have to manually click on play button on every start up.
The solution is marked by red circle at the bottom - this note has [label](../Attributes.md) `#run=frontendStartup` - this is one of the "system" labels which Trilium understands. As you might guess, this will cause all such labeled script notes to be executed once Trilium frontend starts up.
The solution is marked by red circle at the bottom - this note has [label](../../Advanced%20Usage/Attributes.md) `#run=frontendStartup` - this is one of the "system" labels which Trilium understands. As you might guess, this will cause all such labeled script notes to be executed once Trilium frontend starts up.
(`#run=frontendStartup` does not work for [Mobile frontend](../../Installation%20%26%20Setup/Mobile%20Frontend.md) - if you want to have scripts running there, give the script `#run=mobileStartup` label)
### More showcases
You can see more scripting with explanation in [Advanced showcases](../Advanced%20Showcases.md)
You can see more scripting with explanation in [Advanced showcases](../../Advanced%20Usage/Advanced%20Showcases.md)
## Events

View File

Before

Width:  |  Height:  |  Size: 99 KiB

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -0,0 +1,35 @@
# Code blocks
![](1_Code%20blocks_image.png)
The code blocks feature allows entering pieces of code in text notes.
Note that this feature is meant for generally small snippets of code. For larger files such as an entire log, see the dedicated [\[missing note\]](#root/pOsGYCXsbNQG/KSZ04uQ2D1St/FVuX89AJuFSw) note type instead.
## Inserting a code block
* Via the [Formatting toolbar](Formatting%20toolbar.md), look for the ![](Code%20blocks_image.png) button.
* Pressing directly on the icon will insert a code block with the language that was selected most recently. If this is the first time a code block is inserted, the language will be “Auto-detected” by default.
* Pressing the arrow next to the icon, which will show a popup with the available languages.
* Type ` ``` ` (as in Markdown).
* Note that it's not possible to specify the language, as it will default to the last selected language.
## Syntax highlighting
Since TriliumNext v0.90.12, Trilium will try to offer syntax highlighting to the code block. Note that the syntax highlighting mechanism is slightly different than the one in [Code Notes](../Code.md) notes as different technologies are involved.
When the language is set to _Auto-detected_, Trilium will try to identify the programming language (or similar) that corresponds to the given snippet of text and highlight it. If this is problematic, consider changing the language of the code block manually.
When the language is set to _Plain text_, there will be no syntax highlighting.
## Changing the language of a code block
Simply click anywhere inside the code block and press again the code block button in the [Formatting toolbar](Formatting%20toolbar.md):
![](2_Code%20blocks_image.png)
## Adjusting the list of languages
The code blocks feature shares the list of languages with the [Code Notes](../Code.md) note type.
The supported languages can be adjusted by going to [Options](../../Basic%20Concepts/UI%20Elements/Options.md), then _Code Notes_ and looking for the _Available MIME types in the dropdown_ section. Simply check any of the items to add them to the list, or uncheck them to remove them from the list.
Note that the list of languages is not immediately refreshed, you'd have to manually [refresh the application](../../Troubleshooting/Refreshing%20the%20application.md).

Binary file not shown.

After

Width:  |  Height:  |  Size: 682 B

View File

@ -0,0 +1,35 @@
# Formatting toolbar
Trilium allows two different editing experiences for text notes, based on your preference.
To do so, go to [Options](../../Basic%20Concepts/UI%20Elements/Options.md) and look for the _Text Notes_ section. There is a corresponding section called _Formatting toolbar_.
## Floating
The floating bar is a more minimalist option, in which the formatting is hidden behind two different popups.
### Block-level popup
The first popup is the block-level popup. This will appear to the left of the current paragraph you are currently editing, as a sequence of dots:
![](1_Formatting%20toolbar_image.png)
Clicking this popup will reveal the formatting options that are specific to the entire paragraph, such as setting a heading, lists, tables, etc.
![](3_Formatting%20toolbar_image.png)
### Inline popup
The inline popup appears automatically when selecting a text:
![](Formatting%20toolbar_image.png)
All the options here apply only to the selected portion of text, such as changing the font size, or making the text bold.
## Fixed
The fixed formatting offers a more traditional editing paradigm, usually useful if a lot of formatting is needed.
All the options are combined into a single toolbar that will appear as part of the [Ribbon](../../Basic%20Concepts/UI%20Elements/Ribbon.md).
![](2_Formatting%20toolbar_image.png)
By default, if the toolbar does not fit on the screen, the rest of the options will be grouped into a single option at the end. It is possible to display items on multiple lines by checking the corresponding option in the _Formatting toolbar_ section.

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

View File

@ -21,7 +21,7 @@ TRILIUM_START_NOTE_ID=root ./trilium
## Broken Script Prevents Application Startup
If a custom script causes Triliumto crash, and it is set as a startup script or in an active [custom widget](Advanced%20Usage/Code%20Notes/Custom%20Widgets.md), start Triliumin "safe mode" to prevent any custom scripts from executing:
If a custom script causes Triliumto crash, and it is set as a startup script or in an active [custom widget](Note%20Types/Code/Custom%20Widgets.md), start Triliumin "safe mode" to prevent any custom scripts from executing:
```
TRILIUM_SAFE_MODE=true ./trilium

View File

@ -0,0 +1,4 @@
# Refreshing the application
Some changes to the application will not take effect immediately and as such it might require to manually reload or refresh the application.
To do so, simply press Ctrl+Shift+R.

View File

@ -11,7 +11,7 @@
"title": "User Guide",
"notePosition": 80,
"prefix": null,
"isExpanded": false,
"isExpanded": true,
"type": "text",
"mime": "text/html",
"attributes": [],
@ -30,7 +30,7 @@
"title": "Advanced Usage",
"notePosition": 10,
"prefix": null,
"isExpanded": false,
"isExpanded": true,
"type": "text",
"mime": "text/html",
"attributes": [
@ -634,249 +634,6 @@
}
]
},
{
"isClone": false,
"noteId": "6f9hih2hXXZk",
"notePath": [
"pOsGYCXsbNQG",
"tC7s2alapj8V",
"6f9hih2hXXZk"
],
"title": "Code Notes",
"notePosition": 60,
"prefix": null,
"isExpanded": false,
"type": "text",
"mime": "text/markdown",
"attributes": [
{
"type": "relation",
"name": "internalLink",
"value": "CdNpE2pqjmI6",
"isInheritable": false,
"position": 10
},
{
"type": "label",
"name": "shareAlias",
"value": "code-notes",
"isInheritable": false,
"position": 20
}
],
"format": "html",
"dataFileName": "Code Notes.html",
"attachments": [
{
"attachmentId": "hajUVeLs3EOM",
"title": "image.png",
"role": "image",
"mime": "image/jpg",
"position": 10,
"dataFileName": "Code Notes_image.png"
},
{
"attachmentId": "OTcapNOcNaBL",
"title": "image.png",
"role": "image",
"mime": "image/jpg",
"position": 10,
"dataFileName": "1_Code Notes_image.png"
}
],
"dirFileName": "Code Notes",
"children": [
{
"isClone": false,
"noteId": "CdNpE2pqjmI6",
"notePath": [
"pOsGYCXsbNQG",
"tC7s2alapj8V",
"6f9hih2hXXZk",
"CdNpE2pqjmI6"
],
"title": "Scripts",
"notePosition": 10,
"prefix": null,
"isExpanded": false,
"type": "text",
"mime": "text/markdown",
"attributes": [
{
"type": "relation",
"name": "internalLink",
"value": "6f9hih2hXXZk",
"isInheritable": false,
"position": 10
},
{
"type": "relation",
"name": "internalLink",
"value": "GLks18SNjxmC",
"isInheritable": false,
"position": 20
},
{
"type": "relation",
"name": "internalLink",
"value": "zEY4DaJG4YT5",
"isInheritable": false,
"position": 30
},
{
"type": "relation",
"name": "internalLink",
"value": "5668rwcirq1t",
"isInheritable": false,
"position": 40
},
{
"type": "relation",
"name": "internalLink",
"value": "GPERMystNGTB",
"isInheritable": false,
"position": 50
},
{
"type": "relation",
"name": "imageLink",
"value": "DVJl4l3T8EG2",
"isInheritable": false,
"position": 60
},
{
"type": "relation",
"name": "internalLink",
"value": "wX4HbRucYSDD",
"isInheritable": false,
"position": 70
},
{
"type": "relation",
"name": "internalLink",
"value": "RDslemsQ6gCp",
"isInheritable": false,
"position": 80
},
{
"type": "label",
"name": "shareAlias",
"value": "scripts",
"isInheritable": false,
"position": 20
}
],
"format": "html",
"dataFileName": "Scripts.html",
"attachments": []
},
{
"isClone": false,
"noteId": "GLks18SNjxmC",
"notePath": [
"pOsGYCXsbNQG",
"tC7s2alapj8V",
"6f9hih2hXXZk",
"GLks18SNjxmC"
],
"title": "Script API",
"notePosition": 20,
"prefix": null,
"isExpanded": false,
"type": "text",
"mime": "text/markdown",
"attributes": [
{
"type": "label",
"name": "shareAlias",
"value": "script-api",
"isInheritable": false,
"position": 10
}
],
"format": "html",
"dataFileName": "Script API.html",
"attachments": []
},
{
"isClone": false,
"noteId": "GPERMystNGTB",
"notePath": [
"pOsGYCXsbNQG",
"tC7s2alapj8V",
"6f9hih2hXXZk",
"GPERMystNGTB"
],
"title": "Events",
"notePosition": 40,
"prefix": null,
"isExpanded": false,
"type": "text",
"mime": "text/markdown",
"attributes": [
{
"type": "relation",
"name": "internalLink",
"value": "zEY4DaJG4YT5",
"isInheritable": false,
"position": 10
},
{
"type": "relation",
"name": "internalLink",
"value": "CdNpE2pqjmI6",
"isInheritable": false,
"position": 20
},
{
"type": "label",
"name": "shareAlias",
"value": "events",
"isInheritable": false,
"position": 30
}
],
"format": "html",
"dataFileName": "Events.html",
"attachments": []
},
{
"isClone": false,
"noteId": "MgibgPcfeuGz",
"notePath": [
"pOsGYCXsbNQG",
"tC7s2alapj8V",
"6f9hih2hXXZk",
"MgibgPcfeuGz"
],
"title": "Custom Widgets",
"notePosition": 50,
"prefix": null,
"isExpanded": false,
"type": "text",
"mime": "text/markdown",
"attributes": [
{
"type": "relation",
"name": "imageLink",
"value": "3sCPPL0LEC1S",
"isInheritable": false,
"position": 10
},
{
"type": "label",
"name": "shareAlias",
"value": "custom-widget",
"isInheritable": false,
"position": 20
}
],
"format": "html",
"dataFileName": "Custom Widgets.html",
"attachments": []
}
]
},
{
"isClone": false,
"noteId": "5668rwcirq1t",
@ -1856,7 +1613,7 @@
"title": "Basic Concepts",
"notePosition": 60,
"prefix": null,
"isExpanded": false,
"isExpanded": true,
"type": "text",
"mime": "text/html",
"attributes": [
@ -1883,7 +1640,7 @@
"title": "UI Elements",
"notePosition": 10,
"prefix": null,
"isExpanded": false,
"isExpanded": true,
"type": "text",
"mime": "text/html",
"attributes": [],
@ -1944,6 +1701,71 @@
"dataFileName": "1_Global menu_image.png"
}
]
},
{
"isClone": false,
"noteId": "BlN9DFI679QC",
"notePath": [
"pOsGYCXsbNQG",
"gh7bpGYxajRS",
"Vc8PjrjAGuOp",
"BlN9DFI679QC"
],
"title": "Ribbon",
"notePosition": 20,
"prefix": null,
"isExpanded": false,
"type": "text",
"mime": "text/html",
"attributes": [
{
"type": "relation",
"name": "internalLink",
"value": "4TIF1oA4VQRO",
"isInheritable": false,
"position": 10
}
],
"format": "html",
"dataFileName": "Ribbon.html",
"attachments": [
{
"attachmentId": "JCiJ3vRhgXY9",
"title": "image.png",
"role": "image",
"mime": "image/jpg",
"position": 10,
"dataFileName": "Ribbon_image.png"
}
]
},
{
"isClone": false,
"noteId": "4TIF1oA4VQRO",
"notePath": [
"pOsGYCXsbNQG",
"gh7bpGYxajRS",
"Vc8PjrjAGuOp",
"4TIF1oA4VQRO"
],
"title": "Options",
"notePosition": 30,
"prefix": null,
"isExpanded": false,
"type": "text",
"mime": "text/html",
"attributes": [
{
"type": "label",
"name": "iconClass",
"value": "bx bx-cog",
"isInheritable": false,
"position": 10
}
],
"format": "html",
"dataFileName": "Options.html",
"attachments": []
}
]
},
@ -3427,7 +3249,7 @@
"title": "Note Types",
"notePosition": 70,
"prefix": null,
"isExpanded": false,
"isExpanded": true,
"type": "text",
"mime": "text/html",
"attributes": [
@ -3454,7 +3276,7 @@
"title": "Text",
"notePosition": 10,
"prefix": null,
"isExpanded": false,
"isExpanded": true,
"type": "text",
"mime": "text/markdown",
"attributes": [
@ -3498,6 +3320,13 @@
"name": "shareAlias",
"value": "text-notes",
"isInheritable": false,
"position": 10
},
{
"type": "label",
"name": "sorted",
"value": "",
"isInheritable": false,
"position": 20
}
],
@ -3523,6 +3352,87 @@
],
"dirFileName": "Text",
"children": [
{
"isClone": false,
"noteId": "QxEyIjRBizuC",
"notePath": [
"pOsGYCXsbNQG",
"KSZ04uQ2D1St",
"iPIMuisry3hd",
"QxEyIjRBizuC"
],
"title": "Code blocks",
"notePosition": 10,
"prefix": null,
"isExpanded": false,
"type": "text",
"mime": "text/html",
"attributes": [
{
"type": "relation",
"name": "internalLink",
"value": "nRhnJkTT8cPs",
"isInheritable": false,
"position": 20
},
{
"type": "relation",
"name": "internalLink",
"value": "4TIF1oA4VQRO",
"isInheritable": false,
"position": 30
},
{
"type": "relation",
"name": "internalLink",
"value": "s8alTXmpFR61",
"isInheritable": false,
"position": 40
},
{
"type": "label",
"name": "iconClass",
"value": "bx bx-code",
"isInheritable": false,
"position": 50
},
{
"type": "relation",
"name": "internalLink",
"value": "6f9hih2hXXZk",
"isInheritable": false,
"position": 60
}
],
"format": "html",
"dataFileName": "Code blocks.html",
"attachments": [
{
"attachmentId": "7HhhhyZ4AS0A",
"title": "image.png",
"role": "image",
"mime": "image/png",
"position": 10,
"dataFileName": "Code blocks_image.png"
},
{
"attachmentId": "DyHSLO958cdd",
"title": "image.png",
"role": "image",
"mime": "image/jpg",
"position": 10,
"dataFileName": "1_Code blocks_image.png"
},
{
"attachmentId": "kE8PPw7iyuu9",
"title": "image.png",
"role": "image",
"mime": "image/png",
"position": 10,
"dataFileName": "2_Code blocks_image.png"
}
]
},
{
"isClone": false,
"noteId": "veGu4faJErEM",
@ -3533,7 +3443,7 @@
"veGu4faJErEM"
],
"title": "Content language",
"notePosition": 10,
"notePosition": 20,
"prefix": null,
"isExpanded": false,
"type": "text",
@ -3545,6 +3455,13 @@
"value": "BMf2nEbYlcUt",
"isInheritable": false,
"position": 10
},
{
"type": "label",
"name": "iconClass",
"value": "bx bx-align-right",
"isInheritable": false,
"position": 20
}
],
"format": "html",
@ -3560,6 +3477,81 @@
}
]
},
{
"isClone": false,
"noteId": "nRhnJkTT8cPs",
"notePath": [
"pOsGYCXsbNQG",
"KSZ04uQ2D1St",
"iPIMuisry3hd",
"nRhnJkTT8cPs"
],
"title": "Formatting toolbar",
"notePosition": 30,
"prefix": null,
"isExpanded": false,
"type": "text",
"mime": "text/html",
"attributes": [
{
"type": "relation",
"name": "internalLink",
"value": "BlN9DFI679QC",
"isInheritable": false,
"position": 10
},
{
"type": "label",
"name": "iconClass",
"value": "bx bx-text",
"isInheritable": false,
"position": 20
},
{
"type": "relation",
"name": "internalLink",
"value": "4TIF1oA4VQRO",
"isInheritable": false,
"position": 30
}
],
"format": "html",
"dataFileName": "Formatting toolbar.html",
"attachments": [
{
"attachmentId": "CZ8ENj2LsBsA",
"title": "image.png",
"role": "image",
"mime": "image/jpg",
"position": 10,
"dataFileName": "Formatting toolbar_image.png"
},
{
"attachmentId": "iu9xb3VivIIl",
"title": "image.png",
"role": "image",
"mime": "image/jpg",
"position": 10,
"dataFileName": "1_Formatting toolbar_image.png"
},
{
"attachmentId": "MMeih4nJVgNk",
"title": "image.png",
"role": "image",
"mime": "image/jpg",
"position": 10,
"dataFileName": "2_Formatting toolbar_image.png"
},
{
"attachmentId": "SGaPJHzNyLLV",
"title": "image.png",
"role": "image",
"mime": "image/jpg",
"position": 10,
"dataFileName": "3_Formatting toolbar_image.png"
}
]
},
{
"isClone": false,
"noteId": "S6Xx8QIWTV66",
@ -3570,7 +3562,7 @@
"S6Xx8QIWTV66"
],
"title": "Lists",
"notePosition": 20,
"notePosition": 40,
"prefix": null,
"isExpanded": false,
"type": "text",
@ -3641,30 +3633,296 @@
},
{
"isClone": false,
"noteId": "FVuX89AJuFSw",
"noteId": "6f9hih2hXXZk",
"notePath": [
"pOsGYCXsbNQG",
"KSZ04uQ2D1St",
"FVuX89AJuFSw"
"6f9hih2hXXZk"
],
"title": "Code",
"notePosition": 30,
"notePosition": 40,
"prefix": null,
"isExpanded": false,
"isExpanded": true,
"type": "text",
"mime": "text/html",
"mime": "text/markdown",
"attributes": [
{
"type": "label",
"name": "shareAlias",
"value": "code-notes",
"isInheritable": false,
"position": 20
},
{
"type": "relation",
"name": "internalLink",
"value": "CdNpE2pqjmI6",
"isInheritable": false,
"position": 30
},
{
"type": "relation",
"name": "internalLink",
"value": "iPIMuisry3hd",
"isInheritable": false,
"position": 40
},
{
"type": "relation",
"name": "internalLink",
"value": "QxEyIjRBizuC",
"isInheritable": false,
"position": 50
},
{
"type": "relation",
"name": "internalLink",
"value": "BlN9DFI679QC",
"isInheritable": false,
"position": 60
},
{
"type": "relation",
"name": "internalLink",
"value": "4TIF1oA4VQRO",
"isInheritable": false,
"position": 70
},
{
"type": "relation",
"name": "internalLink",
"value": "s8alTXmpFR61",
"isInheritable": false,
"position": 80
},
{
"type": "label",
"name": "iconClass",
"value": "bx bx-code",
"isInheritable": false,
"position": 10
"position": 90
}
],
"format": "html",
"dataFileName": "Code.html",
"attachments": []
"attachments": [
{
"attachmentId": "hajUVeLs3EOM",
"title": "image.png",
"role": "image",
"mime": "image/jpg",
"position": 10,
"dataFileName": "Code_image.png"
},
{
"attachmentId": "iKJbcEUkME1a",
"title": "image.png",
"role": "image",
"mime": "image/jpg",
"position": 10,
"dataFileName": "1_Code_image.png"
},
{
"attachmentId": "OTcapNOcNaBL",
"title": "image.png",
"role": "image",
"mime": "image/jpg",
"position": 10,
"dataFileName": "2_Code_image.png"
}
],
"dirFileName": "Code",
"children": [
{
"isClone": false,
"noteId": "CdNpE2pqjmI6",
"notePath": [
"pOsGYCXsbNQG",
"KSZ04uQ2D1St",
"6f9hih2hXXZk",
"CdNpE2pqjmI6"
],
"title": "Scripts",
"notePosition": 10,
"prefix": null,
"isExpanded": false,
"type": "text",
"mime": "text/markdown",
"attributes": [
{
"type": "relation",
"name": "internalLink",
"value": "6f9hih2hXXZk",
"isInheritable": false,
"position": 10
},
{
"type": "relation",
"name": "internalLink",
"value": "GLks18SNjxmC",
"isInheritable": false,
"position": 20
},
{
"type": "relation",
"name": "internalLink",
"value": "zEY4DaJG4YT5",
"isInheritable": false,
"position": 30
},
{
"type": "relation",
"name": "internalLink",
"value": "5668rwcirq1t",
"isInheritable": false,
"position": 40
},
{
"type": "relation",
"name": "internalLink",
"value": "GPERMystNGTB",
"isInheritable": false,
"position": 50
},
{
"type": "relation",
"name": "imageLink",
"value": "DVJl4l3T8EG2",
"isInheritable": false,
"position": 60
},
{
"type": "relation",
"name": "internalLink",
"value": "wX4HbRucYSDD",
"isInheritable": false,
"position": 70
},
{
"type": "relation",
"name": "internalLink",
"value": "RDslemsQ6gCp",
"isInheritable": false,
"position": 80
},
{
"type": "label",
"name": "shareAlias",
"value": "scripts",
"isInheritable": false,
"position": 20
}
],
"format": "html",
"dataFileName": "Scripts.html",
"attachments": []
},
{
"isClone": false,
"noteId": "GLks18SNjxmC",
"notePath": [
"pOsGYCXsbNQG",
"KSZ04uQ2D1St",
"6f9hih2hXXZk",
"GLks18SNjxmC"
],
"title": "Script API",
"notePosition": 20,
"prefix": null,
"isExpanded": false,
"type": "text",
"mime": "text/markdown",
"attributes": [
{
"type": "label",
"name": "shareAlias",
"value": "script-api",
"isInheritable": false,
"position": 10
}
],
"format": "html",
"dataFileName": "Script API.html",
"attachments": []
},
{
"isClone": false,
"noteId": "GPERMystNGTB",
"notePath": [
"pOsGYCXsbNQG",
"KSZ04uQ2D1St",
"6f9hih2hXXZk",
"GPERMystNGTB"
],
"title": "Events",
"notePosition": 40,
"prefix": null,
"isExpanded": false,
"type": "text",
"mime": "text/markdown",
"attributes": [
{
"type": "relation",
"name": "internalLink",
"value": "zEY4DaJG4YT5",
"isInheritable": false,
"position": 10
},
{
"type": "relation",
"name": "internalLink",
"value": "CdNpE2pqjmI6",
"isInheritable": false,
"position": 20
},
{
"type": "label",
"name": "shareAlias",
"value": "events",
"isInheritable": false,
"position": 30
}
],
"format": "html",
"dataFileName": "Events.html",
"attachments": []
},
{
"isClone": false,
"noteId": "MgibgPcfeuGz",
"notePath": [
"pOsGYCXsbNQG",
"KSZ04uQ2D1St",
"6f9hih2hXXZk",
"MgibgPcfeuGz"
],
"title": "Custom Widgets",
"notePosition": 50,
"prefix": null,
"isExpanded": false,
"type": "text",
"mime": "text/markdown",
"attributes": [
{
"type": "relation",
"name": "imageLink",
"value": "3sCPPL0LEC1S",
"isInheritable": false,
"position": 10
},
{
"type": "label",
"name": "shareAlias",
"value": "custom-widget",
"isInheritable": false,
"position": 20
}
],
"format": "html",
"dataFileName": "Custom Widgets.html",
"attachments": []
}
]
},
{
"isClone": false,
@ -3675,7 +3933,7 @@
"m523cpzocqaD"
],
"title": "Saved Search",
"notePosition": 50,
"notePosition": 60,
"prefix": null,
"isExpanded": false,
"type": "text",
@ -3723,7 +3981,7 @@
"joqzSrDccPKf"
],
"title": "Relation Map",
"notePosition": 60,
"notePosition": 70,
"prefix": null,
"isExpanded": false,
"type": "text",
@ -3750,7 +4008,7 @@
"bdUJEHsAPYQR"
],
"title": "Note Map",
"notePosition": 70,
"notePosition": 80,
"prefix": null,
"isExpanded": false,
"type": "text",
@ -3777,7 +4035,7 @@
"HcABDtFCkbFN"
],
"title": "Render Note",
"notePosition": 90,
"notePosition": 100,
"prefix": null,
"isExpanded": false,
"type": "text",
@ -3804,7 +4062,7 @@
"GTwFsgaA0lCt"
],
"title": "Book",
"notePosition": 110,
"notePosition": 120,
"prefix": null,
"isExpanded": false,
"type": "text",
@ -4054,7 +4312,7 @@
"s1aBHPd79XYj"
],
"title": "Mermaid Diagrams",
"notePosition": 120,
"notePosition": 130,
"prefix": null,
"isExpanded": false,
"type": "text",
@ -4161,7 +4419,7 @@
"grjYqerjn243"
],
"title": "Canvas",
"notePosition": 140,
"notePosition": 150,
"prefix": null,
"isExpanded": false,
"type": "text",
@ -4197,7 +4455,7 @@
"1vHRoWCEjj0L"
],
"title": "Web View",
"notePosition": 150,
"notePosition": 160,
"prefix": null,
"isExpanded": false,
"type": "text",
@ -4224,7 +4482,7 @@
"gBbsAeiuUxI5"
],
"title": "Mind Map",
"notePosition": 160,
"notePosition": 170,
"prefix": null,
"isExpanded": false,
"type": "text",
@ -4251,7 +4509,7 @@
"81SGnPGMk7Xc"
],
"title": "Geo map",
"notePosition": 170,
"notePosition": 180,
"prefix": null,
"isExpanded": false,
"type": "text",
@ -6192,6 +6450,25 @@
"format": "html",
"dataFileName": "Synchronization fails with 504.html",
"attachments": []
},
{
"isClone": false,
"noteId": "s8alTXmpFR61",
"notePath": [
"pOsGYCXsbNQG",
"BgmBlOIl72jZ",
"s8alTXmpFR61"
],
"title": "Refreshing the application",
"notePosition": 60,
"prefix": null,
"isExpanded": false,
"type": "text",
"mime": "text/html",
"attributes": [],
"format": "html",
"dataFileName": "Refreshing the application.html",
"attachments": []
}
]
},

View File

@ -13,7 +13,7 @@
<h1 data-trilium-h1>Advanced Showcases</h1>
<div class="ck-content">
<p>Trilium offers advanced functionality through <a href="Code%20Notes/Scripts.html">Scripts</a> and
<p>Trilium offers advanced functionality through <a href="../Note%20Types/Code/Scripts.html">Scripts</a> and
<a
href="Attributes/Promoted%20Attributes.html">Promoted Attributes</a>. To illustrate these features, we've prepared
several showcases available in the <a href="Database.html">demo notes</a>:</p>

View File

@ -15,7 +15,7 @@
<div class="ck-content">
<p>Task Manager is a <a href="../Attributes/Promoted%20Attributes.html">promoted attributes</a> and
<a
href="../Code%20Notes/Scripts.html">scripts</a>showcase present in the <a href="../Database.html">demo notes</a>.</p>
href="../../Note%20Types/Code/Scripts.html">scripts</a>showcase present in the <a href="../Database.html">demo notes</a>.</p>
<h2>Demo</h2>
@ -42,8 +42,8 @@
<p>Task template defines several <a href="../Attributes/Promoted%20Attributes.html">promoted attributes</a> -
todoDate, doneDate, tags, location. Importantly it also defines <code>~runOnAttributeChange</code> relation
- <a href="../Code%20Notes/Events.html">event</a> handler which is run on
attribute change. This <a href="../Code%20Notes/Scripts.html">script</a> handles
- <a href="../../Note%20Types/Code/Events.html">event</a> handler which is
run on attribute change. This <a href="../../Note%20Types/Code/Scripts.html">script</a> handles
when e.g. we fill out the doneDate attribute - meaning the task is done
and should be moved to "Done" note and removed from TODO, locations and
tags.</p>
@ -74,7 +74,7 @@
<p>In the demo screenshot above you may notice that TODO tasks are in red
color and DONE tasks are green.</p>
<p>This is done by having this CSS <a href="../Code%20Notes.html">code note</a> which
<p>This is done by having this CSS <a href="../../Note%20Types/Code.html">code note</a> which
defines extra CSS classes:</p>
<pre><code class="language-text-x-trilium-auto">span.fancytree-node.todo .fancytree-title {
color: red !important;
@ -83,7 +83,7 @@
span.fancytree-node.done .fancytree-title {
color: green !important;
}</code></pre>
<p>This <a href="../Code%20Notes.html">code note</a> has <code>#appCss</code>
<p>This <a href="../../Note%20Types/Code.html">code note</a> has <code>#appCss</code>
<a
href="../Attributes.html">label</a>which is recognized by Trilium on startup and loaded as CSS into
the application.</p>

View File

@ -16,7 +16,7 @@
<p>
<img src="Weight Tracker_image.png" alt="" />
</p>
<p>The <code>Weight Tracker</code> is a <a href="../Code%20Notes/Script%20API.html">Script API</a> showcase
<p>The <code>Weight Tracker</code> is a <a href="../../Note%20Types/Code/Script%20API.html">Script API</a> showcase
present in the <a href="../Database.html">demo notes</a>.</p>
<p>By adding <code>weight</code> as a <a href="../Attributes/Promoted%20Attributes.html">promoted attribute</a> in
the <a href="../Attributes/Template.html">template</a> from which <a href="Day%20Notes.html">day notes</a> are
@ -26,11 +26,11 @@
<p>The <code>Weight Tracker</code> note in the screenshot above is of the type <code>Render Note</code>.
That type of note doesn't have any useful content itself. Instead it is
a placeholder where a <a href="../Code%20Notes/Scripts.html">script</a> can
a placeholder where a <a href="../../Note%20Types/Code/Scripts.html">script</a> can
render its output.</p>
<p>Scripts for <code>Render Notes</code> are defined in a <a href="../Attributes.html">relation</a> called <code>~renderNote</code>.
In this example, it's the <code>Weight Tracker</code>'s child <code>Implementation</code>.
The Implementation consists of two <a href="../Code%20Notes.html">code notes</a> that
The Implementation consists of two <a href="../../Note%20Types/Code.html">code notes</a> that
contain some HTML and JavaScript respectively, which load all the notes
with a <code>weight</code> attribute and display their values in a chart.</p>
<p>To actually render the chart, we're using a third party library called
@ -40,7 +40,7 @@
<h3>Code</h3>
<p>Here's the content of the script which is placed in a <a href="../Code%20Notes.html">code note</a> of
<p>Here's the content of the script which is placed in a <a href="../../Note%20Types/Code.html">code note</a> of
type <code>JS Frontend</code>:</p>
<pre><code class="language-text-x-trilium-auto">async function getChartData() {
const days = await api.runOnBackend(async () =&gt; {

View File

@ -1,53 +0,0 @@
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../../style.css">
<base target="_parent">
<title data-trilium-title>Code Notes</title>
</head>
<body>
<div class="content">
<h1 data-trilium-h1>Code Notes</h1>
<div class="ck-content">
<p>Trilium supports creating "code" notes, i.e. notes which contain some
sort of formal code - be it programming language (C++, JavaScript), structured
data (JSON, XML) or other types of codes (CSS etc.).</p>
<p>This can be useful for a few things:</p>
<ul>
<li>computer programmers can store code snippets as notes with syntax highlighting</li>
<li>JavaScript code notes can be executed inside Trilium for some extra functionality
<ul>
<li>we call such JavaScript code notes "scripts" - see <a href="Code%20Notes/Scripts.html">Scripts</a>
</li>
</ul>
</li>
<li>JSON, XML etc. can be used as storage for structured data (typically used
in conjunction with scripting)</li>
</ul>
<p>
<img src="Code Notes_image.png" alt="" />
</p>
<h2>Extra languages</h2>
<p>Trilium supports syntax highlighting for many languages, but by default
displays only some of them (to reduce the number of items). You can add
extra languages in Options -&gt; Code notes.</p>
<h2>Code blocks</h2>
<p>An alternative to the code note is a "code block" - feature of a text
note which can add short snippets of code to the text editor. Starting
with TriliumNext v0.90.12, the code blocks also support syntax highlighting.</p>
<p>
<img src="1_Code Notes_image.png" alt="" />
</p>
</div>
</div>
</body>
</html>

View File

@ -13,7 +13,7 @@
<h1 data-trilium-h1>Custom Request Handler</h1>
<div class="ck-content">
<p>Trilium provides a mechanism for <a href="Code%20Notes/Scripts.html">scripts</a> to
<p>Trilium provides a mechanism for <a href="../Note%20Types/Code/Scripts.html">scripts</a> to
open a public REST endpoint. This opens a way for various integrations
with other services - a simple example would be creating new note from
Slack by issuing a slash command (e.g. <code>/trilium buy milk</code>).</p>
@ -22,7 +22,7 @@
<p>Let's take a look at an example. The goal is to provide a REST endpoint
to which we can send title and content and Trilium will create a note.</p>
<p>We'll start with creating a JavaScript backend <a href="Code%20Notes.html">code note</a> containing:</p>
<p>We'll start with creating a JavaScript backend <a href="../Note%20Types/Code.html">code note</a> containing:</p>
<pre><code class="language-text-x-trilium-auto">const {req, res} = api;
const {secret, title, content} = req.body;
@ -74,7 +74,7 @@ Content-Type: application/json
and you need to take care of this yourself.</p>
<p>Once we pass these checks we will just create the desired note using
<a
href="Code%20Notes/Script%20API.html">Script API</a>.</p>
href="../Note%20Types/Code/Script%20API.html">Script API</a>.</p>
<h2>Custom resource provider</h2>

View File

@ -82,7 +82,7 @@
<p>The default shared page is basic in design, but you can customize it using
your own CSS:</p>
<ul>
<li><strong>Custom CSS</strong>: Link a CSS <a href="Code%20Notes.html">code note</a> to
<li><strong>Custom CSS</strong>: Link a CSS <a href="../Note%20Types/Code.html">code note</a> to
the shared page by adding a <code>~shareCss</code> relation to the note.
If you want this style to apply to the entire subtree, make the label inheritable.
You can hide the CSS code note from the tree navigation by adding the <code>#shareHiddenFromTree</code> label.</li>

View File

@ -91,8 +91,8 @@
<h2>Editing notes</h2>
<p>Trilium uses CKEditor 5 for the <a href="../Note%20Types/Text.html">text notes</a> and
CodeMirror 5 for <a href="../Advanced%20Usage/Code%20Notes.html">code notes</a>.
Check the documentation of these projects to see all their built-in keyboard
CodeMirror 5 for <a href="../Note%20Types/Code.html">code notes</a>. Check
the documentation of these projects to see all their built-in keyboard
shortcuts.</p>
<ul>
<li><code>ALT-F10</code> - bring up inline formatting toolbar (arrow keys <code>&lt;-</code>,<code>-&gt;</code> to

View File

@ -21,13 +21,13 @@
<ul>
<li><a href="../Note%20Types/Text.html">text note</a> - this is default note
type which allows you to put rich text, images etc.</li>
<li><a href="../Advanced%20Usage/Code%20Notes.html">code note</a> - some kind
of formal code, typically programming language (e.g. JavaScript) or data
structure (e.g. JSON)</li>
<li><a href="../Note%20Types/Code.html">code note</a> - some kind of formal
code, typically programming language (e.g. JavaScript) or data structure
(e.g. JSON)</li>
<li><a href="https://github.com/TriliumNext/Notes/wiki/Images">image note</a> -
represents single image</li>
<li>file note - represents uploaded file (e.g. docx MS Word document).</li>
<li>render HTML note - this works as an output screen of attached <a href="../Advanced%20Usage/Code%20Notes/Scripts.html">scripts</a>
<li>render HTML note - this works as an output screen of attached <a href="../Note%20Types/Code/Scripts.html">scripts</a>
</li>
<li><a href="../Note%20Types/Saved%20Search.html">saved search</a> note - contains
saved search query and dynamically displays result of the search as its

View File

@ -16,7 +16,7 @@
<p>A <a href="../Note.html">note</a> in Trilium can <em>own</em> one or more
attachments, which can be either images or files. These attachments can
be displayed or linked within the note that owns them.</p>
<p>This can be especially useful to include dependencies for your <a href="../../Advanced%20Usage/Code%20Notes/Scripts.html">scripts</a>.
<p>This can be especially useful to include dependencies for your <a href="../../Note%20Types/Code/Scripts.html">scripts</a>.
The <a href="../../Advanced%20Usage/Advanced%20Showcases/Weight%20Tracker.html">Weight Tracker</a> shows
how to use <a href="https://chartjs.org/">chartjs</a> which is attached to
the <a href="#root/HcUYTojFohtb">script note</a>.</p>

View File

@ -13,7 +13,7 @@
<h1 data-trilium-h1>Read-Only Notes</h1>
<div class="ck-content">
<p>Both <a href="../../Note%20Types/Text.html">text</a> and <a href="../../Advanced%20Usage/Code%20Notes.html">code</a> notes
<p>Both <a href="../../Note%20Types/Text.html">text</a> and <a href="../../Note%20Types/Code.html">code</a> notes
in Trilium can be set to read-only. When a note is in read-only mode, it
is presented to the user in a non-editable view, with the option to switch
to editing mode if needed.</p>

View File

@ -28,7 +28,7 @@
<p>Trilium supports custom user themes, allowing you to personalize the application's
appearance. To create a custom theme, follow these steps:</p>
<ol>
<li><strong>Create a CSS Code Note</strong>: Start by creating a new <a href="../Advanced%20Usage/Code%20Notes.html">code note</a> with
<li><strong>Create a CSS Code Note</strong>: Start by creating a new <a href="../Note%20Types/Code.html">code note</a> with
the <code>CSS</code> type.</li>
<li><strong>Annotate with</strong> <code>**#appTheme**</code>: Add the <a href="../Advanced%20Usage/Attributes.html">attribute</a> <code>#appTheme=my-theme-name</code> to
your note, where <code>my-theme-name</code> is the name of your custom theme.</li>
@ -122,7 +122,7 @@ body .CodeMirror {
<p>To use custom CSS:</p>
<ol>
<li><strong>Create a CSS Code Note</strong>: Create a new <a href="../Advanced%20Usage/Code%20Notes.html">code note</a> with
<li><strong>Create a CSS Code Note</strong>: Create a new <a href="../Note%20Types/Code.html">code note</a> with
the <code>CSS</code> type.</li>
<li><strong>Add the</strong> <code>**appCss**</code> <strong>Label</strong>:
Annotate the note with the <code>#appCss</code> <a href="../Advanced%20Usage/Attributes.html">label</a>.</li>

View File

@ -0,0 +1,19 @@
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../../../style.css">
<base target="_parent">
<title data-trilium-title>Options</title>
</head>
<body>
<div class="content">
<h1 data-trilium-h1>Options</h1>
<div class="ck-content"></div>
</div>
</body>
</html>

View File

@ -0,0 +1,30 @@
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../../../style.css">
<base target="_parent">
<title data-trilium-title>Ribbon</title>
</head>
<body>
<div class="content">
<h1 data-trilium-h1>Ribbon</h1>
<div class="ck-content">
<figure class="image">
<img style="aspect-ratio:1073/202;" src="Ribbon_image.png" width="1073"
height="202">
</figure>
<p>The ribbon allows changing options, attributes and viewing information
about the current note.</p>
<h2>Settings</h2>
<p>It is possible to change whether some ribbon items will be automatically
open when navigating to a new note. To do so, in&nbsp;<a class="reference-link"
href="Options.html">Settings</a>, go to <i>Appearance</i> and look for the <i>Ribbon widgets</i> section.</p>
</div>
</div>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -19,7 +19,7 @@
the current app and note context, and widgets that export an object to
Trilium to be used in the UI. In both cases, the frontend api of Trilium
is available to scripts running in the frontend context as global variable <code>api</code>.
The members and methods of the api can be seen on the <a href="../Advanced%20Usage/Code%20Notes/Script%20API.html">Script API</a> page.</p>
The members and methods of the api can be seen on the <a href="../Note%20Types/Code/Script%20API.html">Script API</a> page.</p>
<h2>Scripts</h2>

View File

@ -96,7 +96,7 @@ module.exports = new MyWidget();</code></pre>
<h3>Step 4: Adding User Interaction</h3>
<p>Lets make the button interactive by showing a message when its clicked.
We'll use the <code>api.showMessage</code> method from the <a href="../Advanced%20Usage/Code%20Notes/Script%20API.html">Script API</a>.</p>
We'll use the <code>api.showMessage</code> method from the <a href="../Note%20Types/Code/Script%20API.html">Script API</a>.</p>
<pre><code class="language-text-x-trilium-auto">class MyWidget extends api.BasicWidget {
get position() { return 1; }
get parentWidget() { return "left-pane"; }

View File

@ -52,7 +52,7 @@
<li>the assumption that only single person has access to the app simplifies
many things, or just outright makes them possible. In multi-user app, our
<a
href="Advanced%20Usage/Code%20Notes/Scripts.html">scripting</a>support would be a XSS security hole, while with the single
href="Note%20Types/Code/Scripts.html">scripting</a>support would be a XSS security hole, while with the single
user assumption it's an endless customizable tool.</li>
</ul>

View File

@ -59,7 +59,7 @@
<h2>Scripting</h2>
<p>You can alter the behavior with <a href="../Advanced%20Usage/Code%20Notes/Scripts.html">scripts</a> just
<p>You can alter the behavior with <a href="../Note%20Types/Code/Scripts.html">scripts</a> just
like for normal frontend. For script notes to be executed, they need to
have labeled <code>#run=mobileStartup</code>.</p>
</div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -12,7 +12,51 @@
<div class="content">
<h1 data-trilium-h1>Code</h1>
<div class="ck-content"></div>
<div class="ck-content">
<p>Trilium supports creating "code" notes, i.e. notes which contain some
sort of formal code - be it programming language (C++, JavaScript), structured
data (JSON, XML) or other types of codes (CSS etc.).</p>
<p>This can be useful for a few things:</p>
<ul>
<li>computer programmers can store code snippets as notes with syntax highlighting</li>
<li>JavaScript code notes can be executed inside Trilium for some extra functionality
<ul>
<li>we call such JavaScript code notes "scripts" - see <a href="Code/Scripts.html">Scripts</a>
</li>
</ul>
</li>
<li>JSON, XML etc. can be used as storage for structured data (typically used
in conjunction with scripting)</li>
</ul>
<p>For shorter snippets of code that can be embedded in&nbsp;<a class="reference-link"
href="Text.html">Text</a>&nbsp;notes, see&nbsp;<a class="reference-link"
href="Text/Code%20blocks.html">Code blocks</a>.</p>
<figure class="image">
<img style="aspect-ratio:910/703;" src="Code_image.png" alt="" width="910"
height="703">
</figure>
<h2>Adjusting the language of a code note</h2>
<p>In the&nbsp;<a class="reference-link" href="../Basic%20Concepts/UI%20Elements/Ribbon.html">Ribbon</a>,
look for the <i>Note type</i> selector and click it to reveal the possible
note types. Inside of it there will be a section called <i>Code</i>, select
any one of the languages.</p>
<p>
<img src="1_Code_image.png" width="254" height="400">
</p>
<h2>Adjusting the list of languages</h2>
<p>Trilium supports syntax highlighting for many languages, but by default
displays only some of them. The supported languages can be adjusted by
going to&nbsp;<a class="reference-link" href="../Basic%20Concepts/UI%20Elements/Options.html">Options</a>,
then <i>Code Notes</i> and looking for the <i>Available MIME types in the dropdown</i> section.
Simply check any of the items to add them to the list, or un-check them
to remove them from the list.</p>
<p>Note that the list of languages is not immediately refreshed, you'd have
to manually <a href="../Troubleshooting/Refreshing%20the%20application.html">refresh the application</a>.</p>
<p>The list of languages is also shared with the&nbsp;<a class="reference-link"
href="Text/Code%20blocks.html">Code blocks</a>&nbsp;feature of&nbsp;
<a
class="reference-link" href="Text.html">Text</a>&nbsp;notes.</p>
</div>
</div>
</body>

View File

@ -36,7 +36,7 @@
<h2>Entity events</h2>
<p>Other events are bound to some entity, these are defined as <a href="../Attributes.html">relations</a> -
<p>Other events are bound to some entity, these are defined as <a href="../../Advanced%20Usage/Attributes.html">relations</a> -
meaning that script is triggered only if note has this script attached
to it through relations (or it can inherit it).</p>
<ul>

View File

@ -13,10 +13,10 @@
<h1 data-trilium-h1>Scripts</h1>
<div class="ck-content">
<p>Trilium supports creating <a href="../Code%20Notes.html">code notes</a>,
i.e. notes which allow you to store some programming code and highlight
it. Special case is JavaScript code notes which can also be executed inside
Trilium which can in conjunction with <a href="Script%20API.html">Script API</a> provide
<p>Trilium supports creating <a href="../Code.html">code notes</a>, i.e. notes
which allow you to store some programming code and highlight it. Special
case is JavaScript code notes which can also be executed inside Trilium
which can in conjunction with <a href="Script%20API.html">Script API</a> provide
extra functionality.</p>
<h2>Scripting</h2>
@ -36,7 +36,7 @@
<h2>Button use case</h2>
<p>Let's take a look at our demo script (shipped with default Trilium <a href="../Database.html">database</a>)
<p>Let's take a look at our demo script (shipped with default Trilium <a href="../../Advanced%20Usage/Database.html">database</a>)
- Task manager. One of the things this script does is adding a button to
the Trilium interface which will allow user to easily add new Task (TODO
item).</p>
@ -74,7 +74,7 @@
by Trilium runtime so when we restart Trilium, button won't be there.</p>
<p>We need to execute it every time Trilium starts up, but we probably don't
want to have to manually click on play button on every start up.</p>
<p>The solution is marked by red circle at the bottom - this note has <a href="../Attributes.html">label</a> <code>#run=frontendStartup</code> -
<p>The solution is marked by red circle at the bottom - this note has <a href="../../Advanced%20Usage/Attributes.html">label</a> <code>#run=frontendStartup</code> -
this is one of the "system" labels which Trilium understands. As you might
guess, this will cause all such labeled script notes to be executed once
Trilium frontend starts up.</p>
@ -83,7 +83,7 @@
<h3>More showcases</h3>
<p>You can see more scripting with explanation in <a href="../Advanced%20Showcases.html">Advanced showcases</a>
<p>You can see more scripting with explanation in <a href="../../Advanced%20Usage/Advanced%20Showcases.html">Advanced showcases</a>
</p>
<h2>Events</h2>

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -0,0 +1,78 @@
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../../../style.css">
<base target="_parent">
<title data-trilium-title>Code blocks</title>
</head>
<body>
<div class="content">
<h1 data-trilium-h1>Code blocks</h1>
<div class="ck-content">
<figure class="image">
<img style="aspect-ratio:1078/307;" src="1_Code blocks_image.png" width="1078"
height="307">
</figure>
<p>The code blocks feature allows entering pieces of code in text notes.</p>
<p>Note that this feature is meant for generally small snippets of code.
For larger files such as an entire log, see the dedicated&nbsp;<a class="reference-link"
href="#root/pOsGYCXsbNQG/KSZ04uQ2D1St/FVuX89AJuFSw">[missing note]</a>&nbsp;note
type instead.</p>
<h2>Inserting a code block</h2>
<ul>
<li>Via the&nbsp;<a class="reference-link" href="Formatting%20toolbar.html">Formatting toolbar</a>,
look for the
<img src="Code blocks_image.png" width="46" height="33">button.
<ul>
<li>Pressing directly on the icon will insert a code block with the language
that was selected most recently. If this is the first time a code block
is inserted, the language will be “Auto-detected” by default.</li>
<li>Pressing the arrow next to the icon, which will show a popup with the
available languages.</li>
</ul>
</li>
<li>Type <code>```</code> (as in Markdown).
<ul>
<li>Note that it's not possible to specify the language, as it will default
to the last selected language.</li>
</ul>
</li>
</ul>
<h2>Syntax highlighting</h2>
<p>Since TriliumNext v0.90.12, Trilium will try to offer syntax highlighting
to the code block. Note that the syntax highlighting mechanism is slightly
different than the one in&nbsp;<a class="reference-link" href="../Code.html">Code Notes</a>&nbsp;notes
as different technologies are involved.</p>
<p>When the language is set to <i>Auto-detected</i>, Trilium will try to identify
the programming language (or similar) that corresponds to the given snippet
of text and highlight it. If this is problematic, consider changing the
language of the code block manually.</p>
<p>When the language is set to <i>Plain text</i>, there will be no syntax
highlighting.</p>
<h2>Changing the language of a code block</h2>
<p>Simply click anywhere inside the code block and press again the code block
button in the&nbsp;<a class="reference-link" href="Formatting%20toolbar.html">Formatting toolbar</a>:
<br>
<img src="2_Code blocks_image.png" width="183" height="156">
</p>
<h2>Adjusting the list of languages</h2>
<p>The code blocks feature shares the list of languages with the&nbsp;
<a
class="reference-link" href="../Code.html">Code Notes</a>&nbsp;note type.</p>
<p>The supported languages can be adjusted by going to&nbsp;<a class="reference-link"
href="../../Basic%20Concepts/UI%20Elements/Options.html">Options</a>, then <i>Code Notes</i> and
looking for the <i>Available MIME types in the dropdown</i> section. Simply
check any of the items to add them to the list, or uncheck them to remove
them from the list.</p>
<p>Note that the list of languages is not immediately refreshed, you'd have
to manually <a href="../../Troubleshooting/Refreshing%20the%20application.html">refresh the application</a>.</p>
<p>&nbsp;</p>
</div>
</div>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 682 B

View File

@ -0,0 +1,60 @@
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../../../style.css">
<base target="_parent">
<title data-trilium-title>Formatting toolbar</title>
</head>
<body>
<div class="content">
<h1 data-trilium-h1>Formatting toolbar</h1>
<div class="ck-content">
<p>Trilium allows two different editing experiences for text notes, based
on your preference.</p>
<p>To do so, go to&nbsp;<a class="reference-link" href="../../Basic%20Concepts/UI%20Elements/Options.html">Options</a>&nbsp;and
look for the <i>Text Notes</i> section. There is a corresponding section
called <i>Formatting toolbar</i>.</p>
<h2>Floating</h2>
<p>The floating bar is a more minimalist option, in which the formatting
is hidden behind two different popups.</p>
<h3>Block-level popup</h3>
<p>The first popup is the block-level popup. This will appear to the left
of the current paragraph you are currently editing, as a sequence of dots:
<br>
<img src="1_Formatting toolbar_image.png" width="281" height="35">
</p>
<p>Clicking this popup will reveal the formatting options that are specific
to the entire paragraph, such as setting a heading, lists, tables, etc.</p>
<p>
<img src="3_Formatting toolbar_image.png" width="682" height="104">
</p>
<h3>Inline popup</h3>
<p>The inline popup appears automatically when selecting a text:</p>
<p>
<img src="Formatting toolbar_image.png" width="552" height="99">
</p>
<p>All the options here apply only to the selected portion of text, such
as changing the font size, or making the text bold.</p>
<h2>Fixed</h2>
<p>The fixed formatting offers a more traditional editing paradigm, usually
useful if a lot of formatting is needed.</p>
<p>All the options are combined into a single toolbar that will appear as
part of the&nbsp;<a class="reference-link" href="../../Basic%20Concepts/UI%20Elements/Ribbon.html">Ribbon</a>.</p>
<figure
class="image">
<img style="aspect-ratio:913/162;" src="2_Formatting toolbar_image.png"
width="913" height="162">
</figure>
<p>By default, if the toolbar does not fit on the screen, the rest of the
options will be grouped into a single option at the end. It is possible
to display items on multiple lines by checking the corresponding option
in the <i>Formatting toolbar</i> section.</p>
</div>
</div>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

View File

@ -37,7 +37,7 @@
<h2>Broken Script Prevents Application Startup</h2>
<p>If a custom script causes Triliumto crash, and it is set as a startup
script or in an active <a href="Advanced%20Usage/Code%20Notes/Custom%20Widgets.html">custom widget</a>,
script or in an active <a href="Note%20Types/Code/Custom%20Widgets.html">custom widget</a>,
start Triliumin "safe mode" to prevent any custom scripts from executing:</p>
<pre><code class="language-text-x-trilium-auto">TRILIUM_SAFE_MODE=true ./trilium</code></pre>
<p>Depending on your Trilium distribution, you may have pre-made scripts

View File

@ -0,0 +1,23 @@
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../../style.css">
<base target="_parent">
<title data-trilium-title>Refreshing the application</title>
</head>
<body>
<div class="content">
<h1 data-trilium-h1>Refreshing the application</h1>
<div class="ck-content">
<p>Some changes to the application will not take effect immediately and as
such it might require to manually reload or refresh the application.</p>
<p>To do so, simply press Ctrl+Shift+R.</p>
</div>
</div>
</body>
</html>

View File

@ -34,20 +34,6 @@
</li>
</ul>
</li>
<li><a href="User%20Guide/Advanced%20Usage/Code%20Notes.html" target="detail">Code Notes</a>
<ul>
<li><a href="User%20Guide/Advanced%20Usage/Code%20Notes/Scripts.html" target="detail">Scripts</a>
</li>
<li><a href="User%20Guide/Advanced%20Usage/Code%20Notes/Script%20API.html"
target="detail">Script API</a>
</li>
<li><a href="User%20Guide/Advanced%20Usage/Code%20Notes/Events.html" target="detail">Events</a>
</li>
<li><a href="User%20Guide/Advanced%20Usage/Code%20Notes/Custom%20Widgets.html"
target="detail">Custom Widgets</a>
</li>
</ul>
</li>
<li><a href="User%20Guide/Advanced%20Usage/Advanced%20Showcases.html" target="detail">Advanced Showcases</a>
<ul>
<li><a href="User%20Guide/Advanced%20Usage/Advanced%20Showcases/Day%20Notes.html"
@ -101,6 +87,10 @@
<li><a href="User%20Guide/Basic%20Concepts/UI%20Elements/Global%20menu.html"
target="detail">Global menu</a>
</li>
<li><a href="User%20Guide/Basic%20Concepts/UI%20Elements/Ribbon.html" target="detail">Ribbon</a>
</li>
<li><a href="User%20Guide/Basic%20Concepts/UI%20Elements/Options.html" target="detail">Options</a>
</li>
</ul>
</li>
<li><a href="User%20Guide/Basic%20Concepts/Note.html" target="detail">Note</a>
@ -183,13 +173,27 @@
<ul>
<li><a href="User%20Guide/Note%20Types/Text.html" target="detail">Text</a>
<ul>
<li><a href="User%20Guide/Note%20Types/Text/Code%20blocks.html" target="detail">Code blocks</a>
</li>
<li><a href="User%20Guide/Note%20Types/Text/Content%20language.html" target="detail">Content language</a>
</li>
<li><a href="User%20Guide/Note%20Types/Text/Formatting%20toolbar.html" target="detail">Formatting toolbar</a>
</li>
<li><a href="User%20Guide/Note%20Types/Text/Lists.html" target="detail">Lists</a>
</li>
</ul>
</li>
<li><a href="User%20Guide/Note%20Types/Code.html" target="detail">Code</a>
<ul>
<li><a href="User%20Guide/Note%20Types/Code/Scripts.html" target="detail">Scripts</a>
</li>
<li><a href="User%20Guide/Note%20Types/Code/Script%20API.html" target="detail">Script API</a>
</li>
<li><a href="User%20Guide/Note%20Types/Code/Events.html" target="detail">Events</a>
</li>
<li><a href="User%20Guide/Note%20Types/Code/Custom%20Widgets.html" target="detail">Custom Widgets</a>
</li>
</ul>
</li>
<li><a href="User%20Guide/Note%20Types/Saved%20Search.html" target="detail">Saved Search</a>
</li>
@ -353,6 +357,9 @@
<li><a href="User%20Guide/Troubleshooting/Synchronization%20fails%20with%20504.html"
target="detail">Synchronization fails with 504 Gateway Timeout</a>
</li>
<li><a href="User%20Guide/Troubleshooting/Refreshing%20the%20application.html"
target="detail">Refreshing the application</a>
</li>
</ul>
</li>
<li>Attachments