is there a way to collapse and expand code inside {

Hi
Is there a way (shortcut ?) to collapse and expand the code between the {} as some text editor …?? i am very accustomed in my text editor …

for example

const capricorne = function() {       
capr.append("path")
.datum({type: "LineString", coordinates: tcapri})
.attr("class", "tropic")
.attr("d", geoGenerator);   

}

become
const capricorne =function(){}

Thanks

1 Like

Isn’t that essentially the same thing as just unpinning and closing the code area of a cell?

image

Here’s the notebook where I did this (using your code and entering arbitrary values):

thank aaronkyle

i am not sure to understand well … you want say we must have a lot of of cell instead long code in the same cell ???

for example here my cell zhmap contain a lot of code …and i am not very hot to divide all this in some small cell ?..

Sorry if I misunderstood - and i get what you mean better now. As far as I know - the answer is no… unlike with many text editors, you cannot collapse sections of code within a cell. Not a bad idea though!

Your China cave notebook is very cool, btw!

thanks

yes still on works (now i look for dynamic data … to finally put on my server …)

yes it will be very cool to have this feature

Not that this really gets you where you are going, but it is my understanding that if you have a lot of functions in a single large code block, you can (and should) try to break it down so that each function is a cell unto itself. Breaking things down in such a way would effectively give you the sort of collapsing capacity that you’re after.

Here’s the idea (fork of your notebook)… though again… sorry that I didn’t get you all the way(and really cannot… as I am very new to all of this and hardly understand anything):