Pandoc epub 到 html:在单页 HTML 中包含图像和样式

Rei*_*ica 5 html epub pandoc

我使用以下命令为 .epub 文件生成单页 .html 文件,

pandoc -f epub -t html -o output.html  ./book.epub
Run Code Online (Sandbox Code Playgroud)

但 .html 文件缺少图像。有没有办法告诉 pandoc 或其他东西将图像嵌入其中?就像 Chrome 的SingleFile产生的那样。

exy*_*xyi 2

您可以用来--embed-resources指示 Pandoc 将图像和样式表(以及...)作为数据 URI 包含在 HTML 中。查看官方手册了解更多信息

--standalone选项还应用于包含 HTML 页眉和页脚

pandoc -f epub -t html -o output.html  ./book.epub --standalone --embed-resources
Run Code Online (Sandbox Code Playgroud)

  • 我已经在 Pandoc 3.0.1 上测试过它,我认为你的版本更有可能太旧,而不是他们在 3.1 中删除了它。旧版本有类似的“--self-contained”选项 (2认同)