hide_cell_number
This extension allows hiding all cell numbers of a notebook. This can be achieved by clicking on the button toolbar:
The codecell hiding state is stored in the metadata IPython.notebook.metadata.hide_prompt
.
If it is set to true
, all cell number will be hidden on reload.
// toggle display of all cells' number
define([
'jquery',
'base/js/namespace'
], function(
$,
IPython
) {
"use strict";
function set_number_visible(show) {
IPython.notebook.metadata.hide_prompt = show;
if (show) $('div.prompt').show('slow');
else $('div.prompt').hide('slow');
var btn = $('#toggle_numbers');
btn.toggleClass('active', !show);
var icon = btn.find('i');
icon.toggleClass('fa-chevron-left', show);
icon.toggleClass('fa-chevron-right', !show);
$('#toggle_numbers').attr(
'title', (show ? 'Hide' : 'Show') + ' cell numbers');
}
function toggle() {
set_number_visible($('#toggle_numbers').hasClass('active'));
}
var load_ipython_extension = function() {
IPython.toolbar.add_buttons_group([{
id : 'toggle_numbers',
label : 'Hide cell numbers',
//icon : 'fa-list-ol',
icon : 'fa-chevron-left',
callback : function() {
toggle();
setTimeout(function() { $('#toggle_numbers').blur(); }, 500);
}
}]);
set_number_visible(IPython.notebook.metadata.hide_prompt === true);
};
return {
load_ipython_extension : load_ipython_extension
};
});
Type: IPython Notebook Extension
Compatibility: 3.x 4.x
Main: main.js
Name: Hide cell number
Description: "toggle number of all cells"