Dev*_*ate 20 markdown github-flavored-markdown
使用GitHub上" Markdown Cheatsheet "中的表格示例,您可以得到:
| Tables | Are | Cool |
| ------------- |:-------------:| -----:|
| col 3 is | right-aligned | $1600 |
| col 2 is | centered | $12 |
| zebra stripes | are neat | $1 |
Run Code Online (Sandbox Code Playgroud)
我的问题是,有没有办法左对齐标题单元格?
Way*_*lan 11
这取决于您使用的实现.
表是Markdown的非标准功能,支持它们的每个实现都有不同的表现.例如,问题中指出的"cheetsheet"在Markdown Here项目中.该项目的自述文件包括以下说明:
要了解Markdown在Markdown中可以做些什么,请查看Markdown Here Cheatsheet和其他wiki页面.
所以"cheetsheet"特定于Markdown Here使用的实现.
GitHub上已经证明其实施降价作为一种延伸的Commonmark规范的(Commonmark是降价变体,它不支持表).根据示例192,列标题接收与列单元格相同的对齐:
Run Code Online (Sandbox Code Playgroud)| abc | defghi | :-: | -----------: bar | baz <table> <thead> <tr> <th align="center">abc</th> <th align="right">defghi</th> </tr> </thead> <tbody> <tr> <td align="center">bar</td> <td align="right">baz</td> </tr></tbody></table>
因此,您需要检查您正在使用的Markdown的具体实现,并阅读该实现的文档.但是,就个人而言,我从未遇到过允许您为单元格中的标题定义单独对齐的实现.根据我的经验,要么获得与单元格匹配的标题,要么分配没有对齐的标题.
yeO*_*the 10
| Tables | Are | Cool |
|:------------- |:-------------:| -----:|
| col 3 is | right-aligned | $1600 |
| col 2 is | centered | $12 |
| col 1 is | left-aligned | $42 |
| zebra stripes | are neat | $1 |
Run Code Online (Sandbox Code Playgroud)
请注意,第二行的冒号(“:”),第二个字符是起作用的另一个选项是将数字移动到最左边的列(如下所示)
Amount | Items
------:|:-----
20 | Wooden Boards
5 | Old Parts
Run Code Online (Sandbox Code Playgroud)
将 ---- 行放在标题上方似乎不起作用。
在第二行,我将更改为将所有内容(标题和内容)都向左对齐:
| :------------ | :-------------- | :----- |
Run Code Online (Sandbox Code Playgroud)
注意每列左侧的冒号。
| 归档时间: |
|
| 查看次数: |
9382 次 |
| 最近记录: |