特别喜欢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功能?