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:…
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.