For ConTeXt, I have written a module, t-filter, that provides a nice user-interface for running external programs on a file. Using that module, you can write:
\usemodule[filter]
\defineexternalfilter
[markdown]
[filter={pandoc -t context -o \externalfilteroutputfile}]
after which you can use
\processmarkdownfile{....}
to convert a markdown file to context and input the resulting back to tex. (The \defineexternalfilter command also creates an environment \startmarkdown ... \stopmarkdown. The module writes the contents of this environment to an external file, processes file through pandoc, and inputs the result.)
This is essentially a glorified wrapper around \write18. For a one-off task, you can use:
\newcommand\processmarkdownfile[1]
{\immediate\write18{pandoc -t latex -o #1.tex #1}%
\input{#1.tex}}
and then use \processmarkdownfile{...} to include a markdown file in LaTeX. You need to enable write18 for this to work. The easiest method is to pass -shell-escape to pdflatex:
pdflatex -shell-escape <filename>
The t-filter module provides other goodies as well (use an sub directory to store temp files, do not rerun the filter if the file has not changed, etc.). If you want, it is easy to add an interface for them in LaTeX as well.
foo.tex? – Andrew Stacey Oct 10 '11 at 19:58foo.texand so on, but it's nice to have that hook into my AucTeX workflow in emacs, and of course I could write that too, but I was hoping for a quick-and-easy that would be easy to rely on for people who don't have my particular setup. Aditya's answer seems to do exactly what I was hoping for. – aresnick Oct 11 '11 at 20:03