Toggles in Code Blocks

Is your feature request related to a problem? Please describe.
For a better readability it would be nice to toggle/collapse code in the Code Block by clicking a toggle.

Describe the solution you’d like
I would like a solution like in Visual Studio Code

As an example with markdown:
Uncollapsed:
image

Collapsed:
image


Related: Make "toggle" a feature of every block

Great idea, I added this idea to codeblock ideas board.
Also if you have a minute to describe how and how often do you use codeblock It will be great for our product team to understand use cases better :slightly_smiling_face:

Hey @ignatovv,
in the past 12 months I learned for an exam and used code blocks nearly every day. I mostly documented a lot of one-line commands with a commend behind them. But this is not a huge use case for the toggle.
I also saved a huge number of scripts in Anytype and I also had to edit them. Since there is no “multiple” window function yet, I had to scroll a lot between the edits. Toggles would have reduced that a lot and also would make it easier to find the specific part I want to edit, without scrolling through the whole script.

I’m not there yet, but I am planning to use Anytype for storing my self-hosting documentation (currently in Bookstack) so saving (long) scripts in Anytype will be a huge part in that.

Related:

Toggles in every block is not the same as this post topic as toggles in code blocks are added to semantic blocks in curly braces usually to make code more readable. It has nothing to do with toggles in every block proposition.

This unresolved issue looks relevant for this FR, since I think Prism.js is used for code highlighting.

Interesting.