在github markdown中嵌入openstreetmap iframe

问题描述 投票:3回答:1

从openstreetmap页面上的share选项卡,我可以将地图视图导出为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页面中,例如

搜索周围,最接近在标记中嵌入iframes的是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以及降价可以/应该做什么?

iframe openstreetmap github-flavored-markdown
1个回答
2
投票

GFM不支持

不支持将<iframe>嵌入到GitHub风格的Markdown(GFM)中。以下是from their specs的正式立场:

6.11不允许的原始HTML(扩展名)

GFM启用tagfilter扩展,在呈现HTML输出时将过滤以下HTML标记:

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

[...]特别选择这些标签,因为它们以某种独特的方式改变HTML的解释方式,这在其他渲染的Markdown内容的上下文中通常是不可取的。

所有其他HTML标记保持不变。


可能的解决方法

other answers中提到的视频解决方案类似,您可以嵌入地图的屏幕截图,并将其作为指向OSM地图部分网址的链接:

detail of map section of Hanoi, Vietnam

© www.soinside.com 2019 - 2024. All rights reserved.