dendronhq / dendron

The personal knowledge management (PKM) tool that grows as you do!
https://wiki.dendron.so
Apache License 2.0
6.62k stars 252 forks source link

Import is replacing dots in filenames with dashes but I want it to recognize hierarchy #2884

Open bugfixd opened 2 years ago

bugfixd commented 2 years ago

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

Describe the bug

I am doing batch importing of Markdown files. I have named my files using dot delimited filenames, with the goal of importing them into my Dendron hierarchy.

However, Dendron is treating the dots as part of the filenames and replacing the dots with dashes, rather than interpreting the dots as representing hierarchy.

For example, if I import the following files:

pets.cats.fluffy.md pets.dogs.rover.md

then when Dendron imports them, it renames them to:

pets-cats-fluffy.md pets-dogs-rover.md

To Reproduce

Steps to reproduce the behavior:

  1. Create files to import using dot delimited filenames representing Dendron hierarchy.
  2. Run the command: Dendron: Import Pod > dendron.markdown
  3. Check the imported files, which have been renamed to replace dots with dashes in the filenames.

Expected behavior

When I import files which I have intentionally named using dots to represent hierarchy, I want them to be imported with the dots intact so that they are properly incorporated into my Dendron hierarchy.

Suggestion: Perhaps a setting could be added to the Markdown import pod configuration file (Dendron\pods\dendron.markdown\config.import.yml) to specify how dots in filenames should be handled.

Screenshots

Dendron 2022-05-05 pets-cats-fluffy

Desktop

aleksey-rowan commented 2 years ago

Hey, @bugfixd, if you have markdown files and you've already renamed all your files the way you want them to appear in hierarchies, you can just manually copy them into your vault, reload VSCode, and run Dendron's `Doctor: fixFrontmatter" command to add the missing frontmatter and that's it.

bugfixd commented 2 years ago

Hi @aleksey-rowan, thanks for that suggestion. It's a good workaround. 👍

But compared to a proper import, it's not as easy and it takes more steps. Note that importing also handles assets, automatically moving them into the assets folder and refactoring asset links in the notes. :)

hikchoi commented 2 years ago

Hey @bugfixd, thank you for the report.

This is the expected behavior. Changing them into dots is necessary because we can't assume all of our users have their file names already in a dot hierarchy form.

That being said, I think your suggestion makes sense. Do you mind if I change this into a feature request instead of a bug since it is working as intended?

@Harshita-mindfire pinging for visibility. Can we add a config / prompt to ask if the user wants dots treated as hierarchies?

bugfixd commented 2 years ago

Hi @hikchoi, thanks for your help. :) Sure, go ahead and change it into a feature request. 👍