Is there a way to execute carriage returns in a markdown section of an IPython notebook so that when executed the text remains on separate lines (as displayed when typing), rather than combining all text into a single block of text?
Below is my input (and how it displays while typing), followed by the resulting output when the markdown section is executed.
Input:
XXXX [carriage return]
YYYY [carriage return]
ZZZZ [carriage return]
Output:
XXXX YYYY ZZZZ
I am able to create paragraphs by typing text, [carriage return], [space], text, [carriage return] (see below), but I am unable to display consecutive individual lines of text without some placeholder on the line between each line of text.
Input:
Paragraph 1 [carriage return] [space]
Paragraph 2 [carriage return] [space]
Paragraph 3
Output:
Paragraph 1
Paragraph 2
Paragraph 3
Am I missing something easy?
Just add <br> where you would like to make the new line.
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.
Indented quoting: Use a greater than sign ( > ) and then a space, then type the text. The text is indented and has a gray horizontal line to the left of it until the next carriage return.
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.
As per the Markdown specification, <br>
tags can be inserted by ending a line with two or more spaces:
Paragraphs and line breaks
A paragraph is simply one or more consecutive lines of text, separated by one or more blank lines. (A blank line is any line that looks like a blank line — a line containing nothing but spaces or tabs is considered blank.) Normal paragraphs should not be indented with spaces or tabs.
The implication of the "one or more consecutive lines of text" rule is that Markdown supports "hard-wrapped" text paragraphs. This differs significantly from most other text-to-HTML formatters (including Movable Type's "Convert Line Breaks" option) which translate every line break character in a paragraph into a
<br />
tag.When you do want to insert a
<br />
break tag using Markdown, you end a line with two or more spaces, then type return.Yes, this takes a tad more effort to create a
<br />
, but a simplistic "every line break is a<br />
" rule wouldn't work for Markdown. Markdown's email-style blockquoting and multi-paragraph list items work best — and look better — when you format them with hard breaks.
So something like
XXXX␣␣
YYYY␣␣
ZZZZ
(using ␣
to represent spaces) should work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With