body as Markdown", () => {
const html = render(DETAILS);
expect(html).toContain("");
expect(html).toContain("benchmark_config.toml");
});
it("renders the inline
attributes posts use", () => {
const html = render('
');
expect(html).toContain('alt="A screenshot"');
expect(html).toContain('width="491"');
expect(html).not.toContain("<img");
});
it("still escapes angle brackets inside code spans", () => {
const html = render("Snapshots live at `snapshots/v.tar.gz`.");
expect(html).toContain("snapshots/v<version>.tar.gz");
});
});
/**
* Blog images are not committed to this repo — they are hosted in the community repo, and post
* bodies keep writing the portable `/blog-assets/` path. What has to hold is therefore not
* that a local file exists, but that the renderer resolves that path to the hosted URL; anything
* else a post embeds must be left alone.
*/
describe("blog post images", () => {
const HOSTED = blogAssetUrl("rag-app-en-light.webp");
it("resolves a Markdown /blog-assets/ image to the community repo", () => {
const html = renderWithImages("");
expect(html).toContain(`src="${HOSTED}"`);
expect(html).not.toContain('src="/blog-assets/');
expect(html).toContain('alt="The generated RAG app"');
});
it("resolves raw
tags too, keeping their attributes", () => {
const html = renderWithImages(
'
',
);
expect(html).toContain(`src="${blogAssetUrl("goal-mode-en-light.webp")}"`);
expect(html).toContain('class="dark:hidden"');
expect(html).toContain('width="1920"');
expect(html).toContain('height="1350"');
});
it("leaves every other image source untouched", () => {
const external = "https://github.com/user-attachments/assets/a0d866e9";
const html = renderWithImages(`\n\n`);
expect(html).toContain(`src="${external}"`);
expect(html).toContain('src="/og-cover.png"');
});
});