-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.tsx
39 lines (36 loc) · 933 Bytes
/
index.tsx
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
import React from "react";
import Head from "next/head";
import Md from "../components/md";
import index from "../articles/index.md";
import { unified } from "unified";
import remarkParse from "remark-parse";
import remarkGfm from "remark-gfm";
import remarkFrontmatter from "remark-frontmatter";
import * as MdAst from "mdast";
type Props = {
mdast: MdAst.Root;
};
export default function Home(props: Props) {
return (
<div>
<Head>
<title>namachan10777</title>
<meta name="description" content="namachan10777 profile page" />
<link rel="icon" href="/favicon.ico" />
</Head>
<main className="p-5">
<Md mdast={props.mdast} />
</main>
</div>
);
}
export async function getStaticProps() {
const md = unified()
.use(remarkParse)
.use(remarkFrontmatter, ["toml", "yaml"])
.use(remarkGfm)
.parse(index);
return {
props: { mdast: md },
};
}