hello hello hello

Why does pandoc remove .incremental from divs?

124 views Asked by At

I want to make incremental div elements, but pandoc is stripping out the incremental class name from them:

$ echo '<div class="incremental">hello</div>' | pandoc -f markdown -t slidy
<div class="slide section level6">

<div>
hello
</div>
</div>

This doesn't happen with p elements:

$ echo '<p class="incremental">hello</p>' | pandoc -f markdown -t slidy
<div class="slide section level6">

<p class="incremental">
hello
</p>
</div>

Nor does it happen with non-incremental class names:

$ echo '<div class="foo">hello</div>' | pandoc -f markdown -t slidy
<div class="slide section level6">

<div class="foo">
hello
</div>
</div>

This worked when I generated these slides five years ago, but it's not working anymore (pandoc 2.2.1). Was this considered an anti-pattern? Am I doing something wrong?

1

There are 1 answers

2
mb21 On BEST ANSWER

The reason is that newer pandoc versions have a native div element in their internal document AST, which is handled slightly differently.

You can get back the old behaviour with:

pandoc -f markdown-native_divs

But what you'd probably want to do is also use the native div syntax. See also https://pandoc.org/MANUAL.html#incremental-lists

::: incremental

- Eat spaghetti
- Drink wine

:::