我是Github的新手,在README.md
中想要使用Iframe或其他方法来显示HTML内容,这可能吗?
我尝试过的是创建除了锚点之外的HTML标签,但这似乎不起作用。
Github的Markdown解释器可以包含HTML。然而, HTML所能实现的有限。我建议查看这篇文章,其中提供了更多可以使用的标签信息。个人而言,我从未使用超过换行符、水平线等内容……不幸的是,文章中没有提到Iframes。
<html>
标签,但在显示之前会进行清理,只允许使用this whitelist中列出的标签。h1 h2 h3 h4 h5 h6 h7 h8 br b i strong em a pre code img tt div ins del sup sub p ol ul table thead tbody tfoot blockquote dl dt dd kbd q samp var hr ruby rt rp li tr td th s strike summary details caption figure figcaption abbr bdo cite dfn mark small span time wbr
但不允许使用iframe
标签。您可以使用 SVG 解决问题,以下是示例代码(./path/example.svg):
<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg">
<foreignObject width="100" height="100">
<div xmlns="http://www.w3.org/1999/xhtml">
<ul>
<li>text</li>
</ul>
<!-- Other embed HTML element/text into SVG -->
</div>
</foreignObject>
</svg>
然后使用图片插入的方式在任何其他的Markdown文件中嵌入SVG文件,像这样:
![](./path/example.svg)