Question

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?

Was it helpful?

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.

OTHER TIPS

Use pandoc — it's a commandline tool that lets you convert from one format to another. This tool supports Markdown to HTML and back.

E.g. to generate HTML from Markdown, run:

pandoc -f markdown index.md > index.html

I use this in a .bat file:

@echo off
for %i in (*.txt) python markdown.py "%i"

// using Bash in mac

for i in *.md; do asciidoc  $i;  done; 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top