title: How to display images in Markdown on github generated from knitr without using external image hosting?
body: <p>I like uploading repositories to github that include multiple R Markdown and Markdown files.</p>
  
  <p>Here is an <a href="https://github.com/jeromyanglim/gelman-bayesian-data-analysis/blob/master/exercise-2-11-1/exercise-2-11-1.md" rel="noreferrer">example of such a markdown file on github</a>. And here's a screen grab.</p>
  
  <p><hr />
  <img src="https://i.stack.imgur.com/hI7ww.png" alt="enter image description here"></p>
  
  <p><hr />
  The problem is that images do not display. You can click on the image, and you will go to where the file is stored.
  The file referenced is:</p>
  
  <pre><code> https://github.com/... /blob/.../myfigure.png
  </code></pre>
  
  <p>whereas I presume it needs to reference</p>
  
  <pre><code> https://github.com/... /raw/.../myfigure.png
  </code></pre>
  
  <h3>Things I considered:</h3>
  
  <p><strong>imgur:</strong> I could use external image hosting (e.g., <a href="https://raw.github.com/yihui/knitr/master/inst/examples/knitr-upload.Rmd" rel="noreferrer">see this example</a>) by adding the following code:</p>
  
  <pre><code>```{r setup}
  opts_knit$set(upload.fun = imgur_upload) # upload all images to imgur.com
  ````
  </code></pre>
  
  <p>However, for various reasons I don't want to do this (I have trouble uploading when behind a firewall; it's slow; it creates an unnecessary dependency)</p>
  
  <p><strong>Rpubs:</strong> There's also <a href="http://rpubs.com/" rel="noreferrer">RPubs</a> which is quite cool. However, at time of posting it seems more suited to single markdown documents rather than multiple R markdown documents. And it doesn't provide such a close link between source R Markdown and the Markdown document.</p>
  
  <h3>Question</h3>
  
  <ul>
  <li>Is there a workflow for using R Markdown and knitr to produce Markdown files which when uploaded to github permit the Markdown file to display images stored in the github repository?</li>
  </ul>