Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I create a new line with reStructuredText?

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!

like image 364
tiggerae Avatar asked Jul 05 '18 19:07

tiggerae


People also ask

How do you type a new line?

To add spacing between lines or paragraphs of text in a cell, use a keyboard shortcut to add a new line. Click the location where you want to break the line. Press ALT+ENTER to insert the line break.

How do I start a new line in html5?

To add a line break to your HTML code, you use the <br> tag. The <br> tag does not have an end tag. You can also add additional lines between paragraphs by using the <br> tags. Each <br> tag you enter creates another blank line.

What are .RST files?

reStructuredText (RST, ReST, or reST) is a file format for textual data used primarily in the Python programming language community for technical documentation.

How do you comment in RST?

For comments, add 2 periods .. followed by a newline and then your comment indented.


2 Answers

The line block syntax also worked, and was a bit cleaner:

| This is a line | This is another line | Another new line

like image 68
tiggerae Avatar answered Sep 30 '22 23:09

tiggerae


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. 
like image 42
Steve Piercy Avatar answered Sep 30 '22 23:09

Steve Piercy