Why is my image embedded in .md not displayed on Github

人盡茶涼 提交于 2020-01-06 07:14:12

问题


Assume, you have have the following Rmd (see ../Christoph999/Test/blob/master/test.md

---
title: "Untitled"
author: "Myname"
date: "5 April 2019"
output:
  html_document:
    keep_md: yes
    number_sections: yes
    toc: yes
    toc_depth: 2
  pdf_document:
    number_sections: yes
    toc: yes
    toc_depth: '2'
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

text

![Some text here.](../project/pics/myimage.png?raw=true){width=400px}

text

I pushed everything to github with pictures in /project/pics/ (the .md file is in /project. But images are not displayed when I view the .md file. When I move the mouse over the caption it says

https://github.com/user/project/blob/project/pics/myimage.png?raw=true

What does the blob/ appear? When running from RStudio, everything looks fine. I'd really appreciate, if that works. (I use Firefox)

Edit The folder structure looks like

/project  
  /.git
  /pics  
    *myimage.png  
  * Rmd  

and ../project/pics/myimage.png should point to the correct place?


回答1:


Thank's to @richard Telfor, the solution is

text

![Some text here.](pics/myimage.png?raw=true){width=400px}

text

Be careful: The code does NOT work with pdf, see here



来源:https://stackoverflow.com/questions/55543700/why-is-my-image-embedded-in-md-not-displayed-on-github

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!