Blazerg
Blazerg

Reputation: 849

How to add non title element to the asciidoctor's table of content

I have a java/gradle project documented with Asciidoctor that generates a table of context based on the title sections of your document. For example:

== Get started

Will be added on the table of content perfectly but a regular text won't, for example:

== Get started Introduction

Will generate a TOC with only "get started" and I'd like a TOC like this one:

get started

-Introduction

How can I add a regular text to the table of content?

Upvotes: 0

Views: 53

Answers (1)

eskwayrd
eskwayrd

Reputation: 4521

If you are using the built-in TOC generation, i.e. you are using :toc: in the document (or -a toc on the command line), only section titles are included in the TOC. For more details, see: https://asciidoctor.org/docs/user-manual/#user-toc

So, to include "plain text" in to the TOC, you would have to make the plain text into a section title.

If you are not using the built-in TOC generation, you can compose a list with any content you like. If you need your hand-assembled TOC to look just like the built-in TOC, you would need to add some CSS styles to do so, which requires a "docinfo" that lets you customize the generated HTML. See https://asciidoctor.org/docs/user-manual/#docinfo-file.

Upvotes: 1

Related Questions