I'm playing around with pandoc as a way to create epub books. It automatically creates a table of contents by detecting all H1 tags in the book. This works well except that every epub has a TOC link to the title page, something I don't need. How do I get rid of this TOC link? Thanks, John
答案 0 :(得分:1)
使用YAML metadata block中的title
代替H1
作为标题。对于EPUB,YAML块中有more specific options:
---
title:
- type: main
text: My Book
- type: subtitle
text: An investigation of metadata
creator:
- role: author
text: John Smith
- role: editor
text: Sarah Jones
identifier:
- scheme: DOI
text: doi:10.234234.234/33
publisher: My Press
rights: © 2007 John Smith, CC BY-NC
---
my body text
请注意,如果您未从降价转换,则可以使用--variable
和--epub-metadata
来传递这些值。
在您的情况下,您可能需要先修改传入的HTML,然后再将其传递给pandoc以删除标题页的h1
,然后将该信息传递给--variable title='My Title'
。< / p>
这是因为pandoc确实区分了元数据(如文档标题,作者等)和文档本身。因此,如果您的文档中有标题,那么它也属于目录,pandoc会将其放在那里,无论如何。 (当然,如果您不同意,可以再次通过pandoc修改输出产生。)