Skip to content

Commit 186a132

Browse files
Merge pull request #689 from sudhanshutech/pre/tag
Fix `pre` tag of html and its theme
2 parents 8b0631d + c67ed11 commit 186a132

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

src/custom/Markdown/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
StyledMarkdownH6,
1313
StyledMarkdownLi,
1414
StyledMarkdownP,
15+
StyledMarkdownPre,
1516
StyledMarkdownTd,
1617
StyledMarkdownTh,
1718
StyledMarkdownTooltipP,
@@ -51,7 +52,8 @@ export const RenderMarkdown: React.FC<RenderMarkdownProps> = ({ content }) => {
5152
ul: ({ ...props }) => <StyledMarkdownUl>{props.children}</StyledMarkdownUl>,
5253
li: ({ ...props }) => <StyledMarkdownLi>{props.children}</StyledMarkdownLi>,
5354
th: ({ ...props }) => <StyledMarkdownTh>{props.children}</StyledMarkdownTh>,
54-
td: ({ ...props }) => <StyledMarkdownTd>{props.children}</StyledMarkdownTd>
55+
td: ({ ...props }) => <StyledMarkdownTd>{props.children}</StyledMarkdownTd>,
56+
pre: ({ ...props }) => <StyledMarkdownPre>{props.children}</StyledMarkdownPre>
5557
}}
5658
>
5759
{content}

src/custom/Markdown/style.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,8 @@ export const StyledMarkdownTd = styled('td')(({ theme }) => ({
7171
marginBlock: '0px',
7272
...theme.typography.textB1Regular
7373
}));
74+
75+
export const StyledMarkdownPre = styled('pre')(({ theme }) => ({
76+
background: theme.palette.background.code,
77+
whiteSpace: 'pre-line'
78+
}));

0 commit comments

Comments
 (0)