Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set good default for toc-depth and toc-title when using pandoc TOC #123

Open
cderv opened this issue Sep 17, 2021 · 3 comments
Open

Set good default for toc-depth and toc-title when using pandoc TOC #123

cderv opened this issue Sep 17, 2021 · 3 comments

Comments

@cderv
Copy link
Collaborator

cderv commented Sep 17, 2021

Currently we have the toc variable in the template

$if(toc)$
<section id="$idprefix$TOC">
$toc$
</section>
$endif$

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.

@cderv
Copy link
Collaborator Author

cderv commented Sep 23, 2021

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

@cderv
Copy link
Collaborator Author

cderv commented Sep 23, 2021

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.

cderv added a commit that referenced this issue Sep 23, 2021
Related to #123 and alignement with `html_document()` behavior
@cderv cderv changed the title Support for toc, toc_depth and toc-title Set good default for toc-depth and toc-title when using pandoc TOC Sep 23, 2021
@cderv
Copy link
Collaborator Author

cderv commented Sep 23, 2021

#127 brings support to the variable. We need to use good default now with maybe bringing toc-title as an argument of the output format function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant