Images in Different File Formats
I have investigated the different methods for inserting images into various file formats and conversion procedures.
Image handling in .Rmd, .md and .Rmarkdown files
- At first I looked on the various options for handling of images in .Rmd files.
- Then – as a contrast program – I tested the outcomes of image handling procedures in .md files.
- And finally I investigated the image procedures in.Rmarkdown files.
Observed results
The situation is complex and not easy to grasp. But on a meta-level, the case is pretty straightforward: The decision for a file format is much more important than the details in image handling.
.Rmd
: The window provided via Visual R Markdown provides all its great features only in .Rmd files. With the new page bundle feature in Hugo some disadvantages of .Rmd file disappear: As every file is in its own folder the several files produced by the conversion process do not hamper anymore. But .Rmd files loose some of the nice features of the Academic theme, e.g., the table of contents on the ride side. Also the chunk optionfig.align
does not work with the Academic theme. To date I could not find & solve the annoying problem..Rmarkdown
: It turns out that .Rmarkdown files have the greatest advantages. They have now almost the same features of R Markdown (writing and applying R code, using references and bibliography), but provides also the benefits of the (Academic) theme via the Goldmark renderer. Yes, you can’t use the full functionality of the Visual R Markdown window for including images but you could use instead the Hugo figure shortcode.1
So the situation is pretty straightforward: The Hugo figure shortcode is for all different file formats a good solution. In the case of .Rmd files they have to be embedded in an HTML-chunk as demonstrated in the .Rmd post.
Additional tip
RStudio markdown snippet do not work in .md files. I do not understand why not. Ok, there is no R programming code but it coud be used for other (text) snippets. RStudio markdown snippet do work with .Rmarkdown files. So I have prepared an snippet to include the Hugo figure shortcode syntax and saved under ‘ff’. So I just need to type ff + SHIFT-Tab
to get a template with all the parameters .
At the moment I do not know if using the
figure
shortcode results in some processing penalties. At least I read and experienced it myself that with many images the standard time-out parameter for Netlify has to be set much higher than the standard 10 seconds. ↩︎