timvink / mkdocs-table-reader-plugin

MkDocs plugin that enables a markdown tag like {{ read_csv('table.csv') }} to directly insert various table formats into a page
https://timvink.github.io/mkdocs-table-reader-plugin/
MIT License
117 stars 20 forks source link

path to csv should maybe be not relative to the yml location ... #6

Closed codegarden13 closed 4 years ago

codegarden13 commented 4 years ago

"This package tries to be as simple as possible for the user (hide any complexity from the user)"

If a user defines docs_dir, it's a pain to set this relative path for the csv.

timvink commented 4 years ago

Hi!

From the readme:

Where the path is relative to the location of your project's mkdocs.yml file.

Can you elaborate on why it's a pain to set the relative path? I don't think I understand your use-case yet. A guess: you want to specify the path relative to your docs_dir, instead of your mkdocs.yml ?

In my case, the csv's are in a data/ folder in the root directory. If you're putting the csv's in the docs/ folder, I can image it's a bit verbose to specify the path to the docs folder for every {{ read_csv(path) }}.

Any ideas on how to improve this behaviour? Perhaps add a setting (true/false) to use the path relative to the docs_dir instead of the mkdocs.yml file?

codegarden13 commented 4 years ago

Hi Tim,

I think you understood the problem. Your guess is right - and I want to keep my csv files INSIDE my docs_dir. And I am a user - I tried around and did not find the way to specify a working path.

The true/false setting could be the right way (I am not a developer in python).

Maybe a path setting (relative to where) would be more universal.

But True/false would do the job.

OR the option to declarate the location like { read_csv(abspath) } where the document could be anywhere ?

Kind regards and thank you for your work !

Thomas

Am 17.06.2020 um 11:09 schrieb Tim Vink notifications@github.com:

Hi!

From the readme:

Where the path is relative to the location of your project's mkdocs.yml file.

Can you elaborate on why it's a pain to set the relative path? I don't think I understand your use-case yet. A guess: you want to specify the path relative to your docs_dir, instead of your mkdocs.yml ?

In my case, the csv's are in a data/ folder in the root directory. If you're putting the csv's in the docs/ folder, I can image it's a bit verbose to specify the path to the docs folder for every {{ read_csv(path) }}.

Any ideas on how to improve this behaviour? Perhaps add a setting (true/false) to use the path relative to the docs_dir instead of the mkdocs.yml file?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/timvink/mkdocs-table-reader-plugin/issues/6#issuecomment-645253919, or unsubscribe https://github.com/notifications/unsubscribe-auth/APY5DV4IWPM76ZWNXOGD4DLRXCB5NANCNFSM4N75Z46A.

timvink commented 4 years ago

Yes probably specifying a path would give the most flexibility, f.e. by adding a data_path option.

I'll work on this for a next release, but low prio for me currently. pull requests always welcome of course.

{{ read_csv(abspath) }} should already work btw.

timvink commented 4 years ago

Hi @codegarden13 ,

I just released v0.4, let me know if this fixes the issue for you!