Skip to content

Commit 7eabf78

Browse files
authored
Merge pull request #1095 from FaheemOnHub/fix/3786/escapeChar
fix escape char not interpreted
2 parents 609d16d + 5ba8779 commit 7eabf78

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)