Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(attributes): explain every attribute Trilium reads for itself
Elian Doranea2f1ea66274
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.jsonindex 2af81f07b0..abd914a8ff 100644--- a/apps/client/src/translations/en/translation.json+++ b/apps/client/src/translations/en/translation.json@@ -645,7 +645,136 @@"print_scale": "When exporting to PDF, changes the scale of the rendered content. Values range from 0.1 (10%) to 2 (200%), default is 1 (100%).","print_margins": "When exporting to PDF, sets page margins. Use <code>default</code>, <code>none</code>, <code>minimum</code>, or custom values as <code>top,right,bottom,left</code> in millimeters.","color_type": "Color",- "relation_type": "Relation"+ "relation_type": "Relation",+ "versioning_limit": "Limits how many revisions this note keeps, overriding the global setting.",+ "similar_notes_widget_disabled": "Disables the Similar Notes ribbon tab for this note. Old layout only.",+ "llm_chat_home": "New AI chats are created as children of this note.",+ "workspace_llm_chat_home": "New AI chats are created as children of this note while hoisted to an ancestor of this workspace.",+ "date_pattern": "Pattern for the titles of the day notes generated under this calendar root, e.g. <code>{dateNumberPadded} - {weekDay}</code>.",+ "week_pattern": "Pattern for the titles of the week notes generated under this calendar root. Requires <code>#enableWeekNote</code>.",+ "month_pattern": "Pattern for the titles of the month notes generated under this calendar root, e.g. <code>{monthNumberPadded} - {month}</code>.",+ "quarter_pattern": "Pattern for the titles of the quarter notes generated under this calendar root. Requires <code>#enableQuarterNote</code>.",+ "year_pattern": "Pattern for the titles of the year notes generated under this calendar root, e.g. <code>{year}</code>.",+ "enable_week_note": "Generates a week note between the month and the day notes. Set on the calendar root; off by default.",+ "enable_quarter_note": "Generates a quarter note between the year and the month notes. Set on the calendar root; off by default.",+ "date_note": "Stamped on each generated day note with the date it stands for, as <code>YYYY-MM-DD</code>, so that scripts can find it.",+ "week_note": "Stamped on each generated week note with the week it stands for.",+ "month_note": "Stamped on each generated month note with the month it stands for, as <code>YYYY-MM</code>.",+ "quarter_note": "Stamped on each generated quarter note with the quarter it stands for.",+ "year_note": "Stamped on each generated year note with the year it stands for.",+ "view_type": "Sets how the child notes of this note are shown, e.g. as a grid, a list, a table or a calendar.",+ "map_root_note_id": "The note the note map is drawn from. Defaults to the special value <code>hoisted</code>.",+ "map_exclude_relation": "Comma-delimited relation names to leave out of the note map.",+ "map_include_relation": "Comma-delimited relation names to draw in the note map.",+ "sort_natural": "Sorts numbers in the child notes naturally rather than alphabetically, so that 2 comes before 10. Needs <code>#sorted</code>.",+ "sort_locale": "The language the natural sort follows, e.g. <code>de</code> or <code>zh-CN</code>. Only meaningful with <code>#sortNatural</code>.",+ "bottom": "Keeps this note at the bottom of its parent, which applies only while the parent is sorted.",+ "full_content_width": "Expands the note to the full width of the editor, ignoring the configured content width. Useful for wide tables.",+ "subtree_hidden": "Hides this note's children from the tree behind a badge counting them. They stay reachable by search and by direct links.",+ "expanded": "How many levels of children a list or grid opens expanded.",+ "share_external": "Older spelling of <code>#shareExternalLink</code>, still read by the share theme.",+ "share_root_link": "The address the shared page's logo links to.",+ "share_logo_width": "Width of the shared page's logo, in pixels and without a unit. Defaults to 53.",+ "share_logo_height": "Height of the shared page's logo, in pixels and without a unit. Defaults to 40.",+ "share_open_graph_color": "Sets the <code>theme-color</code> meta property of the shared page.",+ "share_open_graph_url": "Sets the <code>og:url</code> and <code>twitter:url</code> meta properties of the shared page.",+ "share_open_graph_domain": "Sets the <code>twitter:domain</code> meta property of the shared page.",+ "share_open_graph_image": "Sets the <code>og:image</code> meta property of the shared page, as an address used as it stands. Point the relation of the same name at an image note instead to serve one from Trilium.",+ "share_html_location": "Where the HTML injected by <code>~shareHtml</code> is placed, as <code>location:position</code> — <code>head</code>, <code>body</code> or <code>content</code>, with <code>start</code> or <code>end</code>. Set on the snippet note itself.",+ "snippet": "Offers this code note as a snippet to insert into other code notes.",+ "snippet_description": "Description shown beside this code snippet where it is offered for insertion.",+ "text_snippet": "Offers this text note as a snippet to insert into other text notes.",+ "text_snippet_description": "Description shown beside this text snippet where it is offered for insertion.",+ "execute_title": "Title of the tab this code note is executed from.",+ "clipper_inbox": "Where the Web Clipper saves what it collects, instead of the day note.",+ "clip_type": "Records how the Web Clipper made this note, e.g. <code>clippings</code>.",+ "sent_from_sender": "Marks a note as having arrived through the sender rather than having been written in Trilium.",+ "hide_children_overview": "Hides the list of child notes shown under this note's content.",+ "media_notes_play_mode": "What the media player does when a track ends, e.g. <code>next</code> to carry on with the following note.",+ "collection": "Marks this template as a collection, so that it is offered under Collections when a note is created.",+ "web_view_src": "The address a Web View note loads.",+ "icon_pack": "Identifies a custom icon pack by the prefix its icons are named with.",+ "doc_name": "Identifies the in-app help document this note holds. Used internally.",+ "doc_url": "Address of the online documentation this help note corresponds to. Used internally.",+ "language": "The language this note's content is written in, which drives spell checking and text direction.",+ "original_file_name": "The name the file had when it was imported, kept so that it can be exported under it again.",+ "page_url": "The address a clipped page came from, shown beside the note title.",+ "command": "Which built-in command a launcher runs when it is pressed.",+ "display_mode": "Which pane a split editor shows: <code>source</code>, <code>preview</code>, or <code>split</code> for both. Overrides what <code>#readOnly</code> would otherwise choose.",+ "search_string": "The query a saved search runs.",+ "ancestor_depth": "How far below the <code>~ancestor</code> note a result may sit, e.g. <code>eq5</code> for exactly five levels down.",+ "order_by": "What the results of a saved search are ordered by, e.g. <code>relevancy</code> or the name of a label.",+ "order_direction": "Which way the results of a saved search are ordered: <code>asc</code> or <code>desc</code>.",+ "limit": "The greatest number of results a saved search returns.",+ "fast_search": "Searches titles and attributes only, leaving note content out. Much quicker over a large database.",+ "include_archived_notes": "Includes archived notes in the results of a saved search, which are otherwise left out.",+ "debug": "Records how the query was understood, for working out why a saved search matches what it does.",+ "launcher_type": "What a launcher does when pressed: <code>note</code>, <code>script</code>, <code>command</code>, <code>customWidget</code> or <code>spacer</code>.",+ "builtin_widget": "Which built-in widget a launcher shows, e.g. <code>spacer</code> or <code>bookmarks</code>.",+ "script_in_launcher_content": "Runs the launcher note's own content as the script, instead of following its <code>~script</code> relation.",+ "base_size": "The room a launch bar spacer takes before any spare space is shared out, in pixels.",+ "growth_factor": "How much of the launch bar's spare room this spacer takes, against the other spacers.",+ "desktop_only": "Shows this launcher only on a desktop-sized screen.",+ "electron_only": "Shows this only in the desktop application, not when Trilium is reached through a browser.",+ "server_only": "Shows this only when Trilium is reached through a browser, not in the desktop application.",+ "beta": "Marks this template as a beta feature where it is offered in the note creation menu.",+ "one_note_page_id": "The identifier the page had in OneNote, kept on import so that it can be traced back. Trilium itself does not read it.",+ "one_note_section_id": "The identifier the section had in OneNote, kept on import so that it can be traced back.",+ "one_note_import_failed": "Marks a note that could not be imported from OneNote, so that the failures can be searched for.",+ "status": "Which column of a board this note sits in. The label a board groups by unless told otherwise.",+ "board_group_by": "Which label a board groups its columns by, instead of <code>#status</code>.",+ "state_id": "The value a task state is stored as, which is what a note carries to be in that state.",+ "markdown_symbol": "The character a task state is written as in a Markdown task list, e.g. <code>x</code> for a completed one.",+ "is_completed": "Marks a task state as meaning the task is finished.",+ "is_hidden": "Keeps a task state out of the pickers, without deleting it or the notes already in it.",+ "max_nesting_depth": "How many levels of children a table shows. Notes cannot be reordered while it is set.",+ "include_archived": "Includes archived notes in this collection, which are otherwise left out.",+ "calendar_view": "Which view a calendar opens in: <code>timeGridDay</code>, <code>timeGridWeek</code>, <code>dayGridMonth</code>, <code>multiMonthYear</code> or <code>listMonth</code>.",+ "calendar_initial_date": "The date a calendar opens on. Opens on today when unset.",+ "calendar_hide_weekends": "Hides Saturday and Sunday from the calendar. Applies whatever its value.",+ "calendar_week_numbers": "Shows the number of the week on the calendar. Applies whatever its value.",+ "calendar_slot_duration": "How long each timeslot of a calendar lasts, as <code>HH:MM:SS</code>. Defaults to 15 minutes.",+ "calendar_slot_label_interval": "How often the timeslots of a calendar are labelled, as <code>HH:MM:SS</code>. Defaults to an hour.",+ "calendar_title": "Names the attribute an event takes its title from, instead of the note title. Either a label or a relation, written without <code>#</code> or <code>~</code>.",+ "calendar_displayed_attributes": "Comma-delimited attribute names whose values are shown on the event. A relation is shown as the title of the note it points at.",+ "calendar_start_date": "Names the label an event reads its start date from, instead of <code>#startDate</code>. Written without the <code>#</code>.",+ "calendar_end_date": "Names the label an event reads its end date from, instead of <code>#endDate</code>.",+ "calendar_start_time": "Names the label an event reads its start time from, instead of <code>#startTime</code>.",+ "calendar_end_time": "Names the label an event reads its end time from, instead of <code>#endTime</code>.",+ "calendar_recurrence": "Names the label an event reads its recurrence rule from, instead of <code>#recurrence</code>.",+ "start_date": "The date an event starts on, as <code>YYYY-MM-DD</code>, which is what places it in a calendar.",+ "end_date": "The date an event ends on, for one spanning several days. The end day is included.",+ "start_time": "The time an event starts at, as <code>HH:MM</code> in 24-hour form. Without it the event lasts the whole day.",+ "end_time": "The time an event ends at, read against <code>#endDate</code> where there is one and <code>#startDate</code> otherwise.",+ "recurrence": "A CalDAV <code>RRULE</code> string making the event repeat. The start is taken from <code>#startDate</code> and <code>#startTime</code>, so the rule leaves <code>DTSTART</code> out.",+ "geolocation": "The latitude and longitude the note is placed at on a geo map.",+ "map_type": "Which note map is drawn: <code>link</code> for the relations between notes, or <code>tree</code> for the hierarchy.",+ "map_style": "Which style a geo map is drawn in, chosen from the raster and vector styles offered in the collection properties.",+ "map_scale": "Shows a scale bar on the geo map.",+ "map_hide_labels": "Hides the note titles beside the markers on a geo map.",+ "presentation_theme": "Which theme a presentation is shown with.",+ "slide_background": "The background of a slide, as a colour or as a CSS gradient.",+ "tab_width": "How many spaces wide one level of indentation is in this code note.",+ "indent_with_tabs": "Indents this code note with tabs rather than spaces.",+ "wrap_lines": "Wraps long lines in this code note instead of scrolling sideways.",+ "internal_bookmark": "A place inside the note that can be linked to directly. Kept up to date by Trilium.",+ "internal_link": "A link from this note to another, kept up to date by Trilium so that backlinks and the note map can be drawn.",+ "image_link": "An image embedded in this note, kept up to date by Trilium.",+ "relation_map_link": "A note placed on this relation map, kept up to date by Trilium.",+ "include_note_link": "A note included into this one's content, kept up to date by Trilium.",+ "date_template": "Set on a calendar root: the note it points at is applied as <code>~template</code> to each day note generated under it.",+ "week_template": "Set on a calendar root: the note it points at is applied as <code>~template</code> to each week note generated under it.",+ "month_template": "Set on a calendar root: the note it points at is applied as <code>~template</code> to each month note generated under it.",+ "quarter_template": "Set on a calendar root: the note it points at is applied as <code>~template</code> to each quarter note generated under it.",+ "year_template": "Set on a calendar root: the note it points at is applied as <code>~template</code> to each year note generated under it.",+ "search_script": "Runs a backend script to produce the results of this saved search, instead of evaluating <code>#searchString</code>. The script returns an array of note IDs.",+ "ancestor": "Restricts a saved search to the subtree of the note it points at.",+ "target": "The note a launcher opens when it is pressed.",+ "script": "The script a launcher runs when it is pressed.",+ "hoisted_note": "The note to hoist to when a launcher opens its target.",+ "share_logo": "An image note used as the logo of the shared page. It has to sit inside the shared subtree.",+ "share_open_graph_image_relation": "An image note served as the <code>og:image</code> of the shared page. Set the label of the same name instead to point at an address.",+ "share_html": "An HTML note injected into the shared page, where <code>#shareHtmlLocation</code> on that note says. It has to sit inside the shared subtree."},"attribute_editor": {"help_text_body1": "To add label, just type e.g. <code>#rock</code> or if you want to add also value then e.g. <code>#year = 2020</code>",diff --git a/apps/client/src/widgets/attribute_widgets/attr_help.ts b/apps/client/src/widgets/attribute_widgets/attr_help.tsindex 6b750df5b6..384cd1c86c 100644--- a/apps/client/src/widgets/attribute_widgets/attr_help.ts+++ b/apps/client/src/widgets/attribute_widgets/attr_help.ts@@ -70,7 +70,119 @@ export const ATTR_HELP: AttrHelpMap = {printLandscape: t("attribute_detail.print_landscape"),printPageSize: t("attribute_detail.print_page_size"),printScale: t("attribute_detail.print_scale"),- printMargins: t("attribute_detail.print_margins")+ printMargins: t("attribute_detail.print_margins"),+ versioningLimit: t("attribute_detail.versioning_limit"),+ similarNotesWidgetDisabled: t("attribute_detail.similar_notes_widget_disabled"),+ llmChatHome: t("attribute_detail.llm_chat_home"),+ workspaceLlmChatHome: t("attribute_detail.workspace_llm_chat_home"),+ datePattern: t("attribute_detail.date_pattern"),+ weekPattern: t("attribute_detail.week_pattern"),+ enableWeekNote: t("attribute_detail.enable_week_note"),+ monthPattern: t("attribute_detail.month_pattern"),+ quarterPattern: t("attribute_detail.quarter_pattern"),+ yearPattern: t("attribute_detail.year_pattern"),+ enableQuarterNote: t("attribute_detail.enable_quarter_note"),+ dateNote: t("attribute_detail.date_note"),+ weekNote: t("attribute_detail.week_note"),+ monthNote: t("attribute_detail.month_note"),+ quarterNote: t("attribute_detail.quarter_note"),+ yearNote: t("attribute_detail.year_note"),+ viewType: t("attribute_detail.view_type"),+ mapRootNoteId: t("attribute_detail.map_root_note_id"),+ mapExcludeRelation: t("attribute_detail.map_exclude_relation"),+ mapIncludeRelation: t("attribute_detail.map_include_relation"),+ sortNatural: t("attribute_detail.sort_natural"),+ sortLocale: t("attribute_detail.sort_locale"),+ bottom: t("attribute_detail.bottom"),+ fullContentWidth: t("attribute_detail.full_content_width"),+ subtreeHidden: t("attribute_detail.subtree_hidden"),+ expanded: t("attribute_detail.expanded"),+ shareExternal: t("attribute_detail.share_external"),+ shareRootLink: t("attribute_detail.share_root_link"),+ shareLogoWidth: t("attribute_detail.share_logo_width"),+ shareLogoHeight: t("attribute_detail.share_logo_height"),+ shareOpenGraphColor: t("attribute_detail.share_open_graph_color"),+ shareOpenGraphURL: t("attribute_detail.share_open_graph_url"),+ shareOpenGraphDomain: t("attribute_detail.share_open_graph_domain"),+ shareOpenGraphImage: t("attribute_detail.share_open_graph_image"),+ shareHtmlLocation: t("attribute_detail.share_html_location"),+ snippet: t("attribute_detail.snippet"),+ snippetDescription: t("attribute_detail.snippet_description"),+ textSnippet: t("attribute_detail.text_snippet"),+ textSnippetDescription: t("attribute_detail.text_snippet_description"),+ executeTitle: t("attribute_detail.execute_title"),+ clipperInbox: t("attribute_detail.clipper_inbox"),+ clipType: t("attribute_detail.clip_type"),+ sentFromSender: t("attribute_detail.sent_from_sender"),+ hideChildrenOverview: t("attribute_detail.hide_children_overview"),+ mediaNotesPlayMode: t("attribute_detail.media_notes_play_mode"),+ collection: t("attribute_detail.collection"),+ webViewSrc: t("attribute_detail.web_view_src"),+ iconPack: t("attribute_detail.icon_pack"),+ docName: t("attribute_detail.doc_name"),+ docUrl: t("attribute_detail.doc_url"),+ language: t("attribute_detail.language"),+ originalFileName: t("attribute_detail.original_file_name"),+ pageUrl: t("attribute_detail.page_url"),+ command: t("attribute_detail.command"),+ displayMode: t("attribute_detail.display_mode"),+ searchString: t("attribute_detail.search_string"),+ ancestorDepth: t("attribute_detail.ancestor_depth"),+ orderBy: t("attribute_detail.order_by"),+ orderDirection: t("attribute_detail.order_direction"),+ limit: t("attribute_detail.limit"),+ fastSearch: t("attribute_detail.fast_search"),+ includeArchivedNotes: t("attribute_detail.include_archived_notes"),+ debug: t("attribute_detail.debug"),+ launcherType: t("attribute_detail.launcher_type"),+ builtinWidget: t("attribute_detail.builtin_widget"),+ scriptInLauncherContent: t("attribute_detail.script_in_launcher_content"),+ baseSize: t("attribute_detail.base_size"),+ growthFactor: t("attribute_detail.growth_factor"),+ desktopOnly: t("attribute_detail.desktop_only"),+ electronOnly: t("attribute_detail.electron_only"),+ serverOnly: t("attribute_detail.server_only"),+ beta: t("attribute_detail.beta"),+ oneNotePageId: t("attribute_detail.one_note_page_id"),+ oneNoteSectionId: t("attribute_detail.one_note_section_id"),+ oneNoteImportFailed: t("attribute_detail.one_note_import_failed"),+ status: t("attribute_detail.status"),+ "board:groupBy": t("attribute_detail.board_group_by"),+ stateId: t("attribute_detail.state_id"),+ markdownSymbol: t("attribute_detail.markdown_symbol"),+ isCompleted: t("attribute_detail.is_completed"),+ isHidden: t("attribute_detail.is_hidden"),+ maxNestingDepth: t("attribute_detail.max_nesting_depth"),+ includeArchived: t("attribute_detail.include_archived"),+ "calendar:view": t("attribute_detail.calendar_view"),+ "calendar:initialDate": t("attribute_detail.calendar_initial_date"),+ "calendar:hideWeekends": t("attribute_detail.calendar_hide_weekends"),+ "calendar:weekNumbers": t("attribute_detail.calendar_week_numbers"),+ "calendar:slotDuration": t("attribute_detail.calendar_slot_duration"),+ "calendar:slotLabelInterval": t("attribute_detail.calendar_slot_label_interval"),+ "calendar:title": t("attribute_detail.calendar_title"),+ "calendar:displayedAttributes": t("attribute_detail.calendar_displayed_attributes"),+ "calendar:startDate": t("attribute_detail.calendar_start_date"),+ "calendar:endDate": t("attribute_detail.calendar_end_date"),+ "calendar:startTime": t("attribute_detail.calendar_start_time"),+ "calendar:endTime": t("attribute_detail.calendar_end_time"),+ "calendar:recurrence": t("attribute_detail.calendar_recurrence"),+ startDate: t("attribute_detail.start_date"),+ endDate: t("attribute_detail.end_date"),+ startTime: t("attribute_detail.start_time"),+ endTime: t("attribute_detail.end_time"),+ recurrence: t("attribute_detail.recurrence"),+ geolocation: t("attribute_detail.geolocation"),+ mapType: t("attribute_detail.map_type"),+ "map:style": t("attribute_detail.map_style"),+ "map:scale": t("attribute_detail.map_scale"),+ "map:hideLabels": t("attribute_detail.map_hide_labels"),+ "presentation:theme": t("attribute_detail.presentation_theme"),+ "slide:background": t("attribute_detail.slide_background"),+ tabWidth: t("attribute_detail.tab_width"),+ indentWithTabs: t("attribute_detail.indent_with_tabs"),+ wrapLines: t("attribute_detail.wrap_lines"),+ internalBookmark: t("attribute_detail.internal_bookmark")},relation: {runOnNoteCreation: t("attribute_detail.run_on_note_creation"),@@ -91,6 +203,23 @@ export const ATTR_HELP: AttrHelpMap = {shareCss: t("attribute_detail.share_css"),shareJs: t("attribute_detail.share_js"),shareTemplate: t("attribute_detail.share_template"),- shareFavicon: t("attribute_detail.share_favicon")+ shareFavicon: t("attribute_detail.share_favicon"),+ internalLink: t("attribute_detail.internal_link"),+ imageLink: t("attribute_detail.image_link"),+ relationMapLink: t("attribute_detail.relation_map_link"),+ includeNoteLink: t("attribute_detail.include_note_link"),+ dateTemplate: t("attribute_detail.date_template"),+ weekTemplate: t("attribute_detail.week_template"),+ monthTemplate: t("attribute_detail.month_template"),+ quarterTemplate: t("attribute_detail.quarter_template"),+ yearTemplate: t("attribute_detail.year_template"),+ searchScript: t("attribute_detail.search_script"),+ ancestor: t("attribute_detail.ancestor"),+ target: t("attribute_detail.target"),+ script: t("attribute_detail.script"),+ hoistedNote: t("attribute_detail.hoisted_note"),+ shareLogo: t("attribute_detail.share_logo"),+ shareOpenGraphImage: t("attribute_detail.share_open_graph_image_relation"),+ shareHtml: t("attribute_detail.share_html")}};diff --git a/apps/client/src/widgets/attribute_widgets/attribute_detail.spec.ts b/apps/client/src/widgets/attribute_widgets/attribute_detail.spec.tsindex 48f093fedc..420b59b647 100644--- a/apps/client/src/widgets/attribute_widgets/attribute_detail.spec.ts+++ b/apps/client/src/widgets/attribute_widgets/attribute_detail.spec.ts@@ -167,6 +167,24 @@ describe("attribute detail popup naming", () => {expect(lookupAttributeHelp(undefined, "customRequestHandler")).toBeUndefined();});+ it("explains every name Trilium reads for itself, and no name it does not", async () => {+ const { ATTR_HELP } = await import("./attr_help");+ const { default: BUILTIN_ATTRIBUTES } = await import("@triliumnext/commons/src/lib/builtin_attributes");++ // Asserted on the entry being declared rather than on what it reads: `t()` resolves to nothing+ // without the translations loaded, which is why the lookup below is checked by its help page.+ for (const { type, name } of BUILTIN_ATTRIBUTES) {+ expect(Object.hasOwn(ATTR_HELP[type] ?? {}, name), `${type} ${name} has no help`).toBe(true);+ }++ for (const type of [ "label", "relation" ] as const) {+ for (const name of Object.keys(ATTR_HELP[type] ?? {})) {+ expect(BUILTIN_ATTRIBUTES.some((attr) => attr.type === type && attr.name === name),+ `${type} ${name} is explained but is not a builtin`).toBe(true);+ }+ }+ });+it("marks the names Trilium reads for itself, a definition named after one excepted", async () => {const { isSystemAttribute } = await import("./attribute_detail");