How to format text cells in Jupyter?

11,793

Solution 1

After creating those blocks you have to run them to give you that white background.

Press Ctrl + Enter inside the block.

For eg.

  1. Click on a cell. Press Esc and then press 1

  2. Now type this: "THIS IS A HEADING"

  3. And then press Ctrl + Enter.

You will get this as an output with a white background (The image below is a bit dull):

enter image description here

Solution 2

In addition, by using the %%html magic command, you can type HTML in cells and get them rendered the way you want

Share:
11,793
Sembei Norimaki
Author by

Sembei Norimaki

Engineer who loves challenges and is always working in new professional and personal projects.

Updated on June 05, 2022

Comments

  • Sembei Norimaki
    Sembei Norimaki almost 2 years

    I would like to create a Jupyter notebook to make a tutorial.

    When I go to the jupyter website and I try jupyter in the browser, there is already a nice python tutorial, with some cells used as text explanations and others as code:

    enter image description here

    Now I create a new notebook and I am able to create different cells and format them in 4 types:

    • Code
    • Markdown
    • Raw NBConvert
    • Heading

    However none of them allow me to create the text explanations with white background as in the image above. I tried formatting one cell as markdown and it's just keeping with the grey background.

    Am I missing something? Thanks.

    enter image description here

  • Sembei Norimaki
    Sembei Norimaki over 7 years
    Wow, it's simpler than I though. Thanks
  • Roman Orac
    Roman Orac over 5 years
    I would also suggest you use a python code formatter for Jupyter notebooks: github.com/kenkoooo/jupyter-autopep8.