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,
}
}
But when I try to build the book:
Rscript -e "bookdown::render_book('index.Rmd','bookdown::gitbook')"
I get this error:
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.
Crossposted here: https://stackoverflow.com/questions/59523765/how-to-use-lua-filter-with-bookdown-gitbook-output