Skip to content

Commit

Permalink
feat: basic slide generation
Browse files Browse the repository at this point in the history
  • Loading branch information
EATSTEAK committed Nov 28, 2024
1 parent 599fca8 commit b11a518
Show file tree
Hide file tree
Showing 5 changed files with 165 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"@astrojs/sitemap": "3.2.1",
"@astrojs/solid-js": "^4.4.4",
"@astrojs/tailwind": "5.1.2",
"@marp-team/marpit": "^3.1.1",
"@shikijs/transformers": "^1.22.0",
"@solid-primitives/set": "^0.5.0",
"astro": "4.16.15",
Expand Down
95 changes: 95 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 16 additions & 1 deletion src/content/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,19 @@ const blog = defineCollection({
}),
});

export const collections = { blog };
const slide = defineCollection({
// Type-check frontmatter using a schema
schema: z.object({
title: z.string(),
description: z.string(),
category: z.string().optional(),
topics: z.array(z.string()).optional(),
// Transform string to Date object
pubDate: z.coerce.date(),
updatedDate: z.coerce.date().optional(),
hidden: z.boolean().optional(),
series: z.string().optional(),
}),
});

export const collections = { blog, slide };
23 changes: 23 additions & 0 deletions src/content/slide/async-trait.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: Rust 1.75.0의 Async trait
description: 작년 말 릴리즈된 Rust 1.75.0에서 trait에 async fn을 지원하기 시작했습니다. 하지만 공개 trait에서는 이를 사용하는 걸 권장하지 않는데요. Rust의 async 문법 작동 방식을 간단히 알아보고, 왜 공개 trait에서 async 키워드 사용이 권장되지 않는지 알아봅시다.
category: rust
pubDate: 2024-06-24T13:05:00+09:00
hidden: true
topics:
- Rust
- async
- async-trait
updatedDate: 2024-08-20T17:08+09:00
internalUpdatedDate: 2024-08-23T02:13+09:00
---

안녕하세요

---

ㅁㄴㅇㄹ

---

ㅁㄴㅇㄹㄹㅁㄴㅇㅁ나앶메
30 changes: 30 additions & 0 deletions src/pages/slide/[...slug].astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
import { getCollection, type CollectionEntry } from "astro:content";
import { Marpit } from "@marp-team/marpit";
import Layout from "@layouts/Layout.astro";
export async function getStaticPaths() {
const slides = await getCollection("slide");
return slides.map((slide) => ({
params: { slug: slide.slug },
props: slide,
}));
}
const slide = Astro.props;
type Props = CollectionEntry<"slide">;
const marpit = new Marpit({
markdown: {
html: true,
}
});
const { html, css } = marpit.render(slide.body);
console.log(html);
---
<Layout title={slide.data.title} description={slide.data.description}>
<style is:inline set:html={css}></style>
<Fragment set:html={html} />
</Layout>

0 comments on commit b11a518

Please sign in to comment.