Skip to content

Commit 5ba8779

Browse files
committed
fix escape interpreter
Signed-off-by: FaheemOnHub <[email protected]>
1 parent 1e89833 commit 5ba8779

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/custom/Markdown/index.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ export const RenderMarkdown: React.FC<RenderMarkdownProps> = ({ content }) => {
6565
};
6666

6767
export const RenderMarkdownTooltip: React.FC<RenderMarkdownProps> = ({ content }) => {
68+
const processDescription = (desc: string | undefined): string | undefined => {
69+
if (!desc) return desc;
70+
try {
71+
// -> json.parse will handle esacpe characters
72+
return JSON.parse(`"${desc}"`);
73+
} catch {
74+
return desc;
75+
}
76+
};
6877
return (
6978
<ReactMarkdown
7079
remarkPlugins={[remarkGfm]}
@@ -96,7 +105,7 @@ export const RenderMarkdownTooltip: React.FC<RenderMarkdownProps> = ({ content }
96105
td: ({ ...props }) => <StyledMarkdownTd>{props.children}</StyledMarkdownTd>
97106
}}
98107
>
99-
{content}
108+
{processDescription(content) as string}
100109
</ReactMarkdown>
101110
);
102111
};

0 commit comments

Comments
 (0)