在 Pandoc 中从 txt 生成 epub 时的段落缩进

Paragraph indent when generating epub from txt in Pandoc

我使用 pandoc 从一个简单的 txt 文件生成一个 epub 文件。文本文件 text.txt 是

Chapter 1

This is the text of paragraph 1.

This is the text of paragraph 2.

我使用 pandoc -o file.epub text.txt 生成了一个 epub。但是,段落没有缩进。有没有办法告诉 pandoc 缩​​进所有段落而不必更改 txt 文件?

您可以从带有 --css option 的文件或通过设置 header-includes 变量注入一些 CSS,例如:

pandoc -V header-includes='<style>p{ margin-left: 1em }</style>' text.txt -o file.epub