Most reply context implementations run on the server, when publishing or updating a post. They fetch the original post, extract the useful parts, store them locally, and include them when rendering the reply post.
Here are the steps it would take after a document is loaded:
- Parse the local document’s
microformats and look for
repost-oflinks. (RSVPs will have an
- Fetch each of those URLs, probably using a CORS proxy like crossorigin.me.
- Parse the fetched page and render it as a reply context/link-preview. Good resources here include oEmbed, Embedly, Kevin Marks’s hovercard generator, and Slack’s unfurling.
- Inject the resulting reply context into the current post’s DOM, probably just
- Optionally include a default stylesheet that renders the reply context nicely.
I’ve long avoided implementing reply contexts here on snarfed.org. I very much enjoy using WordPress, but I don’t particularly enjoy hacking on it. Having said that, I’ve had this idea in the back of my mind for a while now, and mentioned it to enough people, so I decided it was time to write it up.