Skip to content

Build your personal knowledge base with Trilium Notes

feat(docs): show the API reference at full content width

Elian Dorand61a4a820155
diff --git a/apps/edit-docs/src/help_meta_generator.spec.ts b/apps/edit-docs/src/help_meta_generator.spec.ts
index 8e46c42914..1940fd9ff0 100644
--- a/apps/edit-docs/src/help_meta_generator.spec.ts
+++ b/apps/edit-docs/src/help_meta_generator.spec.ts
@@ -119,6 +119,20 @@ describe("buildHelpMeta", () => {
expect(labelOf(items[0], "webViewSrc")).toBe("https://docs.triliumnotes.org/user-guide/embedded");
});
+ it("keeps the full content width of a page", () => {
+ const page = (noteId: string, attributes: NoteMeta["attributes"]): NoteMeta => ({
+ isClone: false, noteId, title: noteId, type: "text", mime: "text/html",
+ attributes, format: "markdown", dataFileName: `${noteId}.md`, children: []
+ });
+ const wide = page("wide", [{ type: "label", name: "fullContentWidth", value: "", isInheritable: false, position: 10 }]);
+ const narrow = page("narrow", []);
+
+ const { meta: items } = buildHelpMeta(metaFileOf([ wide, narrow ]));
+
+ expect(items[0]?.attributes?.find((a) => a.name === "fullContentWidth")).toBeDefined();
+ expect(items[1]?.attributes?.find((a) => a.name === "fullContentWidth")).toBeUndefined();
+ });
+
it("keeps the mime of code notes so their content is not treated as markdown", () => {
const script: NoteMeta = {
isClone: false, noteId: "script", title: "Example", type: "code", mime: "application/javascript;env=backend",
diff --git a/apps/edit-docs/src/help_meta_generator.ts b/apps/edit-docs/src/help_meta_generator.ts
index dad9eb7915..9f49dd091b 100644
--- a/apps/edit-docs/src/help_meta_generator.ts
+++ b/apps/edit-docs/src/help_meta_generator.ts
@@ -133,6 +133,10 @@ function parseNoteMeta(
value: absolutiseUrl(attribute.value, baseUrl)
});
}
+
+ if (attribute.type === "label" && attribute.name === "fullContentWidth") {
+ attributes.push({ type: "label", name: "fullContentWidth", value: attribute.value });
+ }
}
if (shareAlias && currentUrl) {
diff --git a/apps/server/src/assets/help/help_meta.json b/apps/server/src/assets/help/help_meta.json
index 08b982b6ad..459b5774e7 100644
--- a/apps/server/src/assets/help/help_meta.json
+++ b/apps/server/src/assets/help/help_meta.json
@@ -270,7 +270,7 @@
{"id":"_help_J5Ex1ZrMbyJ6","title":"Custom Request Handler","type":"text","attributes":[{"type":"label","name":"docUrl","value":"https://docs.triliumnotes.org/user-guide/advanced-usage/custom-request-handler"},{"type":"label","name":"iconClass","value":"bx bx-globe"}]},
{"id":"_help_d3fAXQ2diepH","title":"Custom Resource Providers","type":"text","attributes":[{"type":"label","name":"docUrl","value":"https://docs.triliumnotes.org/user-guide/advanced-usage/custom-resource-providers"},{"type":"label","name":"iconClass","value":"bx bxs-file-plus"}]},
{"id":"_help_pgxEVkzLl1OP","title":"ETAPI (REST API)","type":"text","attributes":[{"type":"label","name":"docUrl","value":"https://docs.triliumnotes.org/user-guide/advanced-usage/etapi"},{"type":"label","name":"iconClass","value":"bx bx-extension"}],"children":[
- {"id":"_help_9qPsTWBorUhQ","title":"API Reference","type":"text","attributes":[{"type":"label","name":"docUrl","value":"https://docs.triliumnotes.org/user-guide/advanced-usage/etapi/api-reference"},{"type":"label","name":"iconClass","value":"bx bx-book-content"}]}
+ {"id":"_help_9qPsTWBorUhQ","title":"API Reference","type":"text","attributes":[{"type":"label","name":"fullContentWidth","value":""},{"type":"label","name":"docUrl","value":"https://docs.triliumnotes.org/user-guide/advanced-usage/etapi/api-reference"},{"type":"label","name":"iconClass","value":"bx bx-book-content"}]}
]},
{"id":"_help_47ZrP6FNuoG8","title":"Default Note Title","type":"text","attributes":[{"type":"label","name":"docUrl","value":"https://docs.triliumnotes.org/user-guide/advanced-usage/default-note-title"},{"type":"label","name":"iconClass","value":"bx bx-edit-alt"}]},
{"id":"_help_wX4HbRucYSDD","title":"Database","type":"text","attributes":[{"type":"label","name":"docUrl","value":"https://docs.triliumnotes.org/user-guide/advanced-usage/database"},{"type":"label","name":"iconClass","value":"bx bx-data"}],"children":[
diff --git a/docs/User Guide/!!!meta.json b/docs/User Guide/!!!meta.json
index 9a3d88cd0e..fbb35944d1 100644
--- a/docs/User Guide/!!!meta.json
+++ b/docs/User Guide/!!!meta.json
@@ -9825,6 +9825,13 @@
"value": "api-reference",
"isInheritable": false,
"position": 20
+ },
+ {
+ "type": "label",
+ "name": "fullContentWidth",
+ "value": "",
+ "isInheritable": false,
+ "position": 30
}
],
"format": "markdown",