Skip to content

Commit 94ff5b0

Browse files
committed
feat(ktl-3977): use resc links in md2html
1 parent 1ba082e commit 94ff5b0

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

utils/mdToHtml.tsx

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,27 @@
11
import { ComponentProps } from 'react';
2+
import { useTextStyles } from '@rescui/typography';
23
import MD2Markdown from 'markdown-to-jsx';
34

45
export type MarkdownProps = ComponentProps<typeof MD2Markdown>;
56

67
export function Markdown(props: MarkdownProps) {
7-
return <MD2Markdown {...props} />;
8+
const textCn = useTextStyles();
9+
const linkClass = textCn('rs-link');
10+
const overriddenClassNamesForTags = {
11+
a: {
12+
props: {
13+
className: linkClass
14+
}
15+
}
16+
};
17+
return <MD2Markdown
18+
{...props}
19+
options={{
20+
...props.options,
21+
overrides: {
22+
...props.options?.overrides,
23+
...overriddenClassNamesForTags
24+
}
25+
}}
26+
/>;
827
}

0 commit comments

Comments
 (0)