Skip to content

Latest commit

 

History

History
135 lines (110 loc) · 5.14 KB

index.md

File metadata and controls

135 lines (110 loc) · 5.14 KB
slug title package_version author date tags description socialImg socialAlt social editor
post-template
Post Title in Title Case
0.1.0
Author Name1
Author Name2
2020-03-10
Software Peer Review
packages
R
community
A very short summary of your post (~ 100 characters)
blog/2019/06/04/post-template/name-of-image.png
Alternative description of the image
A post about blabla by @username@server.extension!

This is the R Markdown (.Rmd) template for a blog post or tech note. To generate your post with just Markdown (.md), use that template instead.

Throughout this template, including the YAML, you should change "post-template" to the slug of your post, and "2019-06-04" to your publication date.

Save this file under /content/blog/YYYY-MM-DD-slug/index.Rmd in the local copy of your roweb3 fork.

The chunk below ensures your plots will be inserted in the same folder as your Rmd so you can submit the bundle (.Rmd, .md, images) to roweb3.

# Options to have images saved in the post folder
# And to disable symbols before output
knitr::opts_chunk$set(fig.path = "", comment = "")

# knitr hook to make images output use Hugo options
knitr::knit_hooks$set(
  plot = function(x, options) {
    hugoopts <- options$hugoopts
    paste0(
      "`{{< figure src=",
      '"', x, '" ',
      if (!is.null(hugoopts)) {
        glue::glue_collapse(
          glue::glue('{names(hugoopts)}="{hugoopts}"'),
          sep = " "
        )
      },
      ">}}`{=html}\n"
    )
  }
)

# knitr hook to use Hugo highlighting options
knitr::knit_hooks$set(
  source = function(x, options) {
  hlopts <- options$hlopts
    paste0(
      "```r ",
      if (!is.null(hlopts)) {
      paste0("{",
        glue::glue_collapse(
          glue::glue('{names(hlopts)}={hlopts}'),
          sep = ","
        ), "}"
        )
      },
      "\n", glue::glue_collapse(x, sep = "\n"), "\n```\n"
    )
  }
)

The figure paths in the resulting Markdown will already be valid so you won't need to edit the Markdown file.

Section heading in sentence case

Citation of the primary literature1.

Citation of a website2.

Citation of an R package3.

Subsection heading

We recommend the use of Hugo shortcodes to include images, videos, gists, etc. In the Rmd file they need to be between <!--html_preserve--> and <!--/html_preserve-->.

Add an image by using a Hugo shortcode. The image is saved under /content/blog/YYYY-MM-DD-slug/name-of-image.png.

{{< figure src = "name-of-image.png" width = "400" alt = "this is the alternative text" >}}

Consult the Technical Guidelines for tips on changing image size, alignment, and for advice on alternative text.

Below is another image, a plot generated by a code chunk, so you might see how to add alternative text and other options in this case. You can also use all options documented for the figure shortcode except for src that will be created automatically when knitting.

plot(1:10)

Once this file is knitted the plot above will be inserted with the correct syntax.

Tweak code highlighting Below you can see how to use Hugo Chroma code highlighting options: highlight the 1st and 4th to 6th code lines, number lines as a table starting from 199.

a <- 1
a <- 1
a <- 1
a <- 1
a <- 1
a <- 1
a <- 1

Add citation or footnote text by using the format below

Footnotes

  1. Sciaini, M., Fritsch, M., Scherer, C., & Simpkins, C. E. (2018). NLMR and landscapetools: An integrated environment for simulating and modifying neutral landscape models in R. Methods in Ecology and Evolution, 9(11), 2240-2248. https://doi.org/10.1111/2041-210X.13076

  2. Elin Waring, Michael Quinn, Amelia McNamara, Eduardo Arino de la Rubia, Hao Zhu and Shannon Ellis (2019). skimr: Compact and Flexible Summaries of Data. R package version 1.0.7. https://CRAN.R-project.org/package=skimr

  3. Hugo static site generator. https://gohugo.io/