问题描述
如何将CSS添加到github的markdown语言中?
How can I add CSS to github's markdown language?
我已经能够通过使用html标记内的style属性来做到这一点,例如:
I've been able to do so by using the style property inside html tags, like:
<p style="text-align: center;">This is some random text</p>
但是,如果我将css移至开头,例如:
But if I move the css to the beginning, like:
<style>
p {
text-align: center;
}
</style>
<p>This is some random text</p>
Github无法识别它,只是将CSS代码写入屏幕.
Github doesn't recognize it, and just writes to the screen the css code.
我正在使用Atom,Markdown Preview软件包实际上可以正确识别此问题,即使在远程存储库上它显示错误.Google Chrome扩展Markdown Preview Plus也是如此.
I'm using Atom, and the package Markdown Preview actually recognizes this correctly, even though on the remote repository it shows wrong. And so does the Google Chrome extension Markdown Preview Plus.
有没有办法做到这一点?在html标签中编写CSS感觉很不对.
Is there a way to do this? Writing css within html tags just feels plain wrong.
推荐答案
style
标签未包含在GitHub的白名单中,因此将其删除.实际上,我很惊讶内联 style
属性起作用;它们似乎也未包含在白名单中,并且在上一段中已明确提及.
style
tags are not included in GitHub's whitelist, so they are removed. I'm actually surprised that inline style
attributes work; they don't seem to be included in the whitelist, either, and are explicitly mentioned in the previous paragraph.
无论如何,GitHub不允许Markdown中包含任意HTML.
In any case, GitHub does not permit arbitrary HTML to be included in Markdown.
这篇关于将Github markdown语言与CSS混合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!