Login  Register

nest inclusions with level offsets

Posted by xcoulon on Nov 09, 2019; 11:51am
URL: https://discuss.asciidoctor.org/nest-inclusions-with-level-offsets-tp7341.html

Hello,

I'm trying to understand how nested file inclusions with level offsets are processed. Here's my use-case:

'test.adoc':
    = main title

    include:parent-include.adoc[leveloffset=+1]

'parent-include.adoc':
    = parent title

    include:child-include.adoc[leveloffset=+1]

'child-include.adoc':
    = child title

    include:grandchild-include.adoc[]

'grandchild-include.adoc':
    == grandchild title

(Note the 'leveloffset' attribute when including the 'child-include.adoc' file in the 'parent-include.adoc' one)

I would expect that these relative nested leveloffset would combine/accumulate and give the following output when processing the `test.adoc` top-level file:
   <h1>main title</h1>
   ...
   <h2>parent title</h2>
   ...
   <h3>child title</h3>
   ...
   <h4>grandchild title</h4>
   ...

But instead, asciidoctor 2.0.10 gives the following result:
   <h1>main title</h1>
   ...
   <h2>parent title</h2>
   ...
   <h2>child title</h2>
   ...
   <h3>grandchild title</h3>
   ...

as if the `leveloffset` attribute in the `include:child-include.adoc[leveloffset=+1]` macro in the `parent-include.adoc` file was ignored.

Is it the expected behaviour or is it a limitation or a (known) issue?