3

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

2 Answers 2

7

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

2
  • 1
    Wow, it's simpler than I though. Thanks
    – user2261062
    Jan 31, 2017 at 12:23
  • I would also suggest you use a python code formatter for Jupyter notebooks: github.com/kenkoooo/jupyter-autopep8.
    – Roman Orac
    Dec 24, 2018 at 21:23
1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.