我遇到了与 Table not render when use Redcarpet in Jekyll GitHub Pages? 相同的问题
我使用答案将表格渲染到我的 github Jekyll 页面中。
但它不会渲染表格的框架或线条。
是否有可能获得带有框架和线条的表格输出?如果
我的 Markdown 看起来像这样:
| Test | Test | Test |
| -----|:----:|-----:|
| test | test | test |
| test | test | test |
| test | test | test |
| test | test | test |
我的 _config.yml 像这样:
markdown: redcarpet
redcarpet:
extensions: [tables]
最佳答案
它没有绘制任何边框的原因是因为您的表格
和相关元素没有样式。
这是一个repo我将它们放在一起来演示应用于表格的样式。可以看到结果here .
在存储库中创建 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;
}
如果您的存储库中已有 CSS,则只需添加样式并确保 CSS 包含在您的 HTML 中。
关于markdown - Jekyll Redcarpet 渲染带框架的 table ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30398543/