What is this?
md-embed is a streaming shortcode renderer for Cloudflare Workers. You write a custom element in plain HTML:
<md-embed src="docs/intro.md"></md-embed>
and the Worker resolves it while the page streams — fetching this very Markdown from R2, rendering ## into <h2>, and stamping provenance attributes (rendered, data-md-src, data-md-etag) onto the element you're reading right now.
Open DevTools and inspect this block: the
<md-embed>element is still there, carrying the ETag of the R2 object it came from.
The whole integration is three lines of Hono:
const app = new Hono<{ Bindings: Env }>();
app.use(mdEmbed<Env>((env) => r2Resolver(env.CONTENT)));
app.get("*", (c) => c.env.ASSETS.fetch(c.req.raw));