Generate title level depending on the level of its parent

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Generate title level depending on the level of its parent

NicolasGeraud
Hi all,

I want to generate the documentation of the open source project that I work on (http://gravitee.io) by including all README.adoc files into the main documentation.

It works well (thanks to your great work !) but i'm facing an issue in my process.

Because README are includes in another adoc file, the title levels must be synchronized. This means that in my README.adoc , the first title needs to start at level 3 because in the main documentation, the readme is include below a title 2.

I could generate title1 or title3 depending on an attribute, but I don't know if there is a more simple way to do that. I think about a title notation that start at "level of the title above + 1"

Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: Generate title level depending on the level of its parent

Jeremie Bresson
Hi,

I think you are looking for ":leveloffset:"

You can use it like this:

----
== Level 1 Section Title

=== Level 2 Section Title

:leveloffset: 1

include::README.adoc[]

:leveloffset: 0

== Level 1 Section Title

=== Level 2 Section Title

:leveloffset: -1

include::some.adoc[]

:leveloffset: 0

== Level 1 Section Title

=== Level 2 Section Title
----

Reply | Threaded
Open this post in threaded view
|

Re: Generate title level depending on the level of its parent

NicolasGeraud
This is exactly what i'm looking for.

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Generate title level depending on the level of its parent

NicolasGeraud
a more elegant way is

include::path/to/the/file.adoc[leveloffset=+2]