如何将 Scribd 阅读器嵌入 GitHub Markdown?

3

我想在GitHub的README.md中嵌入一个scribd文档查看器,但是scribd直接分享到markdown生成的代码片段无法渲染到iframescript HTML标签中:

<iframe class="scribd_iframe_embed" title="Analysis of Corporate Communication" src="https://www.scribd.com/embeds/177533131/content?start_page=1&view_mode=scroll&access_key=key-2h5x537j8hvyx8jd60c8&show_recommendations=false" data-auto-height="true" data-aspect-ratio="0.7080062794348508" scrolling="no" id="doc_28599" width="null" height="null" frameborder="0"></iframe><script type="text/javascript">(function() { var scribd = document.createElement("script"); scribd.type = "text/javascript"; scribd.async = true; scribd.src = "https://www.scribd.com/javascripts/embed_code/inject.js"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(scribd, s); })();</script>

有没有可能将原始的 Scribd 提供的 HTML 代码片段嵌入到 GitHub 中,或者将其转换为可视化的格式,并在仍然呈现为查看器时进行处理?

我已经见过用于 WordPress 的简化 markdown 标签,但不确定是否值得在 GitHub Markdown 上进一步尝试,而不将存储库转换为 github.io 网页。

提前感谢您的帮助!


与在 GitHub 中允许嵌入的内容相关的文档,请参阅 https://docs.github.com/en/repositories/working-with-files/using-files/working-with-non-code-files#error-unable-to-display。 - spuder
1个回答

2
这是从 GitHub 渲染的 Markdown 页面中经过清理/删除的 HTML 标签:

jch/html-pipeline/lib/html/pipeline/sanitization_filter.rb#L44-L106

任何脚本都将被删除。
请参见github/markup issue 245
尽管在“将 GitHub Pages 链接转换为 iframe”中有所说明,但 iframe 并未被移除。

When you publish a code template for a chart or map (or any content) on GitHub Pages, it generates an online link that you can convert into an iframe tag

  1. For any GitHub repository you have published online, go to its Settings page and scroll down to copy its GitHub Pages web address, which will appear in this general format:

    https://USERNAME.github.io/REPOSITORY
    
  2. Convert it into an iframe by enclosing the link inside quotation marks as the source, and adding both start and end tags, in this general format:

    <iframe src="https://USERNAME.github.io/RESPOSITORY">
    </iframe>
    
  3. If desired, improve the iframe appearance on the secondary site by adding any of these optional attributes, such as width or height (measured in pixels by default, or percentages), or frameborder="0" or scrolling="no", in this general format:

     <iframe src="https://USERNAME.github.io/RESPOSITORY" width="100%" height="400" frameborder="0" scrolling="no"></iframe>
    

好的,谢谢 - 那么 GitHub Pages 就是我的唯一选择了! - muratiakos
数据可视化的 iframe 链接现在返回 404。 - spuder
@spuder 谢谢。我已经恢复了正确的链接,并添加了引用页面的摘录,以便更加明显。 - VonC

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接