Skip to content

Commit b0b71f9

Browse files
committed
Fix nested anchor tags in Markdown
1 parent a8b9add commit b0b71f9

File tree

3 files changed

+47
-6
lines changed

3 files changed

+47
-6
lines changed

package-lock.json

Lines changed: 39 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
"puppeteer": "^24.0.0",
7777
"react": "^18.3.1",
7878
"react-dom": "^18.3.1",
79+
"react-markdown": "^9.0.3",
7980
"react-textarea-autosize": "^8.5.7",
8081
"redirects-in-workers": "^0.0.5",
8182
"rehype-autolink-headings": "^7.1.0",

src/components/FieldCatalog.jsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useState } from "react";
22
import FieldBadges from "./fields/FieldBadges";
3-
import { marked } from "marked";
3+
import Markdown from "react-markdown";
44

55
const FieldCatalog = ({ fields }) => {
66
const [filters, setFilters] = useState({
@@ -116,12 +116,13 @@ const FieldCatalog = ({ fields }) => {
116116
{field.name}
117117
</span>
118118
</div>
119-
<p
119+
<Markdown
120120
className="!mt-2 line-clamp-2 text-sm leading-6"
121-
dangerouslySetInnerHTML={{
122-
__html: marked.parseInline(field.summary),
123-
}}
124-
/>
121+
disallowedElements={["a"]}
122+
unwrapDisallowed={true}
123+
>
124+
{field.summary}
125+
</Markdown>
125126

126127
{field.plan_info_label && (
127128
<div className="!mt-2 text-xs">

0 commit comments

Comments
 (0)