asciidoctor / asciidoctor-bespoke

:b: An Asciidoctor converter that generates the HTML component of a Bespoke.js presentation from AsciiDoc.
http://asciidoctor.org
MIT License
49 stars 24 forks source link

Slide separation with headings? #4

Open hsablonniere opened 8 years ago

hsablonniere commented 8 years ago

From what I've tried and from what I've read in the README (I didn't looked at the code), level one heading = creates first slide and level two headings == create/separate other slides.

I think that having slide separation depending on the TOC is too restrictive. Imagine this TOC :

  1. Progressive Web Apps : The future is here (presentation title)
    1. Progressive Web Apps
      1. Progressive
        slide X
      2. Responsive
      3. Connectivity independent
      4. etc...
    2. Service Workers
    3. To infinity and beyond...

I would have headings with level 1, 2 and 3 but in order to create slide X, I would have to use a blank level 2 heading == ! which would break the document logic TOC if I were to generate an article from it.

Should we separate slides with another kind of syntax? WDYT?

mojavelinux commented 8 years ago

Your assumption is correct.

Because of how Asciidoctor parses the AsciiDoc, and the AST it generates, it's hard to separate slides using a strategy other than sections. That's because the converter uses a recursive descent walk. I once tried to use page breaks as a way to separate slides, but it required manipulating the AST in a very drastic way.

I do think we can allow the slides to be split at a greater section depth. It makes the section template a bit more complicated, but it's doable. (In fact, it's already supported in the Reveal.js converter). We could either allow that depth to be controlled using a document attribute (slidelevels) or we could mark sections as slides explicitly using a block name ([slide]).

Keep in mind that there's one other approach to making sections without impacting slides. You can make a "discrete" heading by adding [discrete] above it. This takes the heading out of the structure of the document and treats it as regular block-level content.

I want to conclude by saying that the converter isn't currently handling section levels deeper than level 1 (3 or more leading equal signs). That's simply unfinished logic at the moment (deferred in the essence of time).