### Indexed Path Example in Markdown Source: https://mdelobelle.github.io/metadatamenu/fields Example showing how indexedPath attributes are computed for fields within a file's frontmatter. ```markdown --- #Field # indexedPath City: Paris # HDERA Employees: # dx8Mth - Name: John Doe # dx8Mth[0]____7r1kwd Role: CFO # dx8Mth[0]____PCNGE4 Contact Info: # dx8Mth[0]____Y0dsfZ e-mail: john.doe@acme.ob # dx8Mth[0]____Y0dsfZ____hRlSsW phone number: 1234567891 # dx8Mth[0]____Y0dsfZ____xLPW7T - Name: Ann Martin # dx8Mth[1]____7r1kwd Role: CEO # dx8Mth[1]____PCNGE4 Contact Info: # dx8Mth[1]____Y0dsfZ e-mail: ann.martin@acme.ob # dx8Mth[1]____Y0dsfZ____hRlSsW phone number: 1234567890 # dx8Mth[1]____Y0dsfZ____xLPW7T --- ``` -------------------------------- ### Custom Summarizing Function Examples Source: https://mdelobelle.github.io/metadatamenu/fields These examples demonstrate how to define custom JavaScript functions for summarizing data. The `pages` object is available for manipulation. The function must return a value. ```javascript return pages.length ``` ```javascript const i=0.0; const sum = pages.reduce((p, c) => p + c["age"], i); return sum / pages.length ``` -------------------------------- ### Dataview Query for Lookup Field Example Source: https://mdelobelle.github.io/metadatamenu/fields This is an example of a Dataview query used to populate a lookup field. It selects pages with the '#student' tag and extracts the 'School' field. ```dataview dv.pages("#student") ``` -------------------------------- ### JavaScript Formula Example Source: https://mdelobelle.github.io/metadatamenu/fields This example shows a JavaScript formula for a field named 'mixed sum'. It calculates the sum of 'apples' and 'bananas' fields from the current page. ```javascript current.apples + current.bananas ``` -------------------------------- ### Frontmatter Autosuggestion Improvements in Metadata Menu 0.4.5 Source: https://mdelobelle.github.io/metadatamenu/releases Metadata Menu version 0.4.5 adds an extra space after inline field separators and a notice if Dataview is not installed. ```plaintext ``` an extra space is added after inline fields separator :: when selecting a value from a modal a notice will popup at the plugin launch if the dataview plugin isn’t installed and enabled. ``` ``` -------------------------------- ### Metadata Menu Codeblock for FileClass Table View Source: https://mdelobelle.github.io/metadatamenu/controls Displays a fileclass table view anywhere in your vault using a Metadata Menu codeblock. Configure with fileClass, view, files per page, start, and showAddField options. ```markdown ```mdm fileClass: mandatory view: optional files per page: optional start: optional showAddField: optional (false if absent) ``` ``` -------------------------------- ### Dataview Query for Metadata Menu Settings Source: https://mdelobelle.github.io/metadatamenu/releases This is a Dataview query used in the Metadata Menu settings for advanced suggestions. Ensure Dataview plugin is installed and enabled. ```javascript ```javascript // Dataview query for advanced suggestions ``` ``` -------------------------------- ### Get Value for Indexed Path Source: https://mdelobelle.github.io/metadatamenu/api Retrieves the value of a field using its indexed path from a specified file. ```APIDOC ## GET /api/getValuesForIndexedPath ### Description Retrieves the value of a field using its indexed path from a specified file. ### Method GET ### Endpoint `/api/getValuesForIndexedPath` ### Parameters #### Query Parameters - **fileOrFilePath** (TFile | string) - Required - The file or file path to retrieve the value from. - **indexedPath** (string) - Required - The indexed path of the field whose value is to be retrieved. ### Response #### Success Response (200) - **string** - The value of the field for the specified indexed path. ``` -------------------------------- ### Get File Fields Analysis Source: https://mdelobelle.github.io/metadatamenu/api Retrieves all frontmatter and Dataview fields from a given file or file path. Returns an analysis of each field including its value, file class, ignore status, validity, options, source type, type, and IDs. ```typescript fileFields(fileOrFilePath: TFile | string) => Promise> ``` ```typescript { (indexedPath: string): { /* the value of the field in the file */ value: string | undefined, /* the fileClass name applied to this field if there is a fileClass AND if the field is set in the fileClass or the fileClass it's inheriting from */ fileClassName: string | undefined, /* true if this fieldName is in "Globally ignored fields" in the plugin settings */ ignoreInMenu: boolean | undefined, /* true if this field as a setting defined in the plugin settings or a fileClass and if the value is valid according to those settings */ isValid: boolean | undefined, /* an object containing the options available for this field according to the plugin settings or the fileClass */ options: Record | undefined, /* wether the settings applied to this field come from a fileClass, the plugin settings or none */ sourceType: "fileClass" | "settings" | undefined, /* the type of the field according to the plugin settings or the fileClass */ type: "Input" | "Select" | "Multi" | "Cycle" | "Boolean" | "Number" | "File" | "MultiFile" | "Media" | "MultiMedia" | "Date" | "Lookup" | "Formula" | "Canvas" | "CanvasGroup" | "CanvasGroupLink" | "YAML" | "JSON" | "Object" | "ObjectList" /* the unique identifier of the field definition in the vault */ id: string /* the unique idenfier of the path of this field in this file*/ indexedPath: string | undefined } } ``` -------------------------------- ### Get Field Values (Deprecated) Source: https://mdelobelle.github.io/metadatamenu/api Retrieves all values for a given field from a specified file. This function is deprecated. ```APIDOC ## GET /api/getValues (Deprecated) ### Description Retrieves all values for a given field from a specified file. This function is deprecated. ### Method GET ### Endpoint `/api/getValues` ### Parameters #### Query Parameters - **fileOrFilePath** (TFile | string) - Required - The file or file path to retrieve values from. - **attribute** (string) - Required - The name of the attribute (field) to retrieve values for. ### Response #### Success Response (200) - **string[]** - An array of strings, where each string is a value of the specified field. Returns all values if multiple fields with the same name exist. ``` -------------------------------- ### Get Field Values (Deprecated) Source: https://mdelobelle.github.io/metadatamenu/api Retrieves an array of values for a specified field in a given file. This function is deprecated. ```typescript getValues(fileOrFilePath: TFile | string, attribute: string) => Promise ``` -------------------------------- ### Get Named File Fields Analysis Source: https://mdelobelle.github.io/metadatamenu/api Similar to `fileFields`, but the keys in the returned object are 'named indexed paths' where each field's ID is replaced by its name. ```typescript namedFileFields: (fileOrFilePath: TFile | string) => Promise> ``` -------------------------------- ### Get Values for Indexed Path Source: https://mdelobelle.github.io/metadatamenu/api Retrieves the value of a field for a specific indexed path within a file. Use this for accessing nested or complex field structures. ```typescript getValuesForIndexedPath(fileOrFilePath: TFile | string, indexedPath: string) => Promise ``` -------------------------------- ### Define Fileclass with 'extends' and 'fields' (physics.md - initial) Source: https://mdelobelle.github.io/metadatamenu/fileclasses Initial definition for 'physics.md' extending 'course' and adding a 'lecture' field. Note the potential formatting inconsistency with the hyphen before 'fields'. ```yaml --- .... extends: course - fields: - name: lecture type: Select options: - "0": Mecanics - "1": Optics - "2": Electricity id: ... path: .... --- ``` -------------------------------- ### Configure Metadata Menu Code Block Source: https://mdelobelle.github.io/metadatamenu/releases Use this syntax within a markdown code block to define a fileClass table view with optional parameters. ```mdm fileClass: mandatory view: optional files per page: optional start: optional ``` -------------------------------- ### Multiple FileClass Mapping in Frontmatter Source: https://mdelobelle.github.io/metadatamenu/fileclasses A note can be associated with multiple FileClasses by listing them in the frontmatter. This allows for more granular categorization and management of notes. ```markdown --- fileClass: - company - pkm --- some cool stuff about Obsidian ``` -------------------------------- ### FileClass Mapping with Tags Source: https://mdelobelle.github.io/metadatamenu/fileclasses Map a file to a FileClass by including a tag that matches the FileClass name and setting `mapWithTag` to true. This method leverages existing tagging systems for file association. ```markdown #music some cool stuff about Bob Dylan ``` -------------------------------- ### Basic FileClass Mapping in Frontmatter Source: https://mdelobelle.github.io/metadatamenu/fileclasses Include the fileClass name in the frontmatter of a note to map it to a specific FileClass. This is a straightforward method for associating a note with a predefined class. ```markdown --- fileClass: music --- some cool stuff about Bob Dylan ``` -------------------------------- ### Define sorting order Source: https://mdelobelle.github.io/metadatamenu/fields JavaScript instructions to determine sorting order between two files, a and b. ```javascript a.basename < b.basename ? -1 : 1 ``` ```javascript a.stat.ctime - b.stat.ctime ``` -------------------------------- ### Define Base Fileclass Fields (course.md) Source: https://mdelobelle.github.io/metadatamenu/fileclasses Defines the base fields for a 'course' fileclass, including teacher, grade, and type. This serves as a parent for more specific fileclasses. ```yaml --- fields: - name: teacher type: Input id: .... path: .... ... - name: grade type: Select options: - "0": "A" - "1": "B" - "2": "C" id: ... path: .... - name: type type: Select options: - "0": "at school" - "1": "online" - "2": "personal teacher at home" id: ... path: .... --- ``` -------------------------------- ### Extend Fileclass with Additional Fields (mathematics.md) Source: https://mdelobelle.github.io/metadatamenu/fileclasses Extends the 'course' fileclass to add specific fields like 'chapter' and 'to do next' for mathematics courses. Inherits fields from the parent 'course' fileclass. ```yaml --- extends: course fields: - name: chapter type: Select options: - "0": Algebra - "1": Geometry - "2": Statistics id: ... path: .... - name: to do next type: File options: dvQueryString: "dv.pages('\"Courses\"')" id: ... path: .... --- ``` -------------------------------- ### Post Values by Indexed Path Source: https://mdelobelle.github.io/metadatamenu/api Creates or updates fields in a target note using their indexed paths. Supports options for line number, insertion order, and list/blockquote formatting. ```typescript postValues(fileOrFilePath: TFile | string, payload: FieldsPayload, lineNumber?: number, after?: boolean, asList?: boolean, asBlockquote?:boolean) => Promise ``` -------------------------------- ### Suggest pages by field Source: https://mdelobelle.github.io/metadatamenu/fields Use this query to suggest pages based on a specific inline field value. Frontmatter fields are not supported. ```javascript dv.pages().map(p => p.field) ``` -------------------------------- ### Fileclass Table View Interaction in Metadata Menu 0.3.7 Source: https://mdelobelle.github.io/metadatamenu/releases In Metadata Menu 0.3.7, links in the Fileclass table view are now clickable and will open the corresponding note in a new tab. ```plaintext ``` You can now click on the link in the fileClass table view, it will open the note in a new tab ``` ``` -------------------------------- ### Mix ObjectList and Object fields Source: https://mdelobelle.github.io/metadatamenu/releases Demonstrates nesting an Object field within an ObjectList structure. ```yaml --- players: # ObjectList field - name: Mathieu # Input field with as parent field grade: beginner # Select Field with as parent field address: # Object field with as parent field street: avenue Foch # Input field with
as parent field number: 40 # Number field with
as parent field city: "[[Paris]]" # File field with
as parent field - name: Jules # Input field (the same definition as above) grade: advanced # Select Field (the same definition as above) address: # Object field (the same definition as above) street: av de la paix # Input field (the same definition as above) number: 25 # Number field (the same definition as above) city: "[[Paris]]" # File field (the same definition as above) --- ``` -------------------------------- ### Bug Fixes in Metadata Menu 0.3.7 Source: https://mdelobelle.github.io/metadatamenu/releases Metadata Menu 0.3.7 addresses bugs related to MultiSelect display in dataview tables with links and the Fileclass table view not showing notes with multiple fileClasses. ```plaintext ``` Bug fixes: MultiSelect display in dataview table with some links in it. FileClass table view not showing note with more than one fileClass ``` ``` -------------------------------- ### DataviewJS: Show Add Field Button Source: https://mdelobelle.github.io/metadatamenu/controls Enable the display of a '+' button to add new fields when a corresponding field is missing in a file. Set `options: { showAddField: true }` within the `fieldModifier` attributes. ```javascript options: { showAddField: true } ``` -------------------------------- ### Frontmatter Updates in Metadata Menu 0.4.0 Source: https://mdelobelle.github.io/metadatamenu/releases Metadata Menu 0.4.0 updates frontmatter fields to be compliant with Obsidian core standards, displaying multiple values as indented lists in YAML syntax. Links are now surrounded by double quotes. ```plaintext ``` updating fields in frontmatter is now compliant with obsidian core standard: multiple values will be displayed as indented lists in yaml syntax. Links in frontmatter are surrounded with double quotes: ready for dataview and frontmatter links ``` ``` -------------------------------- ### Create or Update Field Values by Indexed Path Source: https://mdelobelle.github.io/metadatamenu/api Creates or updates fields with specified values in a target note using their indexed paths. ```APIDOC ## POST /api/postValues ### Description Creates or updates fields with specified values in a target note using their indexed paths. ### Method POST ### Endpoint `/api/postValues` ### Parameters #### Path Parameters - **fileOrFilePath** (TFile | string) - Required - The target file where to create or update the fields. - **payload** (FieldsPayload) - Required - A list of fields and values to create or update. See type definition below. - **lineNumber** (number) - Optional - The line number where to create fields if it doesn't exist. If undefined and the field doesn't exist, it will be included in frontmatter. - **after** (boolean) - Optional - Whether to create new fields after or before the line number. Defaults to `true`. - **asList** (boolean) - Optional - Whether to create new fields as a list (prepends `- `). Defaults to `false`. - **asBlockquote** (boolean) - Optional - Whether to create new fields as a comment (prepends `> `). Defaults to `false`. ### Request Body ```json { "fileOrFilePath": "path/to/your/note.md", "payload": [ { "indexedPath": "field.subfield", "payload": { "value": "field value" } } ], "lineNumber": 10, "after": true, "asList": false, "asBlockquote": false } ``` ### Type Definitions #### FieldsPayload ```json [ { "indexedPath": "string", "payload": { "value": "string" } } ] ``` #### FieldPayload ```json { "value": "string" } ``` ### Response #### Success Response (200) - **void** - Indicates successful completion. ``` -------------------------------- ### Fileclass View Enhancements in Metadata Menu 0.3.7 Source: https://mdelobelle.github.io/metadatamenu/releases Metadata Menu 0.3.7 improves the Fileclass View with three tabs: table, field, and settings. The table view supports pagination, sorting, and filtering. Field settings can be managed, and presets can be configured in the settings view. ```plaintext ``` A table view listing all notes with this fileClass or supercharged tag where you can now paginate the table, sort it, filter it. A field view listing all the fileClass fields where you can change their settings, remove or add a field A settings view where you can preset the records per page for the table view, the icon for the metadatamenu button for this fileClass, map it with tags and set tag aliases, set a parent fileClass and exclude fields ``` ``` -------------------------------- ### Create or Update Field Values by Name Source: https://mdelobelle.github.io/metadatamenu/api Creates or updates fields with specified values in a target note using their names. ```APIDOC ## POST /api/postNamedFieldsValues ### Description Creates or updates fields with specified values in a target note using their names. This is an alternative to `postValues` when fields are identified by name instead of indexed path. ### Method POST ### Endpoint `/api/postNamedFieldsValues` ### Parameters #### Path Parameters - **fileOrFilePath** (TFile | string) - Required - The target file where to create or update the fields. - **payload** (NamedFieldsPayload) - Required - A list of fields and values to create or update. See type definition below. - **lineNumber** (number) - Optional - The line number where to create fields if it doesn't exist. If undefined and the field doesn't exist, it will be included in frontmatter. - **after** (boolean) - Optional - Whether to create new fields after or before the line number. Defaults to `true`. - **asList** (boolean) - Optional - Whether to create new fields as a list (prepends `- `). Defaults to `false`. - **asBlockquote** (boolean) - Optional - Whether to create new fields as a comment (prepends `> `). Defaults to `false`. ### Request Body ```json { "fileOrFilePath": "path/to/your/note.md", "payload": [ { "name": "FieldName", "payload": { "value": "field value" } } ], "lineNumber": 10, "after": true, "asList": false, "asBlockquote": false } ``` ### Type Definitions #### NamedFieldsPayload ```json [ { "name": "string", "payload": { "value": "string" } } ] ``` #### FieldPayload ```json { "value": "string" } ``` ### Response #### Success Response (200) - **void** - Indicates successful completion. ``` -------------------------------- ### Field Management in Metadata Menu 0.3.7 Source: https://mdelobelle.github.io/metadatamenu/releases Metadata Menu 0.3.7 includes automatic toggling for boolean fields and cycling forwards for cycle fields when managing fields at the cursor. ```plaintext ``` Manage field at cursor now automatically toggles boolean fields and move cycle fields forwards ``` ``` -------------------------------- ### Extend Fileclass with Overridden Field (physics.md) Source: https://mdelobelle.github.io/metadatamenu/fileclasses Extends the 'course' fileclass and overrides the 'type' field with fewer options for physics courses. Inherits other fields from 'course'. ```yaml --- extends: course - fields: - name: lecture type: Select options: - "0": Mecanics - "1": Optics - "2": Electricity id: ... path: .... - name: type type: Select options: - "0": "at school" - "1": "online" id: ... path: .... --- ``` -------------------------------- ### Mobile Plugin Fixes in Metadata Menu 0.4.5 Source: https://mdelobelle.github.io/metadatamenu/releases Metadata Menu version 0.4.5 includes fixes for the mobile version of the plugin and improvements to frontmatter indented lists. ```plaintext ``` Mobile version of the plugin is no longer broken Indented lists in frontmatter (no more empty values, no more cursor returning at the beginning of the line after selecting an autosuggested value) ``` ``` -------------------------------- ### Canvas Fields in Metadata Menu 0.4.0 Source: https://mdelobelle.github.io/metadatamenu/releases Metadata Menu 0.4.0 introduces Canvas fields that bind metadata with Canvas nodes and edges. Documentation and a demo are available. ```plaintext ``` Introducing Canvas fields : Bind your metadata with canvas nodes and edges, those fields will get updated with the file links matching nodes' and edges' conditions (color, side, direction, and more). demo here: https://youtu.be/7oaau8ijVUA, documentation here: https://mdelobelle.github.io/metadatamenu/settings ``` ``` -------------------------------- ### Post Named Fields Values Source: https://mdelobelle.github.io/metadatamenu/api Creates or updates fields in a target note using their names instead of indexed paths. Similar to postValues but identifies fields by name. ```typescript postNamedFieldsValues: (fileOrFilePath: TFile | string, payload: NamedFieldsPayload, lineNumber?: number, asList?: boolean, asBlockquote?: boolean) => Promise; ``` -------------------------------- ### DataviewJS Table with Metadata Menu API Source: https://mdelobelle.github.io/metadatamenu/controls Integrates Metadata Menu's fieldModifier function into a DataviewJS table to display and manage 'masterization' and 'tune' fields for music files. Ensures the 'masterization' control is always visible. ```javascript /* dataviewjs block */ const {fieldModifier: f} = MetadataMenu.api // destruct metadata-menu api to use fieldModifier function and give an alias: "f" dv.table(["file", "Masterization", "Tune"], dv.pages() .where(p => p.fileClass === "music") .map(p => [ p.file.link, f(dv, p, "masterization", {options: {alwaysOn: true}}), // pass dv (dataview api instance), p (the page), the field name to fieldModifier (: "f") and an object with options: {alwaysOn: true} so taht the control is always visible f(dv, p, "tune") // pass dv (dataview api instance), p (the page), and the field name to fieldModifier (: "f") ]) ) ) ``` -------------------------------- ### Deprecated API Methods in Metadata Menu 0.4.0 Source: https://mdelobelle.github.io/metadatamenu/releases The `replaceValues` and `insertValues` API methods are deprecated in Metadata Menu 0.4.0 and will be removed in the next version. They are replaced by `postValues`. ```plaintext ``` replaceValues and insertValues api methods are deprecated and will be removed in the next version. They are replaced by postValues that will create or update values ``` ``` -------------------------------- ### Define ObjectList field in frontmatter Source: https://mdelobelle.github.io/metadatamenu/releases Use an ObjectList field to manage a collection of objects, each containing the same set of sub-fields. ```yaml --- players: # ObjectList field - name: Mathieu # Input field with as parent field grade: beginner # Select Field with as parent field - name: Jules # Input field (the same definition as above) grade: advanced # Select Field (the same definition as above) --- ``` -------------------------------- ### Retrieve field value from a specific page Source: https://mdelobelle.github.io/metadatamenu/fields Retrieves the value of a specific field from a target file. The target file must contain the specified inline field. ```javascript dv.page("Jules Verne").books ``` -------------------------------- ### File Fields API Source: https://mdelobelle.github.io/metadatamenu/api Provides functions to retrieve and analyze fields within files. ```APIDOC ## GET /fileFields ### Description Retrieves all frontmatter and dataview fields from a given file, along with an analysis of those fields by Metadata Menu. ### Method GET ### Endpoint /fileFields ### Parameters #### Query Parameters - **fileOrFilePath** (TFile | string) - Required - The file or file path to analyze. ### Response #### Success Response (200) - **Record** - An object where keys are field names and values are IFieldInfo objects containing details about each field. ### Response Example ```json { "fieldName1": { "value": "fieldValue1", "fileClassName": "ClassName1", "ignoreInMenu": false, "isValid": true, "options": {}, "sourceType": "settings", "type": "Input", "id": "fieldId1", "indexedPath": "indexedPath1" } } ``` ``` ```APIDOC ## GET /namedFileFields ### Description Similar to `fileFields`, but the keys in the returned object are "named indexedPaths", where each field's ID in the indexedPath is replaced by its name. ### Method GET ### Endpoint /namedFileFields ### Parameters #### Query Parameters - **fileOrFilePath** (TFile | string) - Required - The file or file path to analyze. ### Response #### Success Response (200) - **Record** - An object where keys are named indexedPaths and values are IFieldInfo objects. ### Response Example ```json { "fieldName1.subFieldName": { "value": "fieldValue1", "fileClassName": "ClassName1", "ignoreInMenu": false, "isValid": true, "options": {}, "sourceType": "settings", "type": "Input", "id": "fieldId1", "indexedPath": "indexedPath1.subPath1" } } ``` ``` -------------------------------- ### FieldsPayload and FieldPayload Types Source: https://mdelobelle.github.io/metadatamenu/api Defines the structure for payloads used in posting field values, specifying indexed paths and their corresponding values. ```typescript export type FieldPayload = { value: string, // the field's value as string } export type FieldsPayload = Array<{ indexedPath: string, //the indexedPath of the field payload: FieldPayload }> ``` -------------------------------- ### Insert Missing Fields Source: https://mdelobelle.github.io/metadatamenu/api Inserts missing fields for all or a specified file class into a file at a given line number. Supports insertion as a list or blockquote. ```typescript insertMissingFields: (fileOrFilePath: string | TFile, lineNumber: number, boolean, asList: boolean, asBlockquote: boolean, fileClassName?: string) => Promise ``` -------------------------------- ### NamedFieldsPayload and FieldPayload Types Source: https://mdelobelle.github.io/metadatamenu/api Defines the structure for payloads when posting field values by name, including the field's name and its value. ```typescript export type FieldPayload = { value: string, // the field's value as string } export type NamedFieldsPayload = Array<{ name: string, //the name of the field payload: FieldPayload }> ``` -------------------------------- ### Exclude Inherited Field (physics.md) Source: https://mdelobelle.github.io/metadatamenu/fileclasses Extends the 'course' fileclass but excludes the 'grade' field from inheritance. This allows 'physics' notes to inherit 'teacher' and 'type' but not 'grade'. ```yaml --- extends: course excludes: [grade] --- ``` -------------------------------- ### Generate field alias Source: https://mdelobelle.github.io/metadatamenu/fields Returns a string alias for a field using the page object attributes. ```javascript "🚀" + (page.surname || page.file.name) ``` -------------------------------- ### Define Object field in frontmatter Source: https://mdelobelle.github.io/metadatamenu/releases Use an Object field to group related properties under a single parent key. ```yaml --- address: # Object field street: avenue Foch # Input field with
as parent field number: 40 # Number field with
as parent field city: "[[Paris]]" # File field with
as parent field --- ``` -------------------------------- ### Canvas Group Fields in Metadata Menu 0.4.1 Source: https://mdelobelle.github.io/metadatamenu/releases Metadata Menu 0.4.1 introduces Canvas Group fields that update metadata based on groups in Canvas. Refer to the tutorial for usage. ```plaintext ``` Introducing Canvas Group fields : Update your metadata based on groups in canvas, those fields will get updated with the names of groups matching specific conditions (color, label) their nodes belong to. See it in action in this tutorial to create a simple Kanban canvas: https://youtu.be/G47AYkmoKJs ``` ``` -------------------------------- ### DataviewJS: Insert Field in Frontmatter Source: https://mdelobelle.github.io/metadatamenu/controls Automatically insert a field at the end of the frontmatter section when using `fieldModifier`. Set `options: { inFrontmatter: true }` to manage field placement within the frontmatter. ```javascript options: { inFrontmatter: true } ``` -------------------------------- ### DataviewJS: Always Show Field Control Source: https://mdelobelle.github.io/metadatamenu/controls Configure the `fieldModifier` to always display the field control by setting `options: { alwaysOn: true }`. This ensures the interactive elements for field modification are persistently visible. ```javascript options: { alwaysOn: true } ``` -------------------------------- ### Insert Missing Fields API Source: https://mdelobelle.github.io/metadatamenu/api Inserts missing fields into a document based on file class definitions. ```APIDOC ## POST /insertMissingFields ### Description Inserts all missing fields from specified file classes into a document at a given line number. Supports options for insertion format (list, comment) and scope (all file classes or a single one). ### Method POST ### Endpoint /insertMissingFields ### Parameters #### Request Body - **fileOrFilePath** (string | TFile) - Required - The file or file path where fields will be inserted. - **lineNumber** (number) - Required - The line number at which to insert the fields. - **afterLine** (boolean) - Optional - If true, inserts fields after the specified line; otherwise, inserts before (default: false). - **asList** (boolean) - Optional - If true, formats inserted fields as a list (prepends `- `) (default: false). - **asBlockquote** (boolean) - Optional - If true, formats inserted fields as a blockquote (prepends `> `) (default: false). - **fileClassName** (string) - Optional - If provided, only inserts fields belonging to this specific file class. ### Request Example ```json { "fileOrFilePath": "path/to/your/document.md", "lineNumber": 10, "afterLine": true, "asList": true, "fileClassName": "MyFileClass" } ``` ### Response #### Success Response (200) - **void** - Indicates successful insertion. No content is returned. #### Error Response (e.g., 400, 500) - **Error message** - Description of the error encountered during insertion. ``` -------------------------------- ### Field Modifier Source: https://mdelobelle.github.io/metadatamenu/api Generates an HTML element to modify a field's value in a target note. ```APIDOC ## POST /api/fieldModifier ### Description Generates an HTML element to modify a field's value in a target note. This function is typically used within Dataview queries or other dynamic contexts. ### Method POST ### Endpoint `/api/fieldModifier` ### Parameters #### Path Parameters - **dv** (any) - Required - The Dataview API instance. - **p** (any) - Required - The page object containing the field. - **fieldName** (string) - Required - The name of the field to modify. - **attrs** (object) - Optional - An object containing attributes for the generated HTML element. - **cls** (string) - Optional - CSS classes to apply to the element. - **attr** (Record) - Optional - Key-value pairs for HTML attributes. ### Response #### Success Response (200) - **HTMLElement** - An HTML element that allows for the modification of the field's value. ``` -------------------------------- ### Control Dataview Fields with fieldModifier Source: https://mdelobelle.github.io/metadatamenu/controls Use the `fieldModifier` function from the Metadata Menu API to create modifiable fields within Dataview tables. This function allows for interactive field management directly in your query results. ```javascript const fieldModifier = (dv, p, fieldName, attrs) => { // ... implementation details ... } ``` -------------------------------- ### Field Modifier Function Source: https://mdelobelle.github.io/metadatamenu/api Generates an HTML element to modify a field's value directly within a note. Requires Dataview API, page object, and field name. ```typescript fieldModifier(dv: any, p: any, fieldName: string, attrs?: { cls: string, attr: Record }) => HTMLElement ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.