Hello,
I am unable to add a table of contents (toc) to my HTML nor PDF output. I am using the following versions: > asciidoctor -v Asciidoctor 1.5.6 [http://asciidoctor.org] Runtime Environment (ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]) (lc:US-ASCII fs:US-ASCII in:- ex:US-ASCII) > asciidoctor-pdf -v Asciidoctor PDF 1.5.0.alpha.15 using Asciidoctor 1.5.6 [http://asciidoctor.org] Runtime Environment (ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]) (lc:US-ASCII fs:US-ASCII in:- ex:US-ASCII) In my document, I have added ":toc:", like this: ``` = Title of my document :pdf-page-size: A4 :toc: :toclevels: 2 :numbered: ``` But no table of contents is shown in the output |
Administrator
|
You have a blank line after the document title, so your attributes are falling outside of the document header. On Wed, Sep 6, 2017 at 2:22 AM, wimdeblauwe [via Asciidoctor :: Discussion] <[hidden email]> wrote: Hello, Dan Allen | @mojavelinux | https://twitter.com/mojavelinux |
In reply to this post by wimdeblauwe
Minutes after posting, I find the solution :-)
I have to change: ``` = Title of my document :pdf-page-size: A4 :toc: :toclevels: 2 :numbered: ``` to: ``` = Title of my document :pdf-page-size: A4 :toc: :toclevels: 2 :numbered: ``` Notice the removed blank line between the title and the options. For other options like :numbered: it does not seem to matter, but for :toc:, that blank line cannot be there. Is this normal/expected behaviour or should I file a bug report about it? regards, Wim |
Administrator
|
Yes, that is normal behavior. Attributes that control document-level behavior must be defined in the header. The reason numbered (now called sectnums) is not required in the header is because this setting can be changed throughout the document. There are very few attributes like this, so it's really a rare exception. Cheers, -Dan On Wed, Sep 6, 2017 at 2:24 AM, wimdeblauwe [via Asciidoctor :: Discussion] <[hidden email]> wrote: Minutes after posting, I find the solution :-) Dan Allen | @mojavelinux | https://twitter.com/mojavelinux |
Free forum by Nabble | Edit this page |