dendron icon indicating copy to clipboard operation
dendron copied to clipboard

Write functions to update information

Open Leoriem-code opened this issue 3 years ago • 2 comments

Please select if your request is either something new or an enhancement

  • [ ] Enhancement of an existing Feature.
  • [x] Request of a new feature.

Please select the area your request applies to. (Multiple selections are Possible. You can leave blank if you're not sure.)

  • [x] Workspace - VSCode workspace, vaults, Intellisense/autocomplete, Dendron settings
  • [ ] Lookup - Dendron's Lookup Command
  • [ ] Views - Dendron Preview, Tree View, Side Panels in the UI
  • [ ] Schema - Dendron Schemas
  • [ ] Pod - Data import from / export to Dendron
  • [x] Publish - External Site Publish
  • [ ] Markdown - Markdown features, such as syntax support and features

Is your feature request related to a problem? Please describe

I'm in the process of writing down a lot of recipes that I like, and I'm frustrated by the repetitiveness of typing in the tags if the recipe is vegan or not.
I would like for a system to exist that would allow us to write "functions" that would be able to write things in a file.

Do mind that it's a broader problem than just writing recipe.

Describe the solution you'd like

Define a function that will look for links (following rules that we can change, like needing to begin with "xxx.yyy") in a file.
Read files, get information.
Apply a function to the results (like 'add every element a' or 'chains of "or"'). Write the result next to the function name (like it's done for updated and created), when publising overwrite the function name with the result.

Describe alternatives you've considered

We could use a lot of {{variable}} but I don't think we can compare variable and it seems very tedious to do it otherwise.
We can also use a external program to do it but we would have to launch it manually, so meh.

Additional context

When the function look for links, we would need to tell it where to look, because we may not want to look through every link in the file, but only some. In my example, the interesting links are all under the '## Ingredient' title.

This could be used to update information automatically, and so could be useful in different way, like doing stats, update tags, etc.

Leoriem-code avatar Aug 27 '22 09:08 Leoriem-code

Thanks @Leoriem-code for the suggestion 🙏 Can this solution be solved alternatively with the help of templates/note traits? i.e. each time you create a note it gets populated with specific headers (eg: ## Ingredients) and tags (#veg)?

Harshita-mindfire avatar Aug 29 '22 07:08 Harshita-mindfire

Unfortunately no, because while we could add the tags automatically, we would sometimes need to remove them (i.e. if there is meat in the recipe).

While tedious, it could be used for the example I gave, but it is not what I am after.
Moreso if we want to add other tags (i.e. kosher) after creating recipes.

But still, thanks for trying to help.

Leoriem-code avatar Aug 29 '22 09:08 Leoriem-code