Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import all Markdown files in a directory #32

Closed
davidak opened this issue Mar 21, 2020 · 2 comments
Closed

Import all Markdown files in a directory #32

davidak opened this issue Mar 21, 2020 · 2 comments

Comments

@davidak
Copy link

davidak commented Mar 21, 2020

This should work:

codimd import /path/to/markdown/files

Workaround

[davidak@X230:~/code/cli/bin]$ for file in ~/Downloads/hackmd/*.md; do xdg-open $(CODIMD_SERVER='https://pad.nixnet.services' ./codimd import "$file" | awk '{print $4}'); done

(You have to open the imported note for it to appear in the history.)

@pirate
Copy link
Member

pirate commented Mar 24, 2020

I don't think this is worth implementing tbh, the bash loop is simple enough, and auto-importing directories is not a behavior that's expected for everyone. e.g if I mistype a path and forget the ending, I don't want it attempting to import every entry in a directory that potentially has thousands of random files in it. Also what if the user wants to import text files that don't end in .md? What about files that start with .? What if there are a mix of files in the directory (e.g. .DS_Store and others the user might not even know about), should we import only the ones that look like markdown and ignore the others? There are lots of edge-cases that make it less intuitive for the average use-case, I think it's safer to force the user to be explicit.

export CODIMD_SERVER='https://pad.nixnet.services'
for file in ~/Downloads/hackmd/*.md
	./codimd import "$file" >> note_urls.txt
done

The URL output will also be fixed by #31, making the xdg-open + awk workaround in your example snippet unnecessary.

@pirate pirate closed this as completed Mar 24, 2020
@deletosh
Copy link

deletosh commented Jun 3, 2023

If a search brought you here, here's a post-codimd version:

export HEDGEDOC_SERVER='https://notes.example.com'  

for file in ~/Downloads/hackmd/*.md 
do
	hedgedoc import "$file" >> note_urls.txt
done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants