Mr.*_*edy 5 html-table github-flavored-markdown
HTML 允许使用以下命令将表的标题行扩展到多列colspan:
<table>
<tr><th colspan=2>Logical Operators</th></tr>
<tr><td>&&</td><td>Logical and</td></tr>
<tr><td>||</td><td>Logical or</td></tr>
<tr><td>!</td><td>Logical not</td></tr>
<tr><td>? :</td><td>Logical ternary</td></tr>
</table>Run Code Online (Sandbox Code Playgroud)
在 GitHub 上,当此 HTML 在 readme.md 文件中呈现时,它看起来像这样:
...但是使用 markdown 语法创建表格,我无法跨列跨越表格的标题行,例如我只能拆分标题文本:
| Logical | Operators |
|:---:| --- |
| `&&` | Logical and |
| `\|\|` | Logical or |
| `!` | Logical not |
| `? :` | Logical ternary |
Run Code Online (Sandbox Code Playgroud)
...并在 GitHub 上呈现 GFM 表如下所示:
我尝试模拟此解决方案以在表的数据行中使用colspan,但无法使其与标题行一起使用。有没有一种方法可以使用 GitHub 风格的 Markdown 将GFM 表的标题行跨越多个列?
我已将问题发布给GH MD repo的人们。
dam*_*oni -1
我这样做是为了生成一个包含 5 列的表格,其中标题分别跨越 3 列和 2 列:
<table>
<tr>
<td colspan=3>a <td colspan=2>b
<tr>
<td colspan=1>col1 <td colspan=1>col2 <td colspan=1>col3<td colspan=1>col4 <td colspan=1>col5
</table>
Run Code Online (Sandbox Code Playgroud)
我的两分钱。