Pandoc: Missing vertical slides in revealjs

Created on 28 Jan 2018  路  14Comments  路  Source: jgm/pandoc

Hi !

I am trying to generate slides from Markdown to RevealJS with pandoc.

The problem is that i don't have vertical slides , like revealjs can provide. instead everything is packed into the first level slide.

Here is a short example to reproduce:

Makefile:
~~~Makefile
all:
pandoc \
-t revealjs \
--standalone \
--self-contained \
-o prez.html \
prez.md

download_revealjs:
wget https://github.com/hakimel/reveal.js/archive/master.tar.gz
tar -xzvf master.tar.gz
mv reveal.js-master reveal.js
rm master.tar.gz
~~~

prez.md

~~~Markdown

title: 'Test RevealJS'
author:

- Tarral Mathieu

Introspection ?

  • hello
  • world

sub

  • hello world
    ~~~

  • make download_revealjs

  • make all

The output:
capture d ecran de 2018-01-28 16-37-13

My pandoc version is:
~
pandoc 1.19.1
Compiled with pandoc-types 1.17.0.5, texmath 0.9.1, highlighting-kate 0.6.4
Default user data directory: /home/wenzel/.pandoc
Copyright (C) 2006-2016 John MacFarlane
Web: http://pandoc.org
This is free software; see the source for copying conditions.
There is no warranty, not even for merchantability or fitness
for a particular purpose.
~

Do you know what's wrong with my Markdown ?

Thanks !

Most helpful comment

Please try running pandoc with --slide-level=2. This will tell pandoc to turn second-level headers into slides. Note that only the header of first-level slides will be shown, the first list in your example will not be visible.

If you have further questions, please direct them to the pandoc-discuss mailing list; we try to keep this issue tracker reserved for bugs and enhancement proposals.

All 14 comments

Please try running pandoc with --slide-level=2. This will tell pandoc to turn second-level headers into slides. Note that only the header of first-level slides will be shown, the first list in your example will not be visible.

If you have further questions, please direct them to the pandoc-discuss mailing list; we try to keep this issue tracker reserved for bugs and enhancement proposals.

Please reopen this issue, because it does not solve OPs problem. I am having the same issue.

The original issue seems to be resolved. @HDembinski, it is difficult to assess your issue without more information about your specific problem. Please also see http://pandoc.org/help.html.

Please try running pandoc with --slide-level=2. This will tell pandoc to turn second-level headers into slides. Note that only the header of first-level slides will be shown, the first list in your example will not be visible.

This is not a solution, only an accurate description of the problem.

I did some more searching here, and multiple users stumble over the same issue again and again:
https://github.com/jgm/pandoc/issues/2265
https://github.com/jgm/pandoc/issues/2248
https://github.com/jgm/pandoc/issues/2157

To make 2D slides in reveal.js works as expected, we need level 1 slides with content to become normal horizontal slides and level 2 slides to be nested vertical slides.

I believe that what you want is for

# A

A content

## A1

A1 content

to show up as a horizontal slide with title "A" and content "A content" and a vertical subslide with title "A1" and content "A1 content."

What pandoc will do, with --slide-level=2, is produce a horizontal title slide with title "A" and NO content, and a vertical subslide with title "A1" and content "A1 content."

It might make sense to make the following change (this would be around line 478 of the HTML writer). Instead of omitting the non-section content of a "title slide," we could include it as the content of the slide.

This would not be a hard change to make, and it would give the behavior you want for reveal.js. However, it would mean that reveal.js and beamer give different output for the same input, which is something I've wanted to avoid. We might, however, think of making a parallel change in beamer.

This would also help with #5237.

A first step, if we made this change, would be to carefully document the new behavior in teh manual under Slide shows.

@jgm Thank you for opening this again and yes, you described the problem and the desired behaviour perfectly. I am sure that many users will appreciate this change.

Can I help out in some way? I can't program in Haskell, but I can help with the docs, for example.

I played a bit with beamer output. Maybe beamer should be changed as well, and then the behaviour could remain consistent as you wish.

Using OP's example Markdown with beamer output, by executing

pandoc -t beamer slides.md -s -o beamer.pdf

I get the following output

screenshot from 2019-02-25 00-01-39

This is exactly the behaviour that the current docs describe, but it is not what a naive user would expected. I would argue that a heading should always start a new slide.

Proposed behaviour:

  • a new slide is generated for each heading, regardless of heading level
  • revealjs: level 1 slides go horizontal, level 2 slides go vertical
  • beamer: level 1 and level 2 slides behave the same, but empty level 1 create chapter slides (using title slide layout, centered title in the middle, etc.)

To clarify, I think no user actually wants the output shown in my screenshot, which would allow us to safely change this without breaking peoples projects.

Try this with --slide-level=2, though. It works exactly as it does in reveal.js.

Being able to create titled blocks using headers > slide level is a useful feature.

I am so sorry to trouble - but this (unexpected!) change has caused me quite a bit of trouble...
I am certain it's because of my incompetence and despite trying hard, i could not find any work around, except to roll back to an earlier pandoc.. (have not rolled back yet, but that's the obvious fix for me). I posted the detailed explanation here, as per Xie YiHui's advice... https://stackoverflow.com/questions/57614387/pandoc-4317-forces-content-under-title-slides-to-be-included-in-a-frame-in-pand
Thank you so much for any help you may provide. I hope it's an obvious fix for you. Of course, I am happy to provide any code needed - but fyi - i am under windows 10 (I prefer linux, but unfortunately the Rblpapi only works with windows 10 :-() and everything is fully up to date. I like to use the RStudio IDE.

@tchevri I'm sorry about this -- it appears one can't please everyone. Unfortunately your particular use wasn't represented in the discussion. I had assumed that people who didn't want the content to appear on slides could simply hide the content (using a filter or whatever), but your case is different; you don't want to hide the content; you want it to appear in the document outside the slide environment.

I'm reluctant to revert the change to beamer, since this would make revealjs and beamer behave differently, and because it would break things for other users.

But I can't think of a good workaround right now.

I suggest you post on the pandoc-discuss mailing list, where someone might have ideas...closed issues aren't a good place for discussions.

This fix is apparently included in versions 2.7 and later:

pandoc$ git tag --contain 5990f14ad497999141a5b975651f83d751ec421f
0.16.1.2
2.7
2.7.1
2.7.2
2.7.3
2.8
2.8.0.1
2.8.1
2.9
2.9.1
2.9.1.1
2.9.2
2.9.2.1

Can i suggest something please?
I am choosing slide level 3 for my bookdown project.
My understanding is that reveal.js users need "one level above" their slide level to get the feature they want - in this case, that would be level 2.
If I did not misread, i do not think they need level 1, do they?
If so, how about leaving me the ability to use level 1 then to have my latex commands not slapped onto a slide and ignored, as used to be the case pre-.2.7?
Would that be a solution acceptable for everyone?
Many thanks
thomas

Was this page helpful?
0 / 5 - 0 ratings