Snippets plugin note


name

Snippets

icon

Segment

description

Allows you to insert re-usable sections within the note.

instructions

Create your reusable sections as an individual note and tag them.

Configure the snippetsTag setting to specify the tag you are using to identify the notes.

Start typing { to access the plugin.










setting

snippetsTag


{
async insertText(app) {
const snippetsTag = app.settings["snippetsTag"];
const noteHandles = await app.notes.filter({ tag: snippetsTag });
const sectionOptions = noteHandles.map(n => { return {label: n.name, value: n.uuid}})
const selectedOption = sectionOptions[0] ? sectionOptions[0].value : ""
const snippetUuid = await app.prompt("Select the snippet you want to insert",
{
inputs: [
{ type: "select", options: sectionOptions, value: selectedOption}
]
}
)
const markdown = await app.getNoteContent({ uuid: snippetUuid });
const destinationNote = await app.notes.find({uuid: app.context.noteUUID});
app.context.replaceSelection(markdown)
return ""
}
}