看到人家在 Markdown 文件中随意的书写表格,但在我自己的博客中却怎么也无法输出表格样式,最后还是通过 Google 才找到答案,需要语法解释引擎 Redcarpet,且开启 tables 选项。
在 Jekyll 中使用,请修改 _config.yml
1
2
3
markdown: redcarpet
redcarpet:
extensions: ["tables"]
随后
1
$ gem install redcarpet
在 Markdwon 文件中可以依据以下语法进行书写
1
2
3
4
|head1|head2|head3|head4|
|---|:---|:---:|---:|
|row1text1|row1text3|row1text3|row1text4|
|row2text1|row2text3|row2text3|row2text4|
其中 :所在位置表示表格的位置对齐
其最后输出的代码是
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<table>
<thead>
<tr>
<th>head1 head1 head1</th>
<th align="left">head2 head2 head2</th>
<th align="center">head3 head3 head3</th>
<th align="right">head4 head4 head4</th>
</tr>
</thead>
<tbody>
<tr>
<td>row1text1</td>
<td align="left">row1text3</td>
<td align="center">row1text3</td>
<td align="right">row1text4</td>
</tr>
<tr>
<td>row2text1</td>
<td align="left">row2text3</td>
<td align="center">row2text3</td>
<td align="right">row2text4</td>
</tr>
</tbody>
</table>
redcarpet有很多选项可以开启,譬如我就开启了
1
2
3
markdown: redcarpet
redcarpet:
extensions: ["fenced_code_blocks", "tables", "highlight", "with_toc_data", "strikethrough", "underline"]
转自:http://havee.me/internet/2013-10/use-table-with-redcarpet-and-markdown-in-jekyll.html
文章分类
标签云
Gray,
Public,
灰度发布,
灰度放量,
ABTest,
AB测试,
分流发布
CentOS,
Linux,
Shell
Mac,
Shell,
Vim
Linux
SSH
Mac
Mail
MacOSX
命令
MySQL,
调优
Apache,
HTTP,
ngnix
MySQL
gif,
jpeg,
png
Markdown
CentOS
PHP,
WordPress,
Blog
AsciiDoc,
mod_deflat
sudo
Leopard,
Snow
Leopard
Apache
Nginx,
木马
hostname,
upload
md5,
md5sum,
DNS
版本
Cookie,
PHP
Chrome
DooPHP,
CSS
Filter
IT
Java,
Maven,
Thrift
Git
Memcache
MongoDB
Node
Node.js
npm
HTML
Nginx
JDK,
Sublime
Timestamp
Lua,
Redis,
MacOSX,
Class,
Function
Sublime,
Snippets
ObjC
Cobar,
Bash
Brew,
Homebrew
AsciiDoc
Error
Yii
MacOSX,Hadoop,MapReduce
memcache,
Markdown,
Jekyll
VIM
Go,
Golang,
Redis
MacTeX,
CJK,
Tex
Tex,
LaTex
R,
Brew
Android,
Java
EC
Mou
GoAgentX,
GoAgent
Python
HBase
Markdown,Slide
Jenv
kerberos
Junit
Maven
虚拟化
LXC
Docker
bridge
AngularJS
PHPUnit
Android
composer
Golang
ReactNative,
项目管理
MAMP,
Memcache,
SecureCRT,
Zoc,
Mail,
GPG
Docker,
Supervisor
Test
Retail
Pay