dendron
dendron copied to clipboard
Allow for namespace (or new flag) in schema to apply template to arbitrary level of children
Please select if your request is either something new or an enhancement
- [x] Enhancement of an existing Feature.
- [ ] 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.)
- [ ] Workspace - VSCode workspace, vaults, Intellisense/autocomplete, Dendron settings
- [ ] Lookup - Dendron's Lookup Command
- [ ] Views - Dendron Preview, Tree View, Side Panels in the UI
- [x] Schema - Dendron Schemas
- [ ] Pod - Data import from / export to Dendron
- [ ] Publish - External Site Publish
- [ ] Markdown - Markdown features, such as syntax support and features
Is your feature request related to a problem? Please describe
I sometimes have a flexible depth hierarchy, where the level may change but the structure of the note should remain the same.
Describe the solution you'd like
Currently the namespace argument only works for the current and direct child level (https://wiki.dendron.so/notes/c5e5adde-5459-409b-b34d-a0d75cbb1052/#namespace), I would like to have this (or some other flag) to have a namespace consider any depth of hierarchy, both for it classing as within the schema, and it having a specified template applied.
Describe alternatives you've considered
Defining multiple levels of children that all have the same template badged to them, but this is messy and tedious.
Additional context
Extension from the fix in #3381
Thanks for creating a separate request.
I can imagine adding another key, say recursive: true or recursive: {maxDepth} to specify how far deep the namespace node should be applied would work for this, but we should definitely have more discussion around the details of this.
I would like to re-open this, if possible. I have a similar need for a recursive hierarchy and i cannot find a way to do this currently without a messy hack.
Just to explain my concrete use-case... One of the biggest issues i have with most task systems is they prevent infinite recursion, so you often end up with weird hacks like using the notes when you need all the tasks to be linked together. Dendron goes a long way to solving this, but it currently chokes on recursive schemas, which are needed. For example, I want to define a project and task schema as follows:
version: 1
imports: []
schemas:
- id: project
children:
- task-group
- task
parent: root
namespace: true
- id: task-group
namespace: true
children:
- task
- id: task
namespace: true
children:
- task-group
This schema allows me to define a top-level project and then do arbitrary nesting of task-groups and tasks. It is important to keep track of task groups vs tasks for summarization purposes, so I can see just the top-level task groups instead of all the tasks within them and I can use the hierarchy to filter for what level i want in VSCode. This hierarchy should allow for the following pattern:
project.<project-name>.task-group.<task-group-1-name>.task.<task-1-name>.task-group.<task-group-2-name>
Dendron currently throws an error because it infinitely loops the recursive structure.
The hack i have to solve this right now is the following schema
version: 1
imports: []
schemas:
- id: project
children:
- task-group-1
- task-1
parent: root
namespace: true
- id: task-group-1
namespace: true
children:
- task-1
- id: task-1
namespace: true
children:
- task-group-2
- id: task-group-2
namespace: true
children:
- task-2
- id: task-2
namespace: true
This allows the following pattern:
project.<project-name>.task-group-1.<task-group-1-name>.task-1.<task-1-name>.task-group-2.<task-group-2-name>
The disadvantages of this solution:
- repetition in schema definition
- the layer index (-1, -2, etc.) has to show in the filenames/hierarchy, which just feels flawed/hacky when the type of note is the same
I have not really used schemas too much before so maybe there is a better solution. If anyone has a workaround, please reply.