GitHub markdown接受哪些内联html样式? [英] Which inline html styles does GitHub markdown accept?
问题描述
此对markdown如何解释HTML元素进行了非常详尽的描述.但是它没有讨论样式.
This gives a pretty thorough description of how HTML elements are interpreted by markdown. But it does not discuss styles.
到目前为止,我唯一可以使用的就是图像宽度.
So far, the only thing I can get to work is image width.
- 我无法在任何接受/呈现的内容列表中找到
- 似乎完全忽略了
style="....."
属性. - 我什至找不到老式样式属性的列表(与 the 样式属性
style=...
相对)
- I can't find a list anywhere of what is accepted/rendered
- It appears that the
style="....."
attribute is completely ignored. - I can't even find a list of the old-fashioned style attributes (as opposed to the style attribute
style=...
)
https://gist.github.com/abalter/46df1b79e9f429342972972d7c20cebc
编辑
将span
更改为div
,这是因为div
在@chris的回答下被@waylan的注释列入白名单标签中.
EDIT
Change span
to div
due to div
being in the whitelisted tags per @waylan's comment under @chris's answer.
编辑2
Firefox和Chrome似乎不再渲染任何样式属性.
EDIT 2
It appears that firefox and chrome don't render any style attributes any more at all.
推荐答案
对HTML进行了清理,积极删除了可能损害您和您的亲属的东西,例如
script
标签,内联样式以及class
或id
属性.有关完整的信息,请参见消毒过滤器白名单.
The HTML is sanitized, aggressively removing things that could harm you and your kin—such as
script
tags, inline-styles, andclass
orid
attributes. See the sanitization filter for the full whitelist.
您是对的:style
标签未包含在白名单中.它们将被忽略.
You're right: style
tags are not included in the whitelist. They are ignored.
允许的属性因标签而异.我建议参考上面的清洁过滤器链接.它会导致一个相当可读的Ruby源文件.
The permitted attributes differ by tag. I recommend referring to the sanitization filter link above. It leads to a fairly readable Ruby source file.
这篇关于GitHub markdown接受哪些内联html样式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!