mixu / markdown-styles

Markdown to static HTML generator and multiple CSS themes for Markdown
1.85k stars 251 forks source link

File contents deleted #55

Open welchr opened 7 years ago

welchr commented 7 years ago

I ran this rather naively today in a directory and noticed it copying non-markdown files to themselves, which seemed odd, so I hit CTRL+C to stop and take a look. It had deleted the contents of all files it had a chance to access before I stopped it with CTRL+C and left them with 0 filesize. Luckily the files were checked into git and I was able to retrieve them with a quick reset, but this seems like a rather scary issue.

The command I ran was:

generate-md --input . --output . --style github

The current directory had a few markdown files to convert, but subdirectories underneath had code files.

Entirely possible that I read the documentation incorrectly. In general though you probably don't want to modify existing files in the --input directory or any of its subdirectories.

mixu commented 7 years ago

ahh good point, the intent is that the directories in --input and --output are different - e.g. rendering a git repo to a folder that will then be pushed to a s3 bucket

should add a check that --input and --output are not the same folder!