Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove In[ ] and Out[ ] cell tags in a Jupyterlab notebook?

I'd like a simple way to hide all the cell tags in my notebook, that is, things of the form In[..] and Out[..].

enter image description here

The reason being that they up a lot of the margin and are not useful to me (also they make the git history messy)!

Of course, I would like to keep line numbering within each code cell, so I have set 'lineNumbers':true in my config:

enter image description here

Is there another field I can use to set this, like 'in_out_prompts':false? Perhaps from some other extension? It would be great to at the very least remove the numbers inside the In and Out tag brackets.

Related:

  • This reddit question
  • Docs for jupyter
like image 437
M.R. Avatar asked Apr 04 '18 01:04

M.R.


People also ask

How do you remove a tag from a Jupyter Notebook?

in Jupyter - Home-running- stop your file, after that go to the explorer- click right bottom on your_file. ipynb open with notebook(just like . txt) - scroll down, find raw with "celltoolbar": "None", and delete this and save file, after run file in jupyter.

How do I hide inputs in Jupyter Notebook?

Hide cell inputs If you add the tag hide-input to a cell, then Jupyter Book will hide the cell but display the outputs. Note how we only see the output by default.

How do you tag cells in a Jupyter Notebook?

The Jupyter Notebook ships with a cell tag editor by default. This lets you add cell tags to each cell quickly. To enable the cell tag editor, click View -> Cell Toolbar -> Tags . This will enable the tags UI.

How do I edit cells in Jupyter Notebook?

You can change the cell type of any cell in Jupyter Notebook using the Toolbar. The default cell type is Code. To use the Keyboard Shortcuts, hit the esc key. After that, you can change a cell to Markdown by hitting the m key, or you can change a cell to Code by hitting the y key.


1 Answers

Jupyter lab doesn't follow the custom css that IPython/Jupyter used to. So the previous approaches may not work. But you can still customize the themes.

Based on how and where you install jupyter there will be themes folder

So in my case it was at below path

~/.virtualenvs/jlab/share/jupyter/lab/themes/@jupyterlab/theme-dark-extension/fonts.css

in this file I just added

.jp-InputArea-prompt {
   display: none;
}

And got the desired result

No execution

Edit-1: 11 Apr 2018

As per feedback from OP, doing this disables drag and drop. This is because the drag is controlled by the margin that we have hidden. So to fix the same we need few things

  • Hide the text but not element
  • Lower the width so drag can work

For the same you can use below css

.jp-InputArea-prompt {
     flex: none;
     width: 10px;
     text-indent: 100%;
 }
like image 170
Tarun Lalwani Avatar answered Oct 04 '22 21:10

Tarun Lalwani