James.Y
James.Y

Reputation: 1457

How to add a newline without adding a new paragraph

A simple org-mode document, a * header line, a - Q: line with an intended A: line. After exporting to html, why are Q: and A: in the same line?

* Header line
- Q: questions
  A: answers

Upvotes: 5

Views: 4673

Answers (2)

Solon
Solon

Reputation: 1

In my opinion Emacs / org-mode is inconsistent here and at times it drives me mad. Compare header lines and items:

* Header line
Text

is exported as header and body, so 2 paragraphs.

  * item1
  Text

is exported as one paragraph, one line.

  * item1\\
    Text

is exported as one paragraph with a line-break (htmltag 'br') in the middle.

  * item1

    Text

is exported as 2 paragraphs. So this should be your prefered way to code questions and answers.

But if you now code all your lists with blank lines between Text and items and use the collapsed view your emacs view looks ugly.

  * item1

    Text

  * item2
  * item3

In the collapsed view Emacs adds a blank line before '* item2' but not before '* item 3', so it is not as collapsed as it could be:

  * item1...

  * item2
  * item3

Emacs doesn't display a blank line it if you leave one before a '* Header line'.

BTW: if you add any formatting on the next line after an item (':', '#+BEGIN_QUOTE' or similar), you get 2 paragraphs.

Upvotes: 0

N.N.
N.N.

Reputation: 8512

According to the manual:

Paragraphs are separated by at least one empty line. If you need to enforce a line break within a paragraph, use ‘\’ at the end of a line.

Hence you should write

* Header line
- Q: questions\\
  A: answers

which exports, as intended, to

<ul>
<li>Q: questions<br/>
  A: answers
</li>
</ul>

Upvotes: 8

Related Questions