I used knitR to convert R Markdown files to Markdown, and I'm trying to use Pandoc to convert them into HTML/PDF.
Markdown to HTML includes all my images in the output, using
pandoc test.md -o test.html
However, Markdown to PDF doesn't include any of my images in the output, using
pandoc test.md -o test.pdf
(there are other options because I am doing syntax highlighting that will show up in printed output, but no combination of them seem to include images in the PDF output).
In the actual Markdown file, images are referenced as:
<img src="images/image_to_include.png" title="Default title" alt="alt text" style="display: block; margin: auto;" />
where image_to_include.png is in the images subdirectory. The alternate text is not displaying either.
I would like to know how to get images to appear in the PDF output of Pandoc, but I am also curious to know why HTML seems to allow it and PDF doesn't.
My OS is Yosemite and I have installed MacTeX.
Best Answer
Pandoc includes raw HTML only if the output format is HTML-like. From the web-site:
In order to get images to work for both, HTML and PDF writer, you have to use pandoc's own format: