Skip to content

Commit 4219042

Browse files
committed
fix(markdown): sanitize rendered description from markdown
Applies the rehype sanitation plugin to the HypercertDetails ReadMore component.
1 parent f5df478 commit 4219042

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

components/read-more.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ import {
66
CollapsibleTrigger,
77
} from "./ui/collapsible";
88

9-
import { useState } from "react";
109
import MDEditor from "@uiw/react-md-editor";
10+
import { useState } from "react";
11+
import rehypeSanitize from "rehype-sanitize";
1112

1213
export default function ReadMore({
1314
text,
@@ -52,7 +53,7 @@ export default function ReadMore({
5253
{!isOpen && <MDEditor.Markdown source={cutoffText} />}
5354
<Collapsible onOpenChange={setIsOpen}>
5455
<CollapsibleContent>
55-
<MDEditor.Markdown source={text} />
56+
<MDEditor.Markdown source={text} rehypePlugins={[rehypeSanitize]} />
5657
</CollapsibleContent>
5758
<CollapsibleTrigger className="text-blue-600 hover:underline text-xs lg:text-sm">
5859
{isOpen ? "Read less" : "Read more"}

0 commit comments

Comments
 (0)