bashmarkdown

How can I convert Markdown documents to HTML en masse?


I'm writing some documentation in Markdown, and creating a separate file for each section of the doc. I would like to be able to convert all the files to HTML in one go, but I can't find anyone else who has tried the same thing. I'm on a Mac, so I would think a simple bash script should be able to handle it, but I've never done anything in bash and haven't had any luck. It seems like it should be simple to write something so I could just run:

markdown-batch ./*.markdown

Any ideas?


Solution

  • This is how you would do it in Bash.

    for i in ./*.markdown; do perl markdown.pl --html4tags $i > ${i%.*}.html; done;
    

    Of course, you need the Markdown script.