Skip to content

Commit

Permalink
Ignore undefined when generating code block
Browse files Browse the repository at this point in the history
  • Loading branch information
bclswl0827 committed Feb 3, 2024
1 parent da52b8e commit 72c14e5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/Markdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ export const Markdown = (props: MarkdownProps) => {
),
code: ({ className, children }) => {
const match = /language-(\w+)/.exec(className ?? "");
const code = String(children).replace(typingEffect, "❚");
const code = (!!children ? String(children) : "❚").replace(
typingEffect,
"❚"
);

return match ? (
<>
<Prism
Expand Down

0 comments on commit 72c14e5

Please sign in to comment.