fix: markdown render issues (#832)

This commit is contained in:
Jason Rasmussen
2026-09-25 17:16:25 -04:00
committed by GitHub
parent dce188a00e
commit f4ecb65652
3 changed files with 8 additions and 2 deletions
@@ -139,6 +139,12 @@ describe(svelteMarkdownPreprocess.name, () => {
it('should leave a component inside a code fence as code', async () => {
await expect(render('```svelte\n<Markdown.Image src="a.webp" />\n```')).resolves.toContain('<Markdown.Code');
});
it('should escape template syntax inside inline code', async () => {
await expect(render('Use `${PORT}:{PORT}`')).resolves.toContain(
'<Markdown.Code code={`' + String.raw`$\{PORT\}:\{PORT\}` + '`} />',
);
});
});
describe('images', () => {
@@ -227,7 +227,7 @@ export const markedSvelte = (): MarkedExtension => ({
},
codespan({ text }) {
return `<Markdown.Code code={\`${text}\`} />`;
return `<Markdown.Code code={\`${escapeSvelteCode(text)}\`} />`;
},
},
});