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 =
|
||||
data.readme &&
|
||||
DOMPurify.sanitize($md?.render(data.readme) ?? '', {
|
||||
FORBID_ATTR: ['src'],
|
||||
FORBID_TAGS: [
|
||||
'script',
|
||||
'style',
|
||||
'img',
|
||||
'video',
|
||||
'audio',
|
||||
'iframe',
|
||||
'object',
|
||||
'embed',
|
||||
'canvas',
|
||||
'source'
|
||||
]
|
||||
FORBID_TAGS: ['script', 'style', 'audio', 'iframe', 'object', 'embed', 'canvas']
|
||||
});
|
||||
|
||||
$: publishedAt = new Date(
|
||||
(data.versions.find(([version]) => version === data.version)?.[1] ?? 0) * 1000
|
||||
);
|
||||
|
||||
$: allDependencies = [
|
||||
[data.dependencies, 'Dependencies'],
|
||||
[data.peerDependencies, 'Peer Dependencies']
|
||||
|
@ -84,7 +68,7 @@
|
|||
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>
|
||||
{/each}
|
||||
</select>
|
||||
|
@ -94,7 +78,7 @@
|
|||
<section>
|
||||
<div class="section-title">Published at</div>
|
||||
<div class="flex items-center gap-2">
|
||||
<time datetime={publishedAt.toISOString()}>{publishedAt.toLocaleString()}</time>
|
||||
<time datetime={data.publishedAt.toISOString()}>{data.publishedAt.toLocaleString()}</time>
|
||||
</div>
|
||||
</section>
|
||||
<section>
|
||||
|
|
|
@ -113,7 +113,10 @@ export const load: PageLoad = async ({ params, fetch }) => {
|
|||
scope: params.scope,
|
||||
name: params.name,
|
||||
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),
|
||||
description: parsed.description,
|
||||
license: parsed.license,
|
||||
|
|
Loading…
Reference in a new issue