Collapsible indented edit preview text

One of the features I really enjoy in Visual Studio Code is how, when you indent text, it allows you to collapse all text indented beneath other text. Basically like below,

- Hello There
	This would be hidden if 'Hello There' was collapsed.
+ Hello There

Is this something that could be brought to Tiddlywiki’s edit preview iframe textarea somehow?

I didn’t see it in codemirror, but I imagine it would be very handy for working on things like custom js widgets or stylesheets, where long amounts of text with indents to keep things easier to read would appear.

For codemirror there are many possibilities to fold. But from the demos: CodeMirror: Code Folding Demo none of them seems to work with standard wikitext or code like eg: from the core tabs-macros

So for every possible folding-pattern we would need a helper function, that works specifically for TW syntax. We probably can borrow wikitext-code from the markdown folder or macros from HTML folder and so on …

@Justin_H I have not seen this specific approach in tiddlywiki but similar approaches may be found with the term “outliner(s)”. Possibly the leading example is “streams” and in some ways the “section editor”.

As @pmario suggested to implement such as feature code mirror is possibly the “path of least resistance”.

Whilst not in editor mode one could make a view template that responds to the outline or even use css in an existing wiki symbol.

Shame it can’t be directly imported from codemirror, I imagine the markdown folder code would work the best? I’m not sure, I’ve just checked out the demo- I haven’t read the underlying JS for it yet.

I’ll have to give this a search, I wasn’t really sure how to refer to this specifc feature.

Yea, I believe you are right- though implementation of it will probably still provide resistance.

I’m not sure I understand. Wouldn’t showing in the ViewTemplate be the same as using something like having wikitext for the details disclosure element or reveal widget?

What I mean is inside the editor indicate where you want outlining to occur and in the view template or body cascade allow a view mode that allows open and collapse of the content. Not what you asked for but a view only version. The section editor of @Mohammad can do this with headings ! !! !!! Etc and also edit a section.

I’ve taken a look at his section editor, though it seems a bit broken at the moment from the extra <<>> repeated throughout the demo

ATM I’m just interested in the editor being collapsible, as collapsible elements in the view template / body cascade can be achieved in other ways.

Unfortunately I’m still learning about JS and just now trying out codemirror on tw, so I imagine right now making this thread is just for the discussion of said feature.