blakedietz / vscode-nested-tags

Stop using your file tree to organize your notes. Transform VSCode into a note-taking app by adding tag support.
MIT License
74 stars 17 forks source link

question - how to scan file(s) for tags and add them into the yaml header? #57

Open aisbergde opened 4 years ago

aisbergde commented 4 years ago

Are there any ideas how files could be parsed to find tags that follow some syntax (for example #aaa, +bbb, @ccc and add them into the YAML header if not yet there?

And maybe also to remove non existing tags from YAML header?

I tried with powershell and regex and I think I would be able to find tags, but then they should be included into the yaml header to get them listed. And I am not a specialist for powershell, maybe there is something ready to use?

I know this is not a feature of this extension, but it is somehow related, because I want to use tags when I write text directly in the text and they should be available.

blakedietz commented 4 years ago

Ah, so are you requesting a custom tag directive to use instead of @nested-tags? Are you essentially looking to define a custom tag in the header which would then be parsed in the file itself and added to the tag tree?

aisbergde commented 4 years ago

your comment shows a nice way how to do.

Another idea I have is to process files to scan for tags and to write them into the yaml header. Scanning for tags I did with a simple PowerShell script and regex search. This works fine. This is a read only operation and it will not change the file content. Now I think if I also should read the yaml front matter content, update the tag list and write back the yaml front matter, but this is no more a read only operation.

I don't know how the extensions scanes for tags, if regex is used, then maybe some additional setting for the whole extension could add additional search patterns to be detected?