Auto-Tagger-Plugin

name

Auto-Tagger

icon

tag

description

Finds tags inside a note and adds them to the note

Instructions

This plugin finds all the tags written in a note, wherever they might be, and adds them to the note as actual tags. It makes use of Amplenote's auto-formatting of tags; when you execute the action, for a few seconds you might see wrongly formatted / duplicate tags, that fixes itself automatically. Just open the action menu on a note and let the plugin do it's magic!

Comments and Suggestions are welcome!

❗Currently the tags are found even in codeblocks, so be careful when running the action on a note that contains code which could unwantedly be added as tags.

https://amplenoteplugins.featureupvote.com/suggestions/453466/tags-everywhere

/*
- Add tags within jots
- Add tags within notes
- Add tags to page by action (also for jots?)
- allow the action for all notes on app level?
- should the tags be removed from the text?
- exclude code from code blocks?
*/
{
noteOption: {
"Add all tags" : async function (app, noteUUID) {
const noteContent = await app.getNoteContent({ uuid: noteUUID })
const tags = noteContent.match(/#[a-zA-Z0-9_\-\/]+/g)
for (let i in tags) {
const formattedTag = tags[i].slice(1)
if (formattedTag.length > 0) {
const added = await app.addNoteTag({ uuid: noteUUID }, formattedTag)
console.log(formattedTag)
}
}
}
}
}