如何在markdown/pandoc表中进行单元格垂直对齐? [英] How to do cell vertical alignment in markdown/pandoc table?

查看:135
本文介绍了如何在markdown/pandoc表中进行单元格垂直对齐?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在markdown/pandoc中指定表格单元格内容的垂直对齐方式?

Is there a way to to specify the vertical alignment of table cell contents in markdown/pandoc?

详细信息:
默认行为是居中对齐,我希望单元格内容与单元格顶部对齐.有关默认行为的示例:

Details:
The default behavior is center alignment, I want cell contents to be aligned to the top of the cell. For an example of the default behavior:

|           |               |
|-----------|---------------|
| Something | This is a very long line that breaks into two. This is a very long line that breaks into two.This is a very long line that breaks into two.This is a very long line that breaks into two.|

上例中左单元格的内容将垂直居中.

The contents of the left cell in the example above will be vertically-centered.

推荐答案

使用多行表语法(仅受Pandoc支持-这是Markdown的Pandoc特定扩展):

Use multiline table syntax (supported by Pandoc only -- it is a Pandoc-specific extension of Markdown):

   -------------------------------------------------------------
    Centered   Default           Right Left
     Header    Aligned         Aligned Aligned
   ----------- ------- --------------- -------------------------
      First    row                12.0 Example of a row that
                                       spans multiple lines.

     Second    row                 5.0 Here's another one. Note
                                       the blank line between
                                       rows.
   -------------------------------------------------------------

   Table: Here's the caption. It, too, may span
   multiple lines.

多行表允许页眉和表行跨越多行文本(但不支持跨表多列或多行的单元格).

Multiline tables allow headers and table rows to span multiple lines of text (but cells that span multiple columns or rows of the table are not supported).

这些工作方式类似于简单表,但有以下区别:

These work like simple tables, but with the following differences:

  • 在标题文本之前,它们必须以破折号开头(除非省略了标题).

  • They must begin with a row of dashes, before the header text (unless the headers are omitted).

它们必须以破折号结尾,然后是空白行.

They must end with a row of dashes, then a blank line.

行必须用空白行分隔.

在多行表中,表解析器注意列的宽度,并且编写者尝试在输出中重现这些相对宽度.因此,如果您发现输出中的一列太窄,请尝试在markdown源中将其加宽.

In multiline tables, the table parser pays attention to the widths of the columns, and the writers try to reproduce these relative widths in the output. So, if you find that one of the columns is too narrow in the output, try widening it in the markdown source.

这篇关于如何在markdown/pandoc表中进行单元格垂直对齐?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆