'Make a hidden heading visible in table of content

I want to make a heading in the content invisible but show it in the table of content (in PDF output).

// here should be a heading line, that should only be visible in the TOC.
[width="100%", cols="1h,2"]
|===
|Modulname |...
|Synopsis |...
|Fachliche Änderungen |...
|Änderungen der Installation / Konfiguration |...
|===

Actually I only know the other way around using [discrete]. Hiding the heading in the TOC is not what I want.

Using:

λ asciidoctor-pdf -V
Asciidoctor PDF 1.6.2 using Asciidoctor 2.0.17 [https://asciidoctor.org]
Runtime Environment (ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x64-mingw-ucrt]) (lc:IBM437 fs:UTF-8 in:UTF-8 ex:UTF-8)


Solution 1:[1]

The way that Asciidoc constructs its ToC does not permit the kind of granular control over visibility that you seek.

You would need to manually construct a ToC instead of using the auto-generated ToC to achieve the visibility that you need.

Solution 2:[2]

Yes this is possible when converting to PDF, but first you should update asciidoctor-pdf to the version 2.

gem install asciidoctor-pdf

Then you can use the notitle option as described here. In your case you could write:

= Document Title
:toc:

== Visible heading

[%notitle] 
=== Table, unvisible heading

[width="100%", cols="1h,2"]
|===
|Modulname |...
|Synopsis |...
|Fachliche Änderungen |...
|Änderungen der Installation / Konfiguration |...
|===

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 eskwayrd
Solution 2 Kiroul