Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IPython/Jupyter Notebook: How to render a markdown cell without reloading doc?

Tags:

In IPython/Jupyter notebooks, is there a clear, concise summary of the 'rules' for when markdown is rendered into that nice, rich text format that's pleasant to look at?

Here's what I've got so far:

  1. When I create a new cell, then switch it to 'Markdown' it stays in 'raw markdown mode' (meaning: I can see the raw markdown. There's some nice, syntax-based color-coding and font-sizing, but it's clearly raw markdown)
  2. If I save the notebook, close it (i.e., close the browser's page) and then re-open the notebook I see the nice, rich-text version of the markdown (i.e., "#Topic 1" is rendered as H1 by the browser, and the browser hides the "#" at the start - it's clearly NOT the 'raw markdown'
  3. If I click on the markdown cell it remains in 'nice mode'
  4. If I press the 'Enter' key I enter Jupyter's edit mode, it replaces the 'nice mode' view with the 'raw markdown mode' view, and I can edit the markdown.

What I'd love to know is: How do I get Jupyter to render that 'raw markdown mode' cell again? (Without closing and re-opening the notebook)

(Alternately -is this the expected behavior? You get the nice view when you first load it, and you're stuck with the 'raw markdown' view for any cell you edit until you reload it?)

like image 574
MikeTheTall Avatar asked May 07 '17 04:05

MikeTheTall


People also ask

How do I render markdown 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.

How do you edit a Jupyter notebook markdown cell?

Just double click on the markdown cell. Edit what you want to and Run. It will reflect the changes. Save your notebook.

How do you Unrun a cell in Jupyter notebook?

If you go to "Edit", there's an option for "Undo Delete Cells". If you are familiar with shortcuts, you can do cmd + shift + p and then type in undo to recover as well.

What does %% do in Jupyter notebook?

Both ! and % allow you to run shell commands from a Jupyter notebook. % is provided by the IPython kernel and allows you to run "magic commands", many of which include well-known shell commands. ! , provided by Jupyter, allows shell commands to be run within cells.


1 Answers

You just need to execute or run the cell which is in markdown format.

If you press Ctrl + Enter will execute and convert the raw text to markdown form.

Or you can press Shift + Enter which will execute the current cell and will move to the next one.

like image 128
bhansa Avatar answered Oct 10 '22 23:10

bhansa