3

I'm wondering does anyone know how to correctly change the base format for a blogdown site. I want to use the tufte::tufte_html format to render my Rmd files, but I can't seem to work out how to do this correctly.

Setting the output in the YAML front matter like such

title: "My New Post"
subtitle: "An implementation in R Markdown"
output: tufte::tufte_html

Doesn't render the Rmd into a html file with tufte classes. It also spits out the warning message

In get_engine(options$engine) :
  Unknown language engine 'marginfigure' (must be registered via knit_engines$set()).

I've also tried setting the _output.yml file in the root of my blogdown site to

blogdown::html_page:
  base_format: bookdown::tufte_html2

But this doesn't work either. I can see that the issue is trying to pass the correct output format into the blogdown::html_page function, but I'm not sure how through YAML. It might be the case that I need to write my own output format function totally?

This is the code for blogdown::html_page

function (..., number_sections = FALSE, self_contained = FALSE, 
  highlight = NULL, template = NULL, post_processor = NULL) 
{
  if (identical(template, "default")) 
    stop("blogdown::html_page() does not support template = \"default\"")
  if (identical(highlight, "textmate")) 
    stop("blogdown::html_page() does not support highlight = \"textmate\"")
  if (is.character(post_processor)) 
    post_processor <- eval(parse(text = post_processor))
  rmarkdown::output_format(knitr = NULL, pandoc = NULL, clean_supporting = self_contained, 
    post_processor = post_processor, base_format = bookdown::html_document2(..., 
      number_sections = number_sections, theme = NULL, 
      self_contained = self_contained, highlight = highlight, 
      template = template %n% pkg_file("resources", "template-minimal.html")))
}

I think that I need to change this function to base_format = bookdown::tufte_html2(..., etc) to make this work.

If anyone has any thoughts, they are very welcome!

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.