风格降价的最佳方式

Best way to style markdown

我在我们的网站上使用 Jekyll 使用 GitHub 页面来布局网站。效果很好。一个问题是 markdown tables 不会被正确布局。发现table是没有默认样式的,所以除非你明确地为table指定一些样式。代码如下所示:

---
layout: page
permalink: "/membership/join/"
title: Joining the Readium Foundation
---
<style>
.tablelines table, .tablelines td, .tablelines th {
    border: 1px solid black; padding:10px;
    }
</style>

|  Company Type  | Total Company Revenue | Member Dues |
|:-------------:|:-------------:|:------------:|

这在与 Jekyll 一起使用时效果很好。但是,当在 GitHub Wiki 上为相同的 repos 使用类似的代码时,标签及其内容也会被渲染。代码如下:

<style>
.tablelines table, .tablelines td, .tablelines th {
    border: 1px solid black; padding:10px;
    }
</style>

|  Publication  | URL | Langauge |
|:-------------:|:-------------:|:------------:|
| epubsecrets  | [http://epubsecrets.com/](http://epubsecrets.com/) | English |

table 呈现正常,但样式标签呈现为文本。

建议?隐藏样式标签的一些方法?

此外,我发现了这个 question/answer,它建议添加以下代码:

(setq markdown-xhtml-header-content
"<style>
    .tablelines table, .tablelines td, .tablelines th {
    border: 1px solid black; padding:10px;
    }
</style>")

不幸的是,它不起作用 - 至少在 GitHub Wiki 上不起作用。

我同意 Waylan 的观点...只需覆盖样式表中的 Jekyll 默认值即可。将此代码添加到您的自定义 style.css:

body .tablelines table, 
body .tablelines td, 
body .tablelines th {
    border: 1px solid black; padding:10px;
}

我在 CSS 规则中添加了 'body' 以尝试提高特异性。在内容中插入 CSS 是不可取的。