mirror of
https://github.com/immich-app/static-pages.git
synced 2026-09-30 13:23:05 +08:00
fix: markdown render issues (#832)
This commit is contained in:
@@ -139,6 +139,12 @@ describe(svelteMarkdownPreprocess.name, () => {
|
|||||||
it('should leave a component inside a code fence as code', async () => {
|
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');
|
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', () => {
|
describe('images', () => {
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ export const markedSvelte = (): MarkedExtension => ({
|
|||||||
},
|
},
|
||||||
|
|
||||||
codespan({ text }) {
|
codespan({ text }) {
|
||||||
return `<Markdown.Code code={\`${text}\`} />`;
|
return `<Markdown.Code code={\`${escapeSvelteCode(text)}\`} />`;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -38,4 +38,4 @@
|
|||||||
let { size, tag, class: className } = $derived(getSizeAndTag(level));
|
let { size, tag, class: className } = $derived(getSizeAndTag(level));
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Heading {size} {tag} class={cleanClass('flex items-center gap-1', className)} {id} {children} />
|
<Heading {size} {tag} class={cleanClass('flex items-center flex-wrap gap-1 ', className)} {id} {children} />
|
||||||
|
|||||||
Reference in New Issue
Block a user