How do I create a new line with reStructuredText?
31,600
Solution 1
The line block syntax also worked, and was a bit cleaner:
| This is a line
| This is another line
| Another new line
Solution 2
According to the docs for docutils raw
role, you can do this:
If there just *has* to be a line break here,
:raw-html:`<br />`
it can be accomplished with a "raw"-derived role.
But the line block syntax should be considered first.
You will need to define the raw
role first:
.. role:: raw-html(raw)
:format: html
As the example states, consider line block syntax first.
| Lend us a couple of bob till Thursday.
| I'm absolutely skint.
| But I'm expecting a postal order and I can pay you back
as soon as it comes.
| Love, Ewan.
Solution 3
We added a substitution to our global.rst
file so we didn't have to add raw tags all the time.
.. |br| raw:: html
<br/>
This way we can just use |br|
when we need a line break.
Author by
tiggerae
Updated on July 12, 2022Comments
-
tiggerae almost 2 years
How do I force a line break/new line in rst? I don't want it to be a new paragraph (ie. no additional spaces between the lines), I just want the text to start on a new line. Thanks!