Shortcut to insert "hidden" inline metadata

Hi all,

What I’m trying to do

I’d like to take “semi-structured” notes about historic events, and I would like these notes to :

  • be both human readable AND dataview queryable.
  • include multiple events in each note through lists.

Example


Class: historicalEvent
eventDomain: Reign of François 1er


  • (eventDescription:: Birth of François 1er) (eventDate:: 1494-12-12)
  • (eventDescription:: Reign of François 1er) (eventDate:: 1494-12-12) to (eventEndDate:: 1547-03-31)
  • (eventDescription:: Battle of Marignan) (eventDate:: 1494-09-13)

Things I have tried

My idea is to use the metadata menu plugin and to define the corresponding class & fields.
eventDomain
eventStartDate
eventEndDate

Now I am a bit stuck - I am looking for a way to accelerate notetaking : in the above example I would like to type “Birth of François 1er” and then press a hotkey that would give me a choice of fields (for instance in a modal) from the Class “historical fact” and let me assign my entry to the property “eventDescription”. Ideally only properties matching the data type would be offered to when I would type “1494-09-13” only date-properties would be suggested.

Any idea / suggestion would be highly appreciated !

Thanks

David

I’m thinking you might be better off using either QuickAdd or Templater possibly in combination with the Multi modal plugin to achieve your goals.

I’m not able to set up a full example, but either combination should be capable of doing this. I’m not very well versed in the metadata menu plugins, but it kind of feels like it might hard to achieve your goals through that plugin. But I might be wrong.

Thanks @holroy for the answer and suggestions. I did dive into this and solved it with a mix of metadata menu, modal forms and templates.

Here is the script I run through Templater - in case someone is interested…

<%* async function titi() {

const metadataMenu = MetadataMenu.api;
let filePath = app.workspace.getActiveFile().path;
const selectedText = tp.file.selection();

// Fetch metadata fields asynchronously
const result = await metadataMenu.fileFields(filePath);

// Create an array of options for the select input
const options = ;
for (const key in result)
{
if (result.hasOwnProperty(key) && key !== ‘fileclass-field-Class’)
{
const label = ${result[key].name};
const value = ${result[key].name};
options.push({ value, label });
}
}

const fileFormObjectFromClass =
{
title: ‘Example form’,
name: ‘Form from Object Class’,
version: ‘1’,
fields:
[
{
name: ‘metadata’,
label: ‘select metadata’,
description: ‘Pick one option’,
input:
{
type: ‘select’,
allowUnknownValues: false,
options,
source:‘fixed’
},
isRequired: false
},
],
};

// Open the form with the populated options
const modalForm = app.plugins.plugins.modalforms.api; const resultFromForm = await modalForm.openForm(fileFormObjectFromClass);

return( ‘(’ + resultFromForm.data.metadata+ ‘::’ + selectedText + “)”);

}

tR += await titi();

%>