Skip to content

Instantly share code, notes, and snippets.

@jpbruckler
Created April 28, 2022 01:20
Show Gist options
  • Save jpbruckler/e9b53dd48545a9588a9dff2ebc7ce013 to your computer and use it in GitHub Desktop.
Save jpbruckler/e9b53dd48545a9588a9dff2ebc7ce013 to your computer and use it in GitHub Desktop.
Obsidian.md Templater plugin pattern for multiple choices in a suggester.
<%*
// From: https://forum.obsidian.md/t/quickadd-plugin/20032/70
const responses = [];
let chc = ["Choice 1", "Choice 2", "Choice 3"]
if (!chc.includes("Done")) {
chc.push("Done");
}
// Multiple selection suggester pattern
let r;
while (r !== "Done") {
r = await tp.system.suggester(chc,chc);
if (r !== "Done") {
responses.push(r)
chc = chc.map(s => s === r ? `✅ ${s}` : s);
}
}
-%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment