在 github markdown 中嵌入 openstreetmap iframe

embed openstreetmap iframe in github markdown

从 openstreetmap 页面上的共享选项卡,我可以将地图视图导出为 HTML 例如:

<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://www.openstreetmap.org/export/embed.html?bbox=6.047544479370118%2C46.23053702499607%2C6.061706542968751%2C46.23821801159735&amp;layer=mapnik" style="border: 1px solid black"></iframe>
<br/><small><a href="https://www.openstreetmap.org/#map=17/46.23438/6.05463">View Larger Map</a></small>

我想将其嵌入到 github 的 README.md 页面中,例如

四处搜索,最接近在 markdown 中嵌入 iframe 的是 gitlab guide。之后我尝试了 <figure class="video_container"> 标签,但没有看到它在 gitlab 或 github.

上工作
# how to find us?

we will be here:
<figure class="video_container">
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://www.openstreetmap.org/export/embed.html?bbox=6.047544479370118%2C46.23053702499607%2C6.061706542968751%2C46.23821801159735&amp;layer=mapnik" style="border: 1px solid black"></iframe>
</figure>

我是不是遗漏了什么,或者这是更好地留给真实 HTML 以及超越 markdown can/should 的东西?

GFM 不支持

<iframe> 嵌入 GitHub 风格的 Markdown (GFM) 不支持。这是官方的立场 from their specs:

6.11 Disallowed Raw HTML (extension)

GFM enables the tagfilter extension, where the following HTML tags will be filtered when rendering HTML output:

<title> <textarea> <style> <xmp> <iframe> <noembed> <noframes> <script> <plaintext>

[...] These tags are chosen in particular as they change how HTML is interpreted in a way unique to them [...], and this is usually undesireable in the context of other rendered Markdown content.

All other HTML tags are left untouched.


可能的解决方法

类似于 other answers 中针对视频提到的解决方案,您可以 嵌入地图的屏幕截图 ,然后 将其设为 link 到您的 OSM 地图部分的 URL: