Last updated: Apr 10, 2024
Reading time·3 min
Use the <br>
tag to add a new line in a Jupyter Notebook markdown cell.
The <br>
tag stands for "line break" and is used to produce a line break in
the text.
bobby <br> hadz <br> com
Make sure Markdown is selected from the dropdown as shown in the screenshot.
You can run the code by clicking on the > Run
button or by pressing Ctrl
+
Enter
.
The following output is produced.
Markdown is a markup language that is a superset of HTML, so we can use HTML elements such as br directly in our markdown code.
The <br>
element produces a line break in the text.
Note that this approach doesn't work if you need to export the notebook to a pdf
because <br>
elements get treated as spaces.
You can also use two consecutive spaces to add a new line in a Jupyter Notebook markdown cell.
bobby␣␣ hadz␣␣ com
Where ␣
represents a space.
You simply press the Space
key twice at the end of each line and then hit
Enter
.
A <br>
tag can be inserted by ending a line with two or more spaces.
Here is the output of running the code in the cell.
You can also use a backslash \
character to achieve the same result.
bobby \ hadz \ com
Simply add a backslash \
character at the end of each line where you want to
insert a newline character.
I'll click on the Run >
button to run the code in the cell.
Running the code produces the following output.
Enter
twice to start a new paragraphYou can also press the Enter
key twice to start a new paragraph.
bobby hadz com
Simply press the Enter
key twice at the end of each line.
Here is the output that is produced by running the code in the cell.
If you encounter any issues when running the code in the cells, try restarting the kernel.
You can learn more about the related topics by checking out the following tutorials:
pd.read_json()