11import { CodeBlock } from "@components/CodeBlock" ;
22import { Divider } from "@components/Divider" ;
33import { List , ListItem } from "@components/List" ;
4- import {
5- Blockquote ,
6- Checkbox ,
7- Code ,
8- Em ,
9- Kbd ,
10- Link ,
11- Text ,
12- } from "@radix-ui/themes" ;
4+ import { Blockquote , Checkbox , Code , Em , Kbd , Text } from "@radix-ui/themes" ;
135import { memo , useMemo } from "react" ;
146import type { Components } from "react-markdown" ;
157import ReactMarkdown from "react-markdown" ;
@@ -26,7 +18,7 @@ function preprocessMarkdown(content: string): string {
2618}
2719
2820const HeadingText = ( { children } : { children : React . ReactNode } ) => (
29- < Text as = "p" size = "1 " mb = "2 " style = { { color : "var(--accent-11)" } } >
21+ < Text as = "p" size = "2 " mb = "3 " style = { { color : "var(--accent-11)" } } >
3022 < strong > { children } </ strong >
3123 </ Text >
3224) ;
@@ -45,31 +37,21 @@ export const baseComponents: Components = {
4537 node . children [ 0 ] . tagName === "strong" ;
4638
4739 return (
48- < Text
49- as = "p"
50- size = "1"
51- mb = { isStrongOnly ? "2" : "3" }
52- color = "gray"
53- highContrast
54- >
40+ < Text as = "p" size = "1" mb = { isStrongOnly ? "2" : "3" } >
5541 { children }
5642 </ Text >
5743 ) ;
5844 } ,
5945 blockquote : ( { children } ) => (
60- < Blockquote
61- size = "1"
62- mb = "3"
63- style = { { color : "var(--accent-10)" , borderColor : "var(--accent-6)" } }
64- >
46+ < Blockquote size = "1" mb = "3" style = { { borderColor : "var(--accent-6)" } } >
6547 { children }
6648 </ Blockquote >
6749 ) ,
6850 code : ( { children, className } ) => {
6951 const isInline = ! className ?. includes ( "language-" ) ;
7052 if ( isInline ) {
7153 return (
72- < Code size = "1" variant = "soft" color = "gray" highContrast >
54+ < Code size = "1" variant = "outline" >
7355 { children }
7456 </ Code >
7557 ) ;
@@ -78,14 +60,10 @@ export const baseComponents: Components = {
7860 } ,
7961 pre : ( { children } ) => < CodeBlock size = "1" > { children } </ CodeBlock > ,
8062 em : ( { children } ) => (
81- < Em style = { { fontSize : "var(--font-size-1)" , color : "var(--accent-10)" } } >
82- { children }
83- </ Em >
63+ < Em style = { { fontSize : "var(--font-size-1)" } } > { children } </ Em >
8464 ) ,
8565 i : ( { children } ) => (
86- < i style = { { fontSize : "var(--font-size-1)" , color : "var(--accent-10)" } } >
87- { children }
88- </ i >
66+ < i style = { { fontSize : "var(--font-size-1)" } } > { children } </ i >
8967 ) ,
9068 strong : ( { children } ) => (
9169 < strong
@@ -100,9 +78,37 @@ export const baseComponents: Components = {
10078 </ del >
10179 ) ,
10280 a : ( { href, children } ) => (
103- < Link href = { href } target = "_blank" rel = "noopener noreferrer" size = "1" >
81+ < a
82+ href = { href }
83+ target = "_blank"
84+ rel = "noopener noreferrer"
85+ className = "markdown-link"
86+ style = { {
87+ fontSize : "var(--font-size-1)" ,
88+ display : "inline-flex" ,
89+ alignItems : "center" ,
90+ gap : "2px" ,
91+ } }
92+ >
10493 { children }
105- </ Link >
94+ < svg
95+ width = "10"
96+ height = "10"
97+ viewBox = "0 0 12 12"
98+ fill = "none"
99+ stroke = "var(--accent-11)"
100+ strokeWidth = "1.5"
101+ strokeLinecap = "round"
102+ strokeLinejoin = "round"
103+ style = { { marginLeft : "var(--space-1)" , flexShrink : 0 } }
104+ aria-label = "external link icon"
105+ role = "img"
106+ >
107+ < path d = "M4.5 1.5H2.25C1.836 1.5 1.5 1.836 1.5 2.25V9.75C1.5 10.164 1.836 10.5 2.25 10.5H9.75C10.164 10.5 10.5 10.164 10.5 9.75V7.5" />
108+ < path d = "M7.5 1.5H10.5V4.5" />
109+ < path d = "M5.25 6.75L10.5 1.5" />
110+ </ svg >
111+ </ a >
106112 ) ,
107113 kbd : ( { children } ) => < Kbd size = "1" > { children } </ Kbd > ,
108114 ul : ( { children } ) => (
@@ -116,7 +122,7 @@ export const baseComponents: Components = {
116122 </ List >
117123 ) ,
118124 li : ( { children } ) => < ListItem size = "1" > { children } </ ListItem > ,
119- hr : ( ) => < Divider size = "1 " /> ,
125+ hr : ( ) => < Divider size = "3 " /> ,
120126 // Task list checkbox
121127 input : ( { type, checked } ) => {
122128 if ( type === "checkbox" ) {
0 commit comments