Skip to content

Commit cfee99d

Browse files
chore(deps): update dependency react-markdown to v10 (#1045)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Ricardo Amaral <[email protected]>
1 parent 23baa44 commit cfee99d

File tree

3 files changed

+36
-35
lines changed

3 files changed

+36
-35
lines changed

package-lock.json

Lines changed: 4 additions & 4 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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
"react": "18.3.1",
130130
"react-dom": "18.3.1",
131131
"react-icons": "5.5.0",
132-
"react-markdown": "9.1.0",
132+
"react-markdown": "10.1.0",
133133
"react-syntax-highlighter": "15.6.1",
134134
"react-use-event-hook": "0.9.6",
135135
"rehype-raw": "7.0.0",

stories/components/markdown-renderer.tsx

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -10,37 +10,38 @@ type MarkdownRendererProps = {
1010

1111
function MarkdownRenderer({ markdown }: MarkdownRendererProps) {
1212
return (
13-
<ReactMarkdown
14-
className="sb-unstyled markdown-body"
15-
rehypePlugins={[rehypeRaw]}
16-
remarkPlugins={[remarkGfm]}
17-
components={{
18-
// eslint-disable-next-line react/no-unstable-nested-components
19-
pre({ children }) {
20-
return <>{children}</>
21-
},
22-
// eslint-disable-next-line react/no-unstable-nested-components
23-
code({ children, className }) {
24-
const codeLanguage = /language-(\w+)/.exec(className || '')
13+
<div className="sb-unstyled markdown-body">
14+
<ReactMarkdown
15+
rehypePlugins={[rehypeRaw]}
16+
remarkPlugins={[remarkGfm]}
17+
components={{
18+
// eslint-disable-next-line react/no-unstable-nested-components
19+
pre({ children }) {
20+
return <>{children}</>
21+
},
22+
// eslint-disable-next-line react/no-unstable-nested-components
23+
code({ children, className }) {
24+
const codeLanguage = /language-(\w+)/.exec(className || '')
2525

26-
return codeLanguage ? (
27-
<SyntaxHighlighter
28-
language={codeLanguage[1]}
29-
// Match `github-markdown-css` style
30-
customStyle={{
31-
background: '#f6f8fa',
32-
}}
33-
>
34-
{String(children).replace(/\n$/, '')}
35-
</SyntaxHighlighter>
36-
) : (
37-
<code className={className}>{children}</code>
38-
)
39-
},
40-
}}
41-
>
42-
{markdown}
43-
</ReactMarkdown>
26+
return codeLanguage ? (
27+
<SyntaxHighlighter
28+
language={codeLanguage[1]}
29+
// Match `github-markdown-css` style
30+
customStyle={{
31+
background: '#f6f8fa',
32+
}}
33+
>
34+
{String(children).replace(/\n$/, '')}
35+
</SyntaxHighlighter>
36+
) : (
37+
<code className={className}>{children}</code>
38+
)
39+
},
40+
}}
41+
>
42+
{markdown}
43+
</ReactMarkdown>
44+
</div>
4445
)
4546
}
4647

0 commit comments

Comments
 (0)