【问题标题】:In reStructuredText, how do you make a table column have monospaced text?在 reStructuredText 中,如何使表格列具有等宽文本?
【发布时间】:2018-05-25 16:11:39
【问题描述】:

我想在 ReStructuredText (ReST / RST) 中创建一个表,其中每一列都应呈现为 inline literal / 等宽字体。

我找不到让内联文字跨越多行的方法,在它们前面有文本,比如表格。

我有没有办法设置表格以将特定列呈现为内联文字/等宽字体?如果不是,最好的做法是什么?

【问题讨论】:

  • 您希望新行/回车符如何显示?如果内联文字有数百个字符,从而超出了表格的宽度怎么办?
  • 我不知道如何在不渲染每一行的情况下渲染表格的列。它会帮助你渲染一个完整的表格吗?
  • @StevePiercy 在我的情况下,这些行预计在 10-30 个字符之间。我希望在不选择新行/回车的情况下将它们全部选中。
  • @Humbalan 我现在正在使用一个完整的表格,但也试图将其保持在 79 个字符的长度内,根据 style guide。但我可能会放弃表格的行长。
  • Steve Piercy 的回答是否足够?

标签: syntax markup restructuredtext


【解决方案1】:

试试这个。

.. csv-table::
    :header: Header1, Header2, Header3

    A, B, "These lines appear as one line,
    even though they are written in two lines."
    C, D, "This is normal text. ``this is inline stuff that is very long and may wrap on multiple lines of text in a table cell, and it could look OK, but who knows?`` This is normal text again."

使用 Alabaster 主题生成此屏幕截图。

您可能需要调整主题的 CSS 才能使其恰到好处。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-17
    • 2018-01-08
    • 2021-05-31
    • 1970-01-01
    • 2012-11-10
    • 1970-01-01
    相关资源
    最近更新 更多