Folding Based On Marker Elements

Are you missing a feature? Request its implementation here.
SixForty
Posts: 18
Joined: Sun May 09, 2021 7:34 am

Folding Based On Marker Elements

Post by SixForty »

I would like to throw this out there as a feature request that I know I would find useful, and others might as well: the ability to fold content in Text Editor view based on the presence of 'marker' elements. By this I mean, instead of just folding the content of an element (which works great and I love this feature), I would like to be able to fold following siblings into a specific element. For example, I routinely have content that looks like this:

Code: Select all

<parent>
	<a />
	<a />
	<b />
	<marker id="1" />
	<a />
	<c />
	<a />
	<marker id="2" />
	<b />
	<a />
	<c />
	<a />
	<b />
	<marker id="3" />
	<b />
	<c />
	<a />
	<marker id="4" />
	<b />
	<a />	
	<a />	
</parent>
I would love it if I could fold all of the sibling elements that follow each 'marker' element (up to the next occurrence of a 'marker' element), such that they are out of view, and my Text Editor window would then look like this:

Code: Select all

<parent>
	<a />
	<a />
	<b />
	<marker id="1" />
	<marker id="2" />
	<marker id="3" />
	<marker id="4" />
</parent>
Such a feature would need the ability for me to define which elements are marker elements that can be folded on. Or I could possibly see it implemented as an option where any element has the ability to fold in all following siblings until the next occurrence of the specific element used for the folding.

Although my specific use case is different, I could see such a feature also being helpful in an HTML environment, where a document has a bunch of headings, each followed by a collection of p elements and images and tables, etc. The ability to fold all the content out of view, under the heading so to speak, could be useful.

Thanks for any consideration of such a feature!
SixForty
Posts: 18
Joined: Sun May 09, 2021 7:34 am

Re: Folding Based On Marker Elements

Post by SixForty »

Actually , for my specific use case, it would be nice to be able to do the sibling folding on not just the element level, but maybe even an element-attribute combination. I have some elements which look more like <marker markertype="a" id="1"> and <marker markertype="b" id="1">. And it would be beneficial to be able to fold siblings based on <marker markertype="a"> sometimes, and other times to fold siblings based on <marker markertype="b">.

To give another code example:

Code: Select all

<parent>
	<a />
	<a />
	<b />
	<marker markertype="a" id="1" />
	<a />
	<c />
	<a />
	<marker markertype="b" id="1" />
	<b />
	<a />
	<c />
	<a />
	<b />
	<marker markertype="a" id="2" />
	<b />
	<c />
	<a />
	<marker markertype="b" id="2" />
	<b />
	<a />	
	<a />	
	<marker markertype="a" id="3" />
	<b />
	<c />
	<c />
</parent>
Folding this based on markertype="a" would look like:

Code: Select all

<parent>
	<a />
	<a />
	<b />
	<marker markertype="a" id="1" />
	<marker markertype="a" id="2" />
	<marker markertype="a" id="3" />
</parent>
And folding this based on markertype="b" would look like:

Code: Select all

<parent>
	<a />
	<a />
	<b />
	<marker markertype="a" id="1" />
	<a />
	<c />
	<a />
	<marker markertype="b" id="1" />
	<marker markertype="b" id="2" />
</parent>
I hope this makes sense. Feel free to ask questions if it doesn't! The reason for using sibling marker elements instead of parent-child structure in the document is because the content of the document can really be structured in multiple different, overlapping ways. So various different document structures are held in different files and then processed together with this file based on the specific use case at the given time.
xephon
Posts: 160
Joined: Mon Nov 24, 2014 1:49 pm
Location: Greven/Germany

Re: Folding Based On Marker Elements

Post by xephon »

In CSS you can easily make elements foldable. Search in the docs for "foldable".
stefan-jung.org – Your DITA/DITA-OT XML consultant
SixForty
Posts: 18
Joined: Sun May 09, 2021 7:34 am

Re: Folding Based On Marker Elements

Post by SixForty »

xephon wrote: Sat Apr 05, 2025 9:01 am In CSS you can easily make elements foldable. Search in the docs for "foldable".
Thanks for the reply, xephon. I've done some searching through the documentation, but I've only been able to find info on folding child elements into their parent element (collapsing the content of an element), not folding sibling elements into a preceding sibling. Have I missed something somewhere? Any chance you could link me to a spot in the documentation that might help me out?
Post Reply