This is in my .md document:

![Step 1](Slide1.png){ width=100px }  
![Step 2](Slide2.png){ width=100px }  
![Step 3](Slide3.png){ width=100px }  
![Step 4](Slide4.png){ width=100px }  
![Step 5](Slide5.png){ width=100px }  
![Step 6](Slide6.png){ width=100px }  
![Step 7](Slide7.png){ width=100px }  
![Step 8](Slide8.png){ width=100px }  

This is how I use Pandoc:

pandoc foo.md -f markdown+link_attributes -s -o foo.pdf

The link_attributes are completely ignored, and { width=100px } appears as plaintext after every image.

What is the correct way of setting image size in Pandoc markdown?


As far as I can see, you are using the width parameter correctly. An alternative way supported by Pandoc is to use percent ('%') instead of pixels ('px'):

![Step 1](Slide1.png){ width=13% }  

Which Pandoc version are you using? Now, 2 years after your OP, the current Pandoc is v2.5. And it produces the correct result:

cat foo.md

  ![Step 1](Slide1.png){ width=100px }  
  ![Step 2](Slide1.png){ width=600px }  
  ![Step 3](Slide1.png){ width=66% }  

No need even to specify -f markdown+link_attributes -s:

pandoc         \
    -o foo.pdf \

This is a screenshot from the result:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.