Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- YAML Example:
- ---
- cardtitle: "Action Bias"
- definition: "Our tendency to _favor action over inaction_, often to our benefit."
- ---
- 1. Show prompt. Enter search key.
- 2. Show suggester with all notes that have a desciption containing search key.
- 3. On selection, insert definition in current cursor position
- <%*
- const dv = this.app.plugins.plugins["dataview"].api;
- let keyword = await tp.system.prompt("Look up Definition Card","",true,false);
- keyword = keyword.toLowerCase();
- let query = dv.pages()
- .where(page => page.cardtitle)
- .where(page => page.cardtitle.toLowerCase().includes(keyword));
- if (query.length > 0) {
- let choice = await tp.system.suggester(query.cardtitle, query.cardtitle, false, "Card Title", 30);
- if (choice) {
- let result = dv.pages()
- .where(page => page.cardtitle == choice);
- card = '[[' + result[0].file.name + '|' + choice + ']]';
- tR += '>[!summary] ' + card + '\n>' + result.definition[0];
- }
- }
- %>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement