collapse cell in jupyter notebook

前端 未结 12 1293
长发绾君心
长发绾君心 2020-12-22 17:00

I am using ipython Jupyter notebook. Let\'s say I defined a function that occupies a lot of space on my screen. Is there a way to collapse the cell?

I want the func

12条回答
  •  粉色の甜心
    2020-12-22 17:17

    Create custom.js file inside ~/.jupyter/custom/ with following contents:

    $("").appendTo("head");
    $('.prompt.input_prompt').on('click', function(event) {
        console.log("CLICKED", arguments)   
        var c = $(event.target.closest('.cell.code_cell'))
        if(c.hasClass('collapse')) {
            c.removeClass('collapse');
        } else {
            c.addClass('collapse');
        }
    });
    

    After saving, restart the server and refresh the notebook. You can collapse any cell by clicking on the input label (In[]).

提交回复
热议问题