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

--slide-level in reveal.js presentation has a weird behaviour #5168

Closed
pagdot opened this issue Dec 21, 2018 · 6 comments
Closed

--slide-level in reveal.js presentation has a weird behaviour #5168

pagdot opened this issue Dec 21, 2018 · 6 comments

Comments

@pagdot
Copy link

pagdot commented Dec 21, 2018

Pandoc Version 2.5

In my experience the slide-level paramter doesn't alsways work as intended and sometimes has a really weird behaviour.

This issue is not about content getting dropped!

Example 1

Example markdown:

---
title: Breaking slide levels
author: Paul Götzinger
revealjs-url: https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.7.0/
---

# Header 1

## Header 2

### Header 3

### Header 3

Command used to create html:

pandoc -s -t revealjs --slide-level 1 .\slides.md -o .\slides.html -V revealjs-url=https://cdnjs.cloudflar
e.com/ajax/libs/reveal.js/3.7.0/

I only change the slide level in the command.

Slide level 1

Only top-level slides. Works as intended.

Slide level 2

Header 1 gets converted to a section, Header 2 gets converted to a slide. Works as intended

Slide level 3

Same output as with --slide-level 2. Does not work as intended.

Example 2

Example markdown:

---
title: Breaking slide levels
author: Paul Götzinger
revealjs-url: https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.7.0/
---

# Header 1

### Header 3

### Header 3

Command used to create html:

pandoc -s -t revealjs --slide-level 1 .\slides.md -o .\slides.html -V revealjs-url=https://cdnjs.cloudflar
e.com/ajax/libs/reveal.js/3.7.0/

I only change the slide level in the command.

Slide level 1

Only top-level slides. Works as intended.

Slide level 2

Because Header 2 is not available it somehow breaks the presentation and the content overlays the section slide:

grafik

Does really not work as intended.

Slide level 3

Header 1 gets converted to a section, Header 3 gets converted to a slide. Works as intended

@mb21
Copy link
Collaborator

mb21 commented Dec 21, 2018

Have you seen http://pandoc.org/MANUAL.html#structuring-the-slide-show ? Especially:

Content above the slide level will not appear in the slide show.

@pagdot
Copy link
Author

pagdot commented Dec 21, 2018

Have you seen http://pandoc.org/MANUAL.html#structuring-the-slide-show ? Especially:

Content above the slide level will not appear in the slide show.

Yes. My issue isn't related to missing content. Under certain conditions the Slide level seems to be ignored (Example 1, slide level 3) or if no matching header is found the content should be at least truncated and not overlay the section

@jgm
Copy link
Owner

jgm commented Dec 22, 2018

It would be helpful if you could look at the HTML structure pandoc produces with these options and say how you think it should be revised. reveal.js is a bit different from the other formats because of the 2D structure.

@pagdot
Copy link
Author

pagdot commented Dec 24, 2018

I have looked at it again and compared the HTML structure. I've copied only relevant HTML code without title slide and formatted it to understand it easier.

Example 1

Slide level 2

<section>
    <section id="header-1" class="title-slide slide level1">
        <h1>Header 1</h1>
    </section>
    <section id="header-2" class="slide level2">
        <h2>Header 2</h2>
        <h3 id="header-3-1">Header 3-1</h3>
        <h3 id="header-3-2">Header 3-2</h3>
    </section>
</section>

Slide level 3

<section>
    <section id="header-1" class="title-slide slide level1">
        <h1>Header 1</h1>
    </section>
    <section>
        <section id="header-2" class="title-slide slide level2">
            <h2>Header 2</h2>
        </section>
        <section id="header-3-1" class="slide level3">
            <h3>Header 3-1</h3>
        </section>
        <section id="header-3-2" class="slide level3">
            <h3>Header 3-2</h3>
        </section>
    </section>
</section>

Pandoc seem to add a higher depth to sections than supported which causes issues with side generation and content placement.

Slide level 3 revised

According to the documentation of --slide-level i rearranged the slides and slide levels.

<section>
    <section id="header-1" class="title-slide slide level1">
        <h1>Header 1</h1>
    </section>
</section>
<section>
    <section id="header-2" class="title-slide slide level2">
        <h2>Header 2</h2>
    </section>
    <section id="header-3-1" class="slide level3">
        <h3>Header 3-1</h3>
    </section>
    <section id="header-3-2" class="slide level3">
        <h3>Header 3-2</h3>
    </section>
</section>

Example 2

Slide level 1

<section id="header-1" class="slide level1">
    <h1>Header 1</h1>
    <h3 id="header-3">Header 3</h3>
    <h3 id="header-3-1">Header 3</h3>
</section>

Slide level 2

<section>
    <section id="header-1" class="title-slide slide level1">
        <h1>Header 1</h1>
    </section>
    <h3 id="header-3">Header 3</h3>
    <h3 id="header-3-1">Header 3</h3>
</section>

Because the given slide level doesn't match any header, the truncation of worng placed content seem to be missing.

Slide level 2 revised

According to the documentation of --slide-level i truncated the wrong placed contet.

<section>
    <section id="header-1" class="title-slide slide level1">
        <h1>Header 1</h1>
    </section>
</section>

@jgm
Copy link
Owner

jgm commented Jan 8, 2019

Example 2 isn't a real problem. The level 3 headers are below the slide level, so they're considered part of the slide. They shouldn't be truncated. (Sorry, I missed that you tried it also with --slide-level=2. I agree that the output here is broken, though it's not a huge concern, since it's probably only by mistake that someone would specify --slide-level=2 here. I think the best thing would be not to truncate the level 3 headers, but to include them on a titleless slide. They do need to be wrapped in a <section>, though.)

In Example 1 there may be a real issue with --slide-level=3, since reveal.js apparently expects at most 2 levels of section element nesting, and we provide more. Your suggested output seems like a good approach.

@jgm jgm closed this as completed in c1d058a Jan 8, 2019
@fernandezcuesta
Copy link

Hi,
before this commit the following markdown:

---
title: my slides
author: me
date: 1 Jan 2019
---

# Slide title
#### section header

## second level
content

## yet another slide
more content

# Second section
#### second section header

## etc
etc

was being rendered as a set of vertical slides with a common header (i.e. section header). This behaviour was lost since 2.6, I guess as a side effect of this fix.

jgm added a commit that referenced this issue Sep 9, 2019
Text.Pandoc.Shared:

+ Remove `Element` type [API change]
+ Remove `makeHierarchicalize` [API change]
+ Add `makeSections` [API change]
+ Export `deLink` [API change]

Now that we have Divs, we can use them to represent the structure
of sections, and we don't need a special Element type.
`makeSections` reorganizes a block list, adding Divs with
class `section` around sections, and adding numbering
if needed.

This change also fixes some longstanding issues recognizing
section structure when the document contains Divs.
Closes #3057, see also #997.

All writers have been changed to use `makeSections`.
Note that in the process we have reverted the change
c1d058a
made in response to #5168, which I'm not completely
sure was a good idea.

Lua modules have also been adjusted accordingly.
Existing lua filters that use `hierarchicalize` will
need to be rewritten to use `make_sections`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants