天使漫步IT工作室天使漫步IT工作室

【markdown技巧】- 快速生成表格(table)样式


Warning: count(): Parameter must be an array or an object that implements Countable in /www/wwwroot/u11u.com/usr/themes/wq/functions.php on line 110

Warning: count(): Parameter must be an array or an object that implements Countable in /www/wwwroot/u11u.com/usr/themes/wq/functions.php on line 116

1.表格样式

编辑表格在markdown里面有两种办法,一个是利用markdown默认支持的语法,即:

---- 和 | 等符号相结合。例如:

dog | bird | cat
----|------|----
foo | foo  | foo
bar | bar  | bar
baz | baz  | baz

得到样式如图:

QQ截图20170806152022.png

这一类的排版说实话很难用,曾经试图编辑一个下载历史表格然后就跪了。

<br/>

2.使用table标签

上一个文章中《markdown中怎么让内容换行》一文中已经介绍,其实markdown只是把特一些特殊的标签换成了HTML标签了而已,如果不是特殊标签则不被markdown解释器所转换,基于整个原理,咱们可以直接使用HTML标签中的table标签即可。

上面的表格代码就可以使用:

<table>
<thead>
<tr>
<th>Tables</th>
<th style="text-align:center">Are</th>
<th style="text-align:right">Cool</th>
</tr>
</thead>
<tbody>
<tr>
<td>col 3 is</td>
<td style="text-align:center">right-aligned</td>
<td style="text-align:right">$1600</td>
</tr>
<tr>
<td>col 2 is</td>
<td style="text-align:center">centered</td>
<td style="text-align:right">$12</td>
</tr>
<tr>
<td>zebra stripes</td>
<td style="text-align:center">are neat</td>
<td style="text-align:right">$1</td>
</tr>
</tbody>
</table>

3.使用Tables Generator快速生成表格

Tables Generator 可以在线生成 LaTeX、HTML、Markdown 格式的表格代码,支持在表格中填充数据,修改字体/背景颜色,对齐方式等等。

本站原创,欢迎转载,转载敬请标明出处:天使漫步IT工作室 » 【markdown技巧】- 快速生成表格(table)样式
添加新评论


Warning: Use of undefined constant php - assumed 'php' (this will throw an Error in a future version of PHP) in /www/wwwroot/u11u.com/usr/themes/wq/comments.php on line 38