问题
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.
回答1:
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.
The rows must be separated by blank lines.
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.
来源:https://stackoverflow.com/questions/27220871/how-to-do-cell-vertical-alignment-in-markdown-pandoc-table