GitHub markdown接受哪些内联html样式? [英] Which inline html styles does GitHub markdown accept?

查看:132
本文介绍了GitHub markdown接受哪些内联html样式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对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.

  1. 我无法在任何接受/呈现的内容列表中找到
  2. 似乎完全忽略了style="....."属性.
  3. 我什至找不到老式样式属性的列表(与 the 样式属性style=...相对)
  1. I can't find a list anywhere of what is accepted/rendered
  2. It appears that the style="....." attribute is completely ignored.
  3. 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.

推荐答案

在GitHub将Markdown转换为HTML之后

对HTML进行了清理,积极删除了可能损害您和您的亲属的东西,例如script标签,内联样式以及classid属性.有关完整的信息,请参见消毒过滤器白名单.

The HTML is sanitized, aggressively removing things that could harm you and your kin—such as script tags, inline-styles, and class or id 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆