Multi-line table cell in reStructuredText?

后端 未结 2 1147
眼角桃花
眼角桃花 2021-02-12 10:48

Is there a way to input a newline into a table cell? For example, say I have a table like this:

+----------+----------+----------+
| Header 1 | Header 2 | Header         


        
2条回答
  •  说谎
    说谎 (楼主)
    2021-02-12 11:29

    First of all I think your table syntax is incorrect, should it not be:

    +----------+----------+----------+
    | Header 1 | Header 2 | Header 3 |
    +==========+==========+==========+
    | Item 1   |          |          |
    | Item 2   |          |          |
    +----------+----------+----------+
    

    Note that the top row is made up of hyphens, not equal signs, and the rows are separated by pipes, |, not plus signs.

    Now with this table, the line block syntax:

    +----------+----------+----------+
    | Header 1 | Header 2 | Header 3 |
    +==========+==========+==========+
    | | Item 1 |          |          |
    | | Item 2 |          |          |
    +----------+----------+----------+
    

    seems to work: testing with Pandoc the bottom left cell gets transformed into the following HTML:

    Item 1
    Item 2

    Note the line break
    in between Item 1 and Item 2.

提交回复
热议问题