如何使用reStructuredText创建新行?

问题描述 投票:8回答:3

如何在第一个强制换行/换行?我不希望它是一个新段落(即行之间没有额外的空格),我只想让文本从一个新行开始。谢谢!

line-breaks markup restructuredtext
3个回答
9
投票

line block syntax也工作,并且有点清洁:

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


9
投票

根据docutils raw role的文档,您可以这样做:

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.

您需要首先定义raw角色:

.. role:: raw-html(raw)
    :format: html

如示例所示,首先考虑line block syntax

| 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.

5
投票

我们在global.rst文件中添加了替换,因此我们不必一直添加原始标记。

.. |br| raw:: html

  <br/>

这样我们就可以使用| br |了当我们需要换行时。

© www.soinside.com 2019 - 2024. All rights reserved.