Skip to content

Build your personal knowledge base with Trilium Notes

client/AI chat: include collapsible blocks in the formatting instructions

Adorian Doran1a784d86ef6a
diff --git a/apps/server/src/services/llm/providers/base_provider.spec.ts b/apps/server/src/services/llm/providers/base_provider.spec.ts
index dae18ef397..7b5229eb46 100644
--- a/apps/server/src/services/llm/providers/base_provider.spec.ts
+++ b/apps/server/src/services/llm/providers/base_provider.spec.ts
@@ -302,6 +302,7 @@ describe("BaseProvider system prompt", () => {
expect(prompt).toContain("Mermaid diagrams");
expect(prompt).toContain("Blockquotes");
expect(prompt).toContain("Tables");
+ expect(prompt).toContain("Collapsible blocks");
});
});
diff --git a/apps/server/src/services/llm/providers/base_provider.ts b/apps/server/src/services/llm/providers/base_provider.ts
index 78e5f71e97..28c61da86f 100644
--- a/apps/server/src/services/llm/providers/base_provider.ts
+++ b/apps/server/src/services/llm/providers/base_provider.ts
@@ -252,6 +252,8 @@ export abstract class BaseProvider implements LlmProvider {
+ "```mermaid\ngraph LR\n A --> B\n```\n\n"
+ `**Code blocks** — use fenced code blocks with a language tag for syntax highlighting (e.g. \`\`\`js, \`\`\`python).\n\n`
+ `**Tables** — GitHub-style pipe tables: a header row, a \`---\` separator row, then the data rows.\n\n`
+ + `**Collapsible blocks** — use the standard HTML \`<details>\`/\`<summary>\` form; the \`<summary>\` is the always-visible title. Placed back-to-back with nothing between them, consecutive collapsible blocks are grouped into an accordion — handy when presenting several options or alternatives the user can expand one at a time. Example:\n`
+ + `<details><summary>Option A</summary>\nDetails about the first option.\n</details>\n<details><summary>Option B</summary>\nDetails about the second option.\n</details>\n\n`
+ `**Footnotes** — use \`[^1]\` in text and \`[^1]: explanation\` at the bottom.\n\n`
+ `**Task lists** — use \`- [ ]\` for unchecked and \`- [x]\` for checked items.`
);