如何在 Markdown 表格中编写列表?

2024-03-20

可以在 Markdown 表格中创建一个列表(项目符号,编号与否)。

一个表看起来像这样:

| Tables        | Are           | Cool  |
| ------------- |:-------------:| -----:|
| col 3 is      | right-aligned | $1600 |
| col 2 is      | centered      |   $12 |
| zebra stripes | are neat      |    $1 |

列表如下所示:

* one
* two
* three

我可以以某种方式合并它们吗?


是的,您可以使用 HTML 合并它们。当我在中创建表时.md来自 Github 的文件,我总是喜欢使用 HTML 代码而不是 markdown。

Github 风格的 Markdown https://help.github.com/articles/github-flavored-markdown支持基本的 HTML.md文件。所以这就是答案:

Markdown 与 HTML 混合:

| Tables        | Are           | Cool  |
| ------------- |:-------------:| -----:|
| col 3 is      | right-aligned | $1600 |
| col 2 is      | centered      |   $12 |
| zebra stripes | are neat      |    $1 |
| <ul><li>item1</li><li>item2</li></ul>| See the list | from the first column|

或者纯 HTML:

<table>
  <tbody>
    <tr>
      <th>Tables</th>
      <th align="center">Are</th>
      <th align="right">Cool</th>
    </tr>
    <tr>
      <td>col 3 is</td>
      <td align="center">right-aligned</td>
      <td align="right">$1600</td>
    </tr>
    <tr>
      <td>col 2 is</td>
      <td align="center">centered</td>
      <td align="right">$12</td>
    </tr>
    <tr>
      <td>zebra stripes</td>
      <td align="center">are neat</td>
      <td align="right">$1</td>
    </tr>
    <tr>
      <td>
        <ul>
          <li>item1</li>
          <li>item2</li>
        </ul>
      </td>
      <td align="center">See the list</td>
      <td align="right">from the first column</td>
    </tr>
  </tbody>
</table>

这是它在 Github 上的样子:

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何在 Markdown 表格中编写列表? 的相关文章

随机推荐