Github中Gist的embed和raw功能是如何实现的?
特别喜欢Gist的embed和raw的功能,例:https://gist.github.com/987978。找了很久没有找到简单易用的实现方法。在Forrst上问了一下,收到了以下答案,大家可以参考一下。
Embedding could be quite simple. If you always make sure your code box is a separate entity, like it has a separate view that could be rendered on is own (separate css/js) then that bits covered. Just pop it in an iFrame. Though, github aren't doing this - they have a fake ruby powered javascript file which just generates some HTML and uses javascript to pop it on the page: gist.github.com/…
With the raw, forrst does this. To make things faster they have redis in front of the database which stores the raw code, so when a code post is saved it just goes straight into the redis cache and then its easy to pull back out super fast.
大家有在自己的项目中实现过这样的功能吗?是否见过插件或是什么的能够简单的实现embed和raw功能?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论