mirror of
https://github.com/pesde-pkg/pesde.git
synced 2024-12-12 11:00:36 +00:00
feat(website): allow images in readmes
This commit is contained in:
parent
10f0042ac3
commit
d6c80ac2a1
2 changed files with 7 additions and 20 deletions
|
@ -25,25 +25,9 @@
|
||||||
$: markdown =
|
$: markdown =
|
||||||
data.readme &&
|
data.readme &&
|
||||||
DOMPurify.sanitize($md?.render(data.readme) ?? '', {
|
DOMPurify.sanitize($md?.render(data.readme) ?? '', {
|
||||||
FORBID_ATTR: ['src'],
|
FORBID_TAGS: ['script', 'style', 'audio', 'iframe', 'object', 'embed', 'canvas']
|
||||||
FORBID_TAGS: [
|
|
||||||
'script',
|
|
||||||
'style',
|
|
||||||
'img',
|
|
||||||
'video',
|
|
||||||
'audio',
|
|
||||||
'iframe',
|
|
||||||
'object',
|
|
||||||
'embed',
|
|
||||||
'canvas',
|
|
||||||
'source'
|
|
||||||
]
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$: publishedAt = new Date(
|
|
||||||
(data.versions.find(([version]) => version === data.version)?.[1] ?? 0) * 1000
|
|
||||||
);
|
|
||||||
|
|
||||||
$: allDependencies = [
|
$: allDependencies = [
|
||||||
[data.dependencies, 'Dependencies'],
|
[data.dependencies, 'Dependencies'],
|
||||||
[data.peerDependencies, 'Peer Dependencies']
|
[data.peerDependencies, 'Peer Dependencies']
|
||||||
|
@ -84,7 +68,7 @@
|
||||||
goto(`/packages/${data.scope}/${data.name}/${event.target?.value}`);
|
goto(`/packages/${data.scope}/${data.name}/${event.target?.value}`);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{#each data.versions as [version]}
|
{#each data.versions as version}
|
||||||
<option value={version} selected={version === data.version}>{version}</option>
|
<option value={version} selected={version === data.version}>{version}</option>
|
||||||
{/each}
|
{/each}
|
||||||
</select>
|
</select>
|
||||||
|
@ -94,7 +78,7 @@
|
||||||
<section>
|
<section>
|
||||||
<div class="section-title">Published at</div>
|
<div class="section-title">Published at</div>
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
<time datetime={publishedAt.toISOString()}>{publishedAt.toLocaleString()}</time>
|
<time datetime={data.publishedAt.toISOString()}>{data.publishedAt.toLocaleString()}</time>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<section>
|
<section>
|
||||||
|
|
|
@ -113,7 +113,10 @@ export const load: PageLoad = async ({ params, fetch }) => {
|
||||||
scope: params.scope,
|
scope: params.scope,
|
||||||
name: params.name,
|
name: params.name,
|
||||||
version: parsed.version,
|
version: parsed.version,
|
||||||
versions,
|
versions: versions.map(([version]) => version),
|
||||||
|
publishedAt: new Date(
|
||||||
|
(versions.find(([version]) => version === parsed.version)?.[1] ?? 0) * 1000
|
||||||
|
),
|
||||||
authors: parsed.authors?.map(parseAuthor),
|
authors: parsed.authors?.map(parseAuthor),
|
||||||
description: parsed.description,
|
description: parsed.description,
|
||||||
license: parsed.license,
|
license: parsed.license,
|
||||||
|
|
Loading…
Reference in a new issue