Open calebeby opened 4 months ago
Hm. When I tried this I got two slides...
You're right that the section-ification built into the djot reader will defeat the use of horizontal rules to split slides. That's something we should think about. But the case with no headings (as above) should still split perfectly well.
Hm. When I tried this I got two slides...
Huh. I did it again and it worked. Not sure what I did wrong the first time :facepalm:
But yeah let's make this issue about the headings then.
My initial thought was that it would make sense to have the thematic break split heading sections in general. But after reading the description of thematic breaks in HTML that specifically mentions that <hr />
is to define splits between paragraph-level elements (the HTML standard says this as well), so that would suggest that it should not split the heading section.
Maybe ---
is not the best way to split slides. When I try to think of other things in the djot syntax that might work well, the first thing that comes to mind is using :::
.
Ex:
::: slide
# This is the first slide
:::
::: slide
# This is the second slide
:::
It is definitely a little more clunky. What are your thoughts?
Alternatively, there could be a special-case in pandoc's djot reader to adjust how ---
is interpreted at the top level (and break up the sections) for slide output formats (assuming that the readers are aware of the output format). But that feels clunky from a code perspective as well.
I don't think that ---
should generally break up sections. But it might be given a special-purpose role for breaking up slides, as it is in pandoc.
The only ways forward I see are:
To be sure, using explicit divs would be another option, but it makes the slides clunkier to write.
I would lean towards (2) since the auto-sectionification is a nice feature.
# Hello
---
## Hello2
---
### Hello3
Currently has this AST:
doc
section
heading level=1
str text="Hello"
thematic_break
section
heading level=2
str text="Hello2"
thematic_break
section
heading level=3
str text="Hello3"
In this case we'd want pandoc to see that as:
doc
section
heading level=1
str text="Hello"
thematic_break
section
heading level=2
str text="Hello2"
thematic_break
section
heading level=3
str text="Hello3"
Because of cases like this, I don't think that a section with a ---
in it should be split into two sections:
# Hello
---
???
## Hello2
I think it should become:
doc
section
heading level=1
str text="Hello"
thematic_break
para
str text="???"
section
heading level=2
str text="Hello2"
I think the rule could be "Search every section for its first thematic break that is a direct child. If it has one, the children before the thematic break should remain inside the section, and the thematic break and all later children should be moved outside of (after) the section".
I think this rule should work because (it looks like) sections only appear for headings that are children of other sections or children of the root, so sections are already not created for things like headings inside of blockquotes or divs.
I couldn't decide if this fits better in the "bug report" or "feature request" category, it depends on the intended behavior.
Explain the problem.
When I use the following code as markdown (gfm) or as djot:
And convert it with
pandoc -f djot test.djot -o test.pptx
and
pandoc -f gfm test.md -o test.pptx
(or to any of the presentation formats)
Pandoc turns the markdown version into separate slides, but the djot version is turned into a single slide. Initially I was using headings and I expected the issue to be related to the fact that the thematic break is injected into the sections that are created from the headings, but then I changed the headings to paragraphs and the issue persists.
Is it intended to be able to use top-level thematic breaks as "slide splitters" for djot, similar to markdown, or is that use case not supported?
Pandoc version? 3.1.13, Linux