2

在 Jekyll GitHub Pages 中使用 Redcarpet 时,我遇到了与 Table not render 相同的问题?

我使用答案将表格渲染到我的 github Jekyll 页面中。

但它不会渲染表格的框架或线条。

是否有可能获得带有框架和线条的表格输出?而如果

我的降价看起来像这样:

| Test | Test | Test | 
| -----|:----:|-----:|
| test | test | test |         
| test | test | test |
| test | test | test |
| test | test | test |

我的 _config.yml 是这样的:

markdown: redcarpet
redcarpet:
  extensions: [tables]
4

1 回答 1

3

它没有绘制任何边框的原因是因为您的table和相关元素没有样式。

这是我汇总的一个repo,用于演示应用于表格的样式。你可以在这里看到结果。

在您的存储库中创建一个 main.css 文件并将其包含在您的 HTML 页面中。

<!doctype html>
<html>
<head>
    <link rel="stylesheet" href="main.css">
</head>
<body>
    {{ content }}
</body>
</html>

然后在 main.css 中,您可以将样式应用于所有 Markdown 生成的表格:

table {
    border:#ccc 1px solid;
    border-radius:3px;
}
table th {
    padding:21px 25px 22px 25px;
    border-top:1px solid #fafafa;
    border-bottom:1px solid #e0e0e0;
}
table tr {
    padding-left:20px;
}
table td {
    padding:18px;
    border-top: 1px solid #ffffff;
    border-bottom:1px solid #e0e0e0;
    border-left: 1px solid #e0e0e0;
}

如果您的 repo 中已经有 CSS,那么只需添加样式并确保 CSS 包含在您的 HTML 中。

于 2015-05-22T21:01:19.407 回答