Skip to content

Build your personal knowledge base with Trilium Notes

custom task states: add documentation for the hidden tree

Adorian Doran90cf6a82eae0
diff --git a/apps/server/src/assets/doc_notes/en/task_state.html b/apps/server/src/assets/doc_notes/en/task_state.html
new file mode 100644
index 0000000000..fce0fafc34
--- /dev/null
+++ b/apps/server/src/assets/doc_notes/en/task_state.html
@@ -0,0 +1,13 @@
+<p>This note defines a to-do task state. The note's icon is displayed inside checkboxes to represent this state, and the note's title serves as its display name.</p>
+
+<p>The state is configured through the following promoted attributes:</p>
+
+<ul>
+ <li><code>Identifier</code> — required. The internal name stored as metadata within the note markup. Only letters, digits, <code>-</code> and <code>_</code> are permitted. Examples: <code>postponed</code>, <code>awaiting-feedback</code>, <code>validated</code>.</li>
+ <li><code>Markdown symbol</code> — the single character used to represent the state when exporting to Markdown; for example, <code>/</code> produces <code>- [/]</code>.</li>
+ <li><code>Counts as completed</code> — when enabled, a task in this state is treated as completed.</li>
+ <li><code>Color</code> — the checkbox color for this state.</li>
+ <li><code>Hidden from toolbar</code> — when enabled, the state is excluded from the state list and the keyboard cycle. Notes already using it continue to render correctly.</li>
+</ul>
+
+<p class="admonition warning">Changes take effect after the application is reloaded.</p>
diff --git a/apps/server/src/assets/doc_notes/en/task_states.html b/apps/server/src/assets/doc_notes/en/task_states.html
new file mode 100644
index 0000000000..dc78f575a9
--- /dev/null
+++ b/apps/server/src/assets/doc_notes/en/task_states.html
@@ -0,0 +1,5 @@
+<p>This note contains the task states available for to-do checkboxes in the text editor. Each child note represents a single state.</p>
+
+<p>States can be added, modified, reordered, or removed. To add a new state, create a child note and configure its promoted attributes.</p>
+
+<p class="admonition warning">Changes take effect after the application is reloaded.</p>
diff --git a/packages/trilium-core/src/services/hidden_subtree.ts b/packages/trilium-core/src/services/hidden_subtree.ts
index d7aa408fd8..0b76190085 100644
--- a/packages/trilium-core/src/services/hidden_subtree.ts
+++ b/packages/trilium-core/src/services/hidden_subtree.ts
@@ -96,7 +96,11 @@ function buildHiddenSubtreeDefinition(helpSubtree: HiddenSubtreeItem[]): HiddenS
{ type: "label", name: "child:label:markdownSymbol", value: `promoted,single,text,alias=${t("hidden-subtree.task-state-attr-markdown-symbol")}` },
{ type: "label", name: "child:label:isCompleted", value: `promoted,single,boolean,alias=${t("hidden-subtree.task-state-attr-is-completed")}` },
{ type: "label", name: "child:label:color", value: `promoted,single,color,alias=${t("hidden-subtree.task-state-attr-color")}` },
- { type: "label", name: "child:label:isHidden", value: `promoted,single,boolean,alias=${t("hidden-subtree.task-state-attr-is-hidden")}` }
+ { type: "label", name: "child:label:isHidden", value: `promoted,single,boolean,alias=${t("hidden-subtree.task-state-attr-is-hidden")}` },
+ // Documentation: `docName` for this container, `child:docName` is
+ // copied onto every state note (anchors, seeded and user-created).
+ { type: "label", name: "docName", value: "task_states" },
+ { type: "label", name: "child:docName", value: "task_state" }
],
// Non-customizable anchor states — recreated if missing; they only
// determine where `none`/`done` sit in the toolbar/cycling order.
diff --git a/packages/trilium-core/src/services/task_states.ts b/packages/trilium-core/src/services/task_states.ts
index 16b77cc054..6003c42c6a 100644
--- a/packages/trilium-core/src/services/task_states.ts
+++ b/packages/trilium-core/src/services/task_states.ts
@@ -59,7 +59,7 @@ export function createTaskStateNote(state: TaskStateDef, options: {noteId?: stri
const {note} = noteService.createNewNote({
noteId: options.noteId,
title: options.title ?? state.title,
- type: "text",
+ type: "doc",
parentNoteId: TASK_STATES_CONTAINER_ID,
content: "",
ignoreForbiddenParents: true