Use case or problem
Remember all the available callout types.
Proposed solution
Include an additional level at the top menu bar under Insert/Callout (like Folding has), where the available callout types are listed and can be directly inserted.
Remember all the available callout types.
Include an additional level at the top menu bar under Insert/Callout (like Folding has), where the available callout types are listed and can be directly inserted.
This could be a useful feature request. In the meantime, if you like, you can use this template with templater, replacing the callout names with the ones you want to use, with this syntaxe: type name: 'infos about this type'
<%*
//get selection
noteContent = tp.file.selection();
// list callouts
const callouts = {
note: 'π΅ β Note',
info: 'π’ βΉ Info',
todo: 'π’ βοΈ Todo',
tip: 'π π₯ Tip / Hint / Important',
abstract: 'π π Abstract / Summary / TLDR',
question: 'π‘ β Question / Help / FAQ',
quote: 'π π¬ Quote / Cite',
example: 'π£ π Example',
success: 'π’ β Success / Check / Done',
warning: 'π β Warning / Caution / Attention',
failure: 'π΄ β Failure / Fail / Missing',
danger: 'π΄ β‘ Danger / Error',
bug: 'π΄ π Bug',
};
// return callout
const type = await tp.system.suggester(Object.values(callouts), Object.keys(callouts), true, 'Select callout type.');
//return fold
const fold = await tp.system.suggester(['None', 'Expanded', 'Collapsed'], ['', '+', '-'], true, 'Select callout fold option.');
//return title
const title = await tp.system.prompt('Title:', '', true);
// const calloutHead = `> [!${type}]${fold} ${title}\n`;
//get array of lines
lines = noteContent.split('\n')
//make a new string with > prepended to each line
let newContent = "";
lines.forEach(l => {
newContent += '> ' + l + "\n";
})
//remove the last newline character
newContent = newContent.replace(/\n$/, "");
//define callout header
header = ">[!"+type+"]"+fold + " " + title +"\n"
// Return the complete callout block
return header + newContent;
%>