Out of curiosity, are the different components of the R Markdown output formats documented anywhere? I haven't came across any comprehensive documentation as of yet. In particular, explaining when each of the hooks are called, what the input arguments are, and what the return value must be?
str(rmarkdown::html_document(), 1)
#> List of 11
#> $ knitr :List of 5
#> $ pandoc :List of 7
#> $ keep_md : logi FALSE
#> $ clean_supporting : logi TRUE
#> $ df_print : chr "default"
#> $ pre_knit :function (...)
#> $ post_knit :function (...)
#> $ pre_processor :function (...)
#> $ intermediates_generator:function (original_input, intermediates_dir)
#> $ post_processor :function (metadata, input_file, output_file, clean, verbose)
#> $ on_exit :function ()
#> - attr(*, "class")= chr "rmarkdown_output_format"