Reputation: 11409
When I specify the toc
option in the yaml front matter as such:
---
title: "Reading notes"
toc: yes
---
Pandoc generates a table of content for pdf output but not for html output. This is due to the fact that the pdf document has the standalone option enabled by default, as explain in man pandoc:
-s, --standalone Produce output with an appropriate header and footer (e.g. a standalone HTML, LaTeX, TEI, or RTF file, not a fragment). This option is set automatically for pdf, epub, epub3, fb2, docx, and odt output. For native output, this option causes metadata to be included; otherwise, metadata is suppressed.
Calling the –-toc
and -standalone
arguments together does create a table of content in the html output:
pandoc -s --toc notes.md -o notes.html
Is it possible to specify the standalone option in the yaml front matter? I tried standalone : yes
but it doesn't work.
Upvotes: 1
Views: 1610
Reputation: 146
I think that the standalone option is dealing with the template rather than the document. You may be able to find a way to specify this option within your template file, but I do not believe this is possible from the yaml.
From the documentation:
"When the -s/--standalone option is used, pandoc uses a template to add header and footer material that is needed for a self-standing document"
This option seems to be adding an additional template on the pandoc call. This makes me believe that it is not possible to specify within the yaml of the document similar to how it is not possible to specify the template within the yaml. But I cannot find anything further to confirm my findings.
Upvotes: 3