-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy path[...slug].astro
More file actions
79 lines (69 loc) · 1.82 KB
/
Copy path[...slug].astro
File metadata and controls
79 lines (69 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
---
import { getCollection } from "astro:content";
import Layout from "~/layouts/WikiArticle.astro";
import Pre from "~/components/wiki/Pre.astro";
import WikiLink from "~/components/wiki/WikiLink.astro";
import type { CollectionEntry } from "astro:content";
import H1 from "~/components/wiki/headings/H1.astro";
import H2 from "~/components/wiki/headings/H2.astro";
import H3 from "~/components/wiki/headings/H3.astro";
import H4 from "~/components/wiki/headings/H4.astro";
import H5 from "~/components/wiki/headings/H5.astro";
import H6 from "~/components/wiki/headings/H6.astro";
import { render } from "astro:content";
export const getStaticPaths = async () => {
const articles = await getCollection("wiki");
return articles.map((article) => {
return { params: { slug: article.id }, props: { article } };
});
};
const { article } = Astro.props;
const { Content, headings, remarkPluginFrontmatter } = await render(article);
export interface Props {
article: CollectionEntry<"wiki">;
}
---
<Layout
article={article}
headings={headings}
lastModified={remarkPluginFrontmatter.lastModified}
>
<Content
components={{
pre: Pre,
a: WikiLink,
h1: H1,
h2: H2,
h3: H3,
h4: H4,
h5: H5,
h6: H6,
}}
/>
</Layout>
<style lang="scss" is:global>
article ol {
margin-left: 0.5em;
counter-reset: item;
list-style: none;
&:first-of-type {
padding-left: 0px;
}
& > li {
margin: 0.5em auto;
&::before {
display: inline-block;
content: counter(item);
counter-increment: item;
font-size: 1.25em;
background-color: #ffffff;
color: #000000;
width: fit-content;
min-width: 1.5em;
text-align: center;
border-radius: 1em;
margin-right: 0.5em;
}
}
}
</style>