Get errors when I include `webp` type figures in rmd document

When I use include_graphics function to include webp figures in the RMarkdown document, I find in the knitting process, there is a warning output file: file_name.knit.md.
However, I just want to knit an HTML document instead of md document.

And I get such an error.

Could not determine mime type for `figure/softmax_eq.webp'
错误: pandoc document conversion failed with error 63
停止执行

And I find this error happens related to package mime

> library(mime)
> guess_type("figure/shadow-bank01.webp")
[1] "application/octet-stream"

My questions are

  1. Is there any possibility to avoid .knit.md building. I guess it results in error.
  2. Any tips to include a webp figure? I know Yihui and other advanced R users recommend png or jpg. However, in China, all figure in a WeChat Article is loaded in webp.

Temporally, I solve this problem by changing the output type, from html_document to bookdown::gitbook. But the figures does not display.

And I also try

  1. bookdown::html_document2
  2. bookdown::tufte_html2

they also don't work.

The .knit.md is needed in the process because it is like that rmarkdown works.
RMD :arrow_right: MD :arrow_right: html using pandoc in the last step.

In order to see if there is a issue, a reprex would be helpful.

Hi @cderv I find it is hard to use reprex when the code on the clipboard includes the render() function.
I get this error.

> reprex(si=T)
Rendering reprex...
Error: pandoc document conversion failed with error 5

Thus, I upload the related document.

  1. the webp fiile, https://github.com/JiaxiangBU/picbackup/blob/master/gantt1.webp?raw=true
  2. the rmd file, https://github.com/JiaxiangBU/picbackup/blob/master/sample-webp.Rmd

The two are in the same directory.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.