Inserting specific answer with selected dropdown option

How to input a command by defining a template or template tag that corresponds to each dropdown option using Meta Bind Plugins, and then inserting the specific answer associated with the selected dropdown option? Thanks.

Proposed solution

Current workaround (optional)

Related feature requests (optional)

Never tried the Meta Bind plugin as probably what I wanted for myself can be done with Templater javascript and with a little fiddling around and with help on the forum one can incorporate bits of code to suit one’s use case.

One can use the suggester for drop-down functionality:

<%*
const editor = app.workspace.activeLeaf.view.editor;
const selection = editor.getSelection();
const tagg = await tp.system.suggester(
    [
		"mermaid",
		"plantuml"
    ],
    [
		"mermaid",
		"plantuml"
    ]
);

if (tagg !== null && tagg !== undefined && tagg !== '') {
	if (tagg === 'mermaid') {
        tR += "```mermaid\n" + selection + "\n```";
    } else if (tagg === 'plantuml') {
        tR += "```plantuml-svg\n" + selection + "\n```";
    }
} else {
    return;
}
_%>
  • I just trimmed a larger code to show some examples. (This snippet can be used to wrap selected text in html tags, for instance.)

As I said, I’m not conversant with the workflow sought for, I’m just throwing this up here.
Then anybody can take it further.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.