Set good default for `toc-depth` and `toc-title` when using pandoc TOC
cderv opened this issue · 3 comments
Currently we have the toc
variable in the template
It can be activated using
output:
revealjs::revealjs_presentation:
pandoc_args: "--toc"
We need to add the toc: true
argument to the function. But it is quite scarce for now as it will just add a slide with TOC content.
Pandoc's current template is better and offer to customize the toc-title
that we are missing
https://github.com/jgm/pandoc/blob/d133d737ae4a9f37d0eb6361b3b367157d3dc3bf/data/templates/default.revealjs#L63-L72
toc-title
is supported in template since 2.14 only: jgm/pandoc@96d384a (jgm/pandoc#7171)
So we need to at least update that to the template.
And with this maybe #69 is not needed.
Thoughts about defaults:
toc = FALSE
like in html_document()
. Adding a TOC slide should be only when user decides
toc_depth = 1
could be a good default to only show on TOC slide the main headers. But that supposes h1 are used #
for slides (slide_level = 2
). So maybe toc_depth
should default to slide-level
- 1, and to 1 if slide_level = 0
is used
Do we want to add a default toc-title
value like "Outline" ? Or should it be user provided only ? Also, should we add it as argument in the function ?
It could always be set using toc-title
in YAML header but toc
and toc_depth
are argument in html_document()
already. Not toc_title
toc_depth = slide_level - 1
does not work if slides only contains the slide level header (like the skeleton only using ##
). pandoc default is 3 but it is not ideal.
I'll take more time to think about this and just add the variables for now.