Skip to content

Commit 130016b

Browse files
authored
Fix html in tocs (#22936)
* fix html in tocs * render html
1 parent c70bbea commit 130016b

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

components/article/ArticlePage.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,20 @@ export const ArticlePage = () => {
4343
const { t } = useTranslation('pages')
4444
const currentPath = router.asPath.split('?')[0]
4545

46+
const RenderHTML = (props: { html: any }) => (
47+
<div dangerouslySetInnerHTML={{ __html: props.html }}></div>
48+
)
49+
4650
const renderTocItem = (item: MiniTocItem) => {
4751
return (
4852
<ActionList.Item
4953
as="a"
5054
href={item.link}
5155
key={item.title}
52-
sx={{ listStyle: 'none', padding: '2px', fontSize: '14px' }}
56+
sx={{ listStyle: 'none', padding: '2px' }}
5357
>
54-
<div className={cx(item.platform)}>
55-
{item.title}
58+
<div className={cx('lh-condensed', item.platform)}>
59+
<RenderHTML html={item.title} />
5660
{item.items && item.items.length > 0 ? (
5761
<ul className="ml-3">{item.items.map(renderTocItem)}</ul>
5862
) : null}

0 commit comments

Comments
 (0)