Skip to content

Commit

Permalink
Add float vs discrete heading usage instruction
Browse files Browse the repository at this point in the history
  • Loading branch information
mrotteveel committed Aug 6, 2020
1 parent f7383fb commit 7db72d5
Showing 1 changed file with 26 additions and 0 deletions.
Expand Up @@ -771,6 +771,32 @@ or

The second syntax offers more flexibility when you need to provide more options and attributes than just the ID.

[[docwritehowto-asciidoc-float-heading]]
==== Float vs discrete headings

AsciiDoctor allows you to define headings that are not part of the document outline (eg the TOC).
See also https://asciidoctor.org/docs/user-manual/#discrete-headings[Discrete Headings (aka Floating Titles)^].
AsciiDoctor offers two roles to do this: `float` and `discrete`:

[source]
----
[float]
== Section heading with float
[discrete]
== Section heading with discrete
----

In the HTML output we generate the TOC dynamically using tocbot.
Unfortunately, tocbot allows us to only exclude a single class from the selection of headings.
To avoid the introduction of a separate custom role, we chose `float` as the role to use for these types of elements.
Do not use the `discrete` role to prevent it from showing up in the HTML TOC generated by tocbot.

[NOTE]
====
We decided on `float` instead of `discrete` based on the fact that we were already using `float`.
====

[[docwritehowto-asciidoc-customrole]]
==== Custom roles

Expand Down

0 comments on commit 7db72d5

Please sign in to comment.