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

[revealjs] Setting slide-level does not change the way header in divs are considered as new slides #8098

Closed
cderv opened this issue Jun 2, 2022 · 3 comments
Labels

Comments

@cderv
Copy link
Contributor

cderv commented Jun 2, 2022

This issue is a follow up on #6705 after I stumble upon what I think is an undesired for reveal JS slides.

Take this example

---
title: Reveal
---
# Title 1

## Slide 1

Text.

### Sub Slide header

Text.

## Slide 2

Text.

This will correctly give us 1 title slide, then 2 vertical slide, first of which contains a <h3> header

❯ pandoc test.md --to revealjs --slide-level=2
<section>
<section id="title-1" class="title-slide slide level1">
<h1>Title 1</h1>

</section>
<section id="slide-1" class="slide level2">
<h2>Slide 1</h2>
<p>Text.</p>
<h3 id="sub-slide-header">Sub Slide header</h3>
<p>Text.</p>
</section>
<section id="slide-2" class="slide level2">
<h2>Slide 2</h2>
<p>Text.</p>
</section></section>

Now let's add a Fenced div around the h3 part

---
title: Reveal
---
# Title 1

## Slide 1

Text.

::: fragment
### Sub Slide header

Text.
:::

## Slide 2

Text.

We now get the <h3>, embed in a new <section> and not just a <div>

❯ pandoc test.md --to revealjs --slide-level=2
<section>
<section id="title-1" class="title-slide slide level1">
<h1>Title 1</h1>

</section>
<section id="slide-1" class="slide level2">
<h2>Slide 1</h2>
<p>Text.</p>
<section id="sub-slide-header" class="fragment">
<h3>Sub Slide header</h3>
<p>Text.</p>
</section>
</section>
<section id="slide-2" class="slide level2">
<h2>Slide 2</h2>
<p>Text.</p>
</section></section>

From change in pandoc 2.8 and discussion in #6705, I was under the impression that a section slide should be created for header in divs with level below the slide level.

Why this is a problem ?

<section> in revealjs means a new slide. If you generated a presentation using the above content, the slide navigation will be messed up especially if you activated some other revealjs feature that are based sections like history: true

Try above content with fenced div using this command

pandoc test.md --to revealjs --slide-level=2 -Vhistory=true -s -o test.html

If you open presentation an navigate using keyboard, you won't be able to reach the last slide, it will look withing the first ones.

The overview of presentation slides will show an unexpected empty slide

image

where there is none when not using a fenced div

image

The trick from @tarleb is still working

::: {.fragment}
<!-- -->
### Text 3

Text.
:::

but I was under the impression from #6705 it should have behave differently if --slide-level=2 was set, and h3 used within Div. I tested with version 2.8 though, and it was already working this way creating sections.

Opening this for discussion, if anyone else agree that this should work differently for revealjs presentation than usual HTML.

@tarleb
Copy link
Collaborator

tarleb commented Jun 2, 2022

I think it might make sense to create a new function Text.Pandoc.makeSection' that takes an additional Maybe Int and allows to cut-off section generation at a specific level. I'm currently taking a deeper look at section handling, and there might be a better solution.

It seems that the HTML writer always creates sections, but doesn't always keep them around in the final output. I wonder why we are doing it this way?

@jgm
Copy link
Owner

jgm commented Jun 2, 2022

See also #8097, another manifestation of the complexity we currently have.
I don't remember why we always create sections in the HTML writer, but it may be to get numbering? And then there is #5965.

We could probably special-case this by telling the HTML writer that a Div with class "fragment" should not create a section. Ultimately, though, it would be nice to have a cleaner design.

One natural idea (proposed in #5965) is to add the section divs in T.P.App, prior to calling the writers. But the current design of the HTML writer assumes that we've got the section information in the AST, regardless of --section-divs, so this would require some serious rethinking. There may be other places where this change would also cause problems.

@jgm
Copy link
Owner

jgm commented Jun 2, 2022

We already special-case for 'column' and 'columns', so I'll just add 'fragment'.

@jgm jgm closed this as completed in ad845c0 Jun 2, 2022
cderv added a commit to quarto-dev/quarto-cli that referenced this issue Aug 30, 2024
revert #1053 (cd72d7c) while keeping the test now that it is fixed upstream (jgm/pandoc#8098)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants