Ah, okay, that's why I couldn't get any further with my plugin.
Here's what I'm trying to do...
I have stored many legal documents as notes. They can be many pages long; some, twenty or thirty pages in length. As they are legal documents, I cannot alter what is seen in the viewer, but could obviously put hidden comments in the source.
I tag the notes according to the contents of the documents. It's important to note that the tags are not necessarily found in the document itself, so if a document was tagged with 'legal obligation', it's not because that phrase is in the document, but because part or parts of the document relates to the tag (key word). It may be that a document has two sections or more in it which relate to a particular tag. So in a twenty page document, there may be two sentences, or even three whole paragraphs which warrant the tag being putting on in the first place.
Like others, all my notes may have more than one tag, and any tag can be used on multiple documents.
Using my example, if I search for a particular tag, I am presented with all notes that has this particular tag. However, when I open one of these documents, I have no way of knowing which section of the document warranted putting the tag on. i.e. I'd like to be able to go to the exactly place in the note which caused me to put the tag on.
For completeness, I do use
==mark == to highlight sections of interest, but there may be many marked sections in a note, some of which relate to specific tag, whilst other sections will not, so I would still need to scroll through the entire note looking for a section which may relate to the note. I have to almost read the whole note in its entirely every time in order to find the reason for the tag.
I hope that I have explained adequately the issues I face using tags as they stand. Tags could be an incredibly powerful tool for Joplin, if their functionality extended past just putting a label on the whole note. I suppose, I'm looking for a one-to-many relationship between a tag and a particular place in a note.
The plugin, that I was attempting to write would have resulted in me placing hidden tags in the source of the note
<!-- tag:legal obligation -->. I wanted to be able to listen for a click event on the list of tags at the bottom of an individual note, and then scroll the viewing pane to the location of the matching hidden tag. Repeated clicks would take you to the next match.
If there's something that could be done with the core, I 'd be very grateful?