Search code examples
rubyasciidoctor

Can I make the toc show up for documents with `header_footer` as false?


I'm embedding some adoc files in a webpage and so I don't want to have the full header_footer stuff (with html/body/etc...), but that seems to be the only way that I can get the table of contents to display in an adoc file when converting it with the asciidoctor gem. Is there a way to have both? I tried looking at the source code but didn't see anything off-hand.


Solution

  • I am not sure, but I think that this answer written by Dan Allen about Jekyll is also valid in your case:

    In that scenario, the only toc position available are "preamble" and "macro". The first puts the toc in the preamble, the second at the location of the toc::[] macro. I usually recommend using the toc macro.