jakewvincent / mkdnflow.nvim

Fluent navigation and management of markdown notebooks
GNU General Public License v3.0
695 stars 41 forks source link

Question: Specifying perspective for a collection of notebooks #118

Open venzen opened 1 year ago

venzen commented 1 year ago

I am both a teacher and coder, so I have notebooks for both code documentation and lesson plans. Currently, I have a landing page (index.md) in a root folder called .notebooks. This landing page is a table of contents that links to MD pages inside subdirectories Teaching and CodeDocs. These subdirectories contain their own subdirectories e.g. EnglsihLessons, LegalEnglish and MedicalEnglish. Inside each of these sub-sub-directories there is a more detailed table of contents page e.g. ../Teaching/LegalEnglish/legal-index.md. This legal-index.md contains links to MD files in further sub-directories.

So there are a lot of subdirectories and, as you can imagine, specifying paths is tedious. It would be useful to have index.md pages in the major topic directories so that links are created relative to these sub-directories, rather than to the root directory notebooks .

I guess I have created a wiki organized into multiple subdirectories. Can Mkdnflow handle multiple roots in arbitrary subdirectories? My reason for wanting multiple roots is so that Mkdnflow will correctly create relative link paths in each of several embedded 'root' directories.

Is there a way to specify perspective in the config file, to allow my use case? On the other hand, if abandoning the heavily branched directory structure would be a more elegant solution, I am also open to that.

ekliot commented 1 year ago

I'm running into a similar issue with sub-wikis. My current solution is to have an index.md file for each sub-wiki to specify a root, and reopen nvim in another tmux window for each wiki I want to open.

I've been poking at the source to see if there's a straightforward way to re-set the perspective-root while in nvim (something like :MkdnflowSetRoot), and I found require('mkdnflow').paths.updateDirs(), but it doesn't (to my knowledge) work with child wikis in a parent wiki. e.g.

wiki/
|-- index.md
|-- sub1/
    |-- index.md
|-- sub2/
    |-- index.md

If I'm in sub2/index.md the root is (correctly) /path/to/wiki/sub2/. If I then open wiki/index.md, the root_dir doesn't update. I think this might be due to how the string matching to determine roots works, but my lua-fu is too weak to confirm that.