简体   繁体   English

为什么 pandoc 从 div 中删除.incremental?

[英]Why does pandoc remove .incremental from divs?

I want to make incremental div elements, but pandoc is stripping out the incremental class name from them:我想制作增量div元素,但 pandoc 正在从它们中删除incremental class 名称:

$ 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: p元素不会发生这种情况:

$ 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:incremental class 名称也不会发生这种情况:

$ 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).这在五年前我生成这些幻灯片时有效,但它不再有效(pandoc 2.2.1)。 Was this considered an anti-pattern?这被认为是反模式吗? Am I doing something wrong?难道我做错了什么?

The reason is that newer pandoc versions have a native div element in their internal document AST, which is handled slightly differently.原因是较新的 pandoc 版本在其内部文档 AST 中有一个本机 div元素,其处理方式略有不同。

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.但是您可能想要做的也是使用本机 div 语法。 See also https://pandoc.org/MANUAL.html#incremental-lists另请参阅https://pandoc.org/MANUAL.html#incremental-lists

::: incremental

- Eat spaghetti
- Drink wine

:::

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM