Skip to content

Commit c470ea7

Browse files
committed
uses React Markdown to render contents
1 parent fe40f2f commit c470ea7

File tree

3 files changed

+839
-6
lines changed

3 files changed

+839
-6
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"react-blurhash": "^0.3.0",
3939
"react-dom": "^18.3.1",
4040
"react-intl": "^7.1.11",
41+
"react-markdown": "^10.1.0",
4142
"sass": "^1.87.0",
4243
"sharp": "^0.34.1",
4344
"stripe": "^18.1.0",

pages/roadmap.tsx

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import matter from "gray-matter"
99
import { InferGetStaticPropsType } from "next"
1010
import z from "zod"
1111
import { RoadmapStatus } from "../components/RoadmapStatus"
12+
import Markdown from "react-markdown"
1213

1314
const Roadmap = ({
1415
features,
@@ -44,11 +45,11 @@ const Roadmap = ({
4445
<h2 className="font-bold text-b1 mb-2 col-start-2">
4546
{data.title}
4647
</h2>
47-
{content.split("\n").map((line, lineIndex) => (
48-
<p key={lineIndex} className="col-start-2">
49-
{line}
50-
</p>
51-
))}
48+
<div className="col-start-2 flex flex-col gap-1">
49+
<Markdown allowedElements={allowedElements}>
50+
{content}
51+
</Markdown>
52+
</div>
5253
</section>
5354
))}
5455
</div>
@@ -90,6 +91,16 @@ const Roadmap = ({
9091
)
9192
}
9293

94+
const allowedElements: ReadonlyArray<string> = [
95+
"p",
96+
"strong",
97+
"em",
98+
"a",
99+
"ul",
100+
"ol",
101+
"li",
102+
]
103+
93104
const featureSchema = z.object({
94105
data: z.object({
95106
title: z.string(),

0 commit comments

Comments
 (0)