【发布时间】:2018-07-05 19:03:52
【问题描述】:
如何在 rst 中强制换行/换行?我不希望它成为一个新段落(即行之间没有额外的空格),我只希望文本从新行开始。谢谢!
【问题讨论】:
标签: line-breaks markup restructuredtext
如何在 rst 中强制换行/换行?我不希望它成为一个新段落(即行之间没有额外的空格),我只希望文本从新行开始。谢谢!
【问题讨论】:
标签: line-breaks markup restructuredtext
line block syntax 也可以工作,而且更干净一些:
| This is a line
| This is another line
| Another new line
【讨论】:
Windows 10 上的VS Code 中工作,无需任何其他要求(只需在后续行的每一行开头添加一个| 作为连续块,其中包含没有空行的换行符他们之间)
根据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.
【讨论】:
.. role:: raw-html(raw) :format: html
我们在global.rst 文件中添加了替换,因此我们不必一直添加原始标签。
.. |br| raw:: html
<br/>
这样我们就可以在需要换行时使用|br|。
【讨论】:
<br/> 替换为 <div style="line-height: 0; padding: 0; margin: 0"></div>