mirror of
https://github.com/immich-app/static-pages.git
synced 2026-09-30 13:23:05 +08:00
fix: github links (#840)
This commit is contained in:
@@ -221,9 +221,14 @@ export const markedSvelte = (): MarkedExtension => ({
|
||||
return `<Markdown.LineBreak />\n`;
|
||||
},
|
||||
|
||||
link({ href, title, tokens }) {
|
||||
link({ href, title, text: raw, tokens }) {
|
||||
const attributes = createAttributes({ href, title });
|
||||
if (raw === href) {
|
||||
return `<Markdown.Link${attributes} />`;
|
||||
}
|
||||
|
||||
const text = this.parser.parseInline(tokens);
|
||||
return `<Markdown.Link${createAttributes({ href, title })}>${text}</Markdown.Link>`;
|
||||
return `<Markdown.Link${attributes}>${text}</Markdown.Link>`;
|
||||
},
|
||||
|
||||
codespan({ text }) {
|
||||
|
||||
@@ -191,12 +191,22 @@ exports[`markup > should render 'link.md' correctly 1`] = `
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`markup > should render 'link-github.md' correctly 1`] = `
|
||||
{
|
||||
"code": "<script>
|
||||
import { Markdown } from '@immich/ui';
|
||||
</script>
|
||||
<Markdown.Paragraph>This is a <Markdown.Link href="https://github.com/immich-app/immich/discussions/31232">custom GitHub link</Markdown.Link> and a bare one <Markdown.Link href="https://github.com/immich-app/immich/discussions/31232" /></Markdown.Paragraph>
|
||||
",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`markup > should render 'link-shothand.md' correctly 1`] = `
|
||||
{
|
||||
"code": "<script>
|
||||
import { Markdown } from '@immich/ui';
|
||||
</script>
|
||||
<Markdown.Paragraph>This is a shorthand link: <Markdown.Link href="https://immich.app/">https://immich.app/</Markdown.Link></Markdown.Paragraph>
|
||||
<Markdown.Paragraph>This is a shorthand link: <Markdown.Link href="https://immich.app/" /></Markdown.Paragraph>
|
||||
",
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
This is a [custom GitHub link](https://github.com/immich-app/immich/discussions/31232) and a bare one <https://github.com/immich-app/immich/discussions/31232>
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
const { href, title, children }: Props = $props();
|
||||
|
||||
const github = $derived(parseGithubLink(href));
|
||||
const github = $derived(children ? undefined : parseGithubLink(href));
|
||||
</script>
|
||||
|
||||
{#if github}
|
||||
|
||||
Reference in New Issue
Block a user