'Vim "stacked" folding

I'm writing the table of content of a long pdf while scrolling it.
I have difficulties on remembering in which subcategory I'm putting the content.
I'd like a folding method that displays only the upper nodes of the branch I'm writing in, so that I can realize that I have to open a new subcategory if the topic changes.

I found something similar to what I'm looking for in this plugin under the section Usage there's an example of "Stacked" folding that matches my needs.
The problem is that the folding method I'm using is the indent one.

Follows an example.

Raw file

1 A
2 B
3    C
4    D
5       E
6       F 
7       G
8          H
9             I
10            L

What I'd like

1 A                  
2 B                  [1 line]
4    D               [2 lines]
7       G 
8          H
9             I
10            L

I really appreciate any kind of help.



Sources

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

Source: Stack Overflow

Solution Source