Re: Question About Section Levels

Kent Borg <[email protected]> Wed, 2 Oct 2019 10:01:36 -0400
Newsgroups gmane.text.docutils.user
Message-ID <[email protected]>
On 10/2/19 7:20 AM, Guenter Milde via Docutils-users wrote:
> However, the mapping "adornment style" -> `section_level` is done "on the
> go", i.e.  the first style encountered will be level 1, the second style
> will be level 2, the third will be level 3, and so on.
>
> http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#sections

Ah, yes, I think I noticed that without realizing it. Interesting. And 
for a moment I thought it might help me here, but I think not.

> "this level":
>    use the style of the previous section title.
>
> "one deeper than the current level":
>    use the style "established" for one level deepter by previous use.
>    If there  is no "established" style yet, use a new style.
>
> "X number of levels shallower than the current level"
>    ! not allowed in rST !

I think I am misunderstanding. I can do:

Section 1
=========

Paragraph One

Section 2
---------

Paragraph Two is a level deeper.

Section 3
`````````

Paragraph Three is deeper still.

Section 4
'''''''''

Paragraph 4 is the deepest I'll go in this example.


Section 5
---------

This section I popped up 2 levels, I could have used "=" to pop up three, "`" to pop up one.

That is what I meant by "X number of levels shallower".


>> Is there some option to include that will make contents relative to
>> the depth at which the include directive appeared?
> No. (It would be a nice thing but is non-trivial to implement.)

Yes, I was tracing through docutils code yesterday, I agree it would be 
non-trivial...


This is part of the dynamic content inside RST project I mentioned a few 
weeks ago. This specific question is prompted by needed to be backwards 
compatible with a previous design. It looks like our workaround will be 
rST include files in smaller chunks. Not as nice for maintaining our 
content, but it will work.


Now I need to go make changes to one of the custom directives I wrote: 
add a section depth parameter so it can be used from any nesting depth...


Thanks,

-kb