I have an example bookdown project with gitbook output
index.Rmd:
---
title: "An Example Project"
author: "Coderoo"
output:
bookdown::gitbook: default
pandoc_args: ["--lua-filter=hello.lua"]
documentclass: book
---
Some text {{helloworld}}
hello.lua is taken straight from the pandoc lua-filter doc:
return {
{
Str = function (elem)
if elem.text == "{{helloworld}}" then
return pandoc.Emph {pandoc.Str "Hello, World"}
else
return elem
end
end,
}
}
Error in yaml::yaml.load(..., eval.expr = TRUE) :
Scanner error: mapping values are not allowed in this context at line 5, column 16
Calls: <Anonymous> ... parse_yaml_front_matter -> yaml_load -> <Anonymous> -> .Call
Please delete _main.Rmd after you finish debugging the error.
Execution halted
If I replace bookdown::gitbook default in the YAML metadata with html_document then everything works fine.
The short answer is that the default template chokes on the lua argument, which you can see by commenting it out. The long answer is that if you want to hew as closely to the default template as possible, you are going to need to create a custom template, but see@yihui caution
Sometimes you may want to change the overall theme of the output, and usually this can be done through the in_header option described in the previous section, or the css option if the output is HTML. Some output formats have their unique themes, such as gitbook, tufte_html_book, and tufte_book2, and you may not want to customize these themes too much. By comparison, the output formats html_book() and pdf_book() are not tied to particular themes and more customizable.
If I remove default the lua-filter works but the output still looks like the default gitbook. So is it ok to leave out the word default so I don't have to deal with the hassle of creating a custom template?