@@ -35,51 +35,64 @@ const NoteMarkdown = memo(function NoteMarkdown({ content }: { content: string }
3535 < ReactMarkdown
3636 remarkPlugins = { [ remarkGfm ] }
3737 components = { {
38- p : ( { children } ) => (
39- < p className = '!mt-0 !-mb-4 text-[#E5E5E5] text-sm leading-tight ' > { children } </ p >
38+ p : ( { children } : any ) => (
39+ < p className = 'mb-2 break-words text-[#E5E5E5] text-sm' > { children } </ p >
4040 ) ,
41- h1 : ( { children } ) => (
42- < h1 className = '! mt-0 !- mb-4 font-semibold text-[#E5E5E5] text-lg leading-tight ' >
41+ h1 : ( { children } : any ) => (
42+ < h1 className = 'mt-3 mb-1 break-words font-semibold text-[#E5E5E5] text-lg first:mt-0 ' >
4343 { children }
4444 </ h1 >
4545 ) ,
46- h2 : ( { children } ) => (
47- < h2 className = '! mt-0 !- mb-4 font-semibold text-[#E5E5E5] text-base leading-tight ' >
46+ h2 : ( { children } : any ) => (
47+ < h2 className = 'mt-3 mb-1 break-words font-semibold text-[#E5E5E5] text-base first:mt-0 ' >
4848 { children }
4949 </ h2 >
5050 ) ,
51- h3 : ( { children } ) => (
52- < h3 className = '! mt-0 !- mb-4 font-semibold text-[#E5E5E5] text-sm leading-tight ' >
51+ h3 : ( { children } : any ) => (
52+ < h3 className = 'mt-3 mb-1 break-words font-semibold text-[#E5E5E5] text-sm first:mt-0 ' >
5353 { children }
5454 </ h3 >
5555 ) ,
56- h4 : ( { children } ) => (
57- < h4 className = '! mt-0 !- mb-4 font-semibold text-[#E5E5E5] text-xs leading-tight ' >
56+ h4 : ( { children } : any ) => (
57+ < h4 className = 'mt-3 mb-1 break-words font-semibold text-[#E5E5E5] text-xs first:mt-0 ' >
5858 { children }
5959 </ h4 >
6060 ) ,
61- ul : ( { children } ) => (
62- < ul className = '!- mt-4 !- mb-4 [&_li>ul]:!mt-0 [&_li>ul]:!mb-0 [&_li>ol]:!mt-0 [&_li>ol]:!mb-0 list-disc pl-4 text-[#E5E5E5] text-sm leading-tight ' >
61+ ul : ( { children } : any ) => (
62+ < ul className = 'mt-1 mb-2 list-disc break-words pl-4 text-[#E5E5E5] text-sm' >
6363 { children }
6464 </ ul >
6565 ) ,
66- ol : ( { children } ) => (
67- < ol className = '!- mt-4 !- mb-4 [&_li>ul]:!mt-0 [&_li>ul]:!mb-0 [&_li>ol]:!mt-0 [&_li>ol]:!mb-0 list-decimal pl-4 text-[#E5E5E5] text-sm leading-tight ' >
66+ ol : ( { children } : any ) => (
67+ < ol className = 'mt-1 mb-2 list-decimal break-words pl-4 text-[#E5E5E5] text-sm' >
6868 { children }
6969 </ ol >
7070 ) ,
71- li : ( { children } ) => < li className = '!mb-0 leading-tight' > { children } </ li > ,
72- code : ( { inline, children } : any ) =>
73- inline ? (
74- < code className = 'break-words rounded bg-[var(--divider)] px-1 py-0.5 text-[#F59E0B] text-xs' >
75- { children }
76- </ code >
77- ) : (
78- < code className = 'block whitespace-pre-wrap break-words rounded bg-[#1A1A1A] p-2 text-[#E5E5E5] text-xs' >
71+ li : ( { children } : any ) => < li className = 'mb-0 break-words' > { children } </ li > ,
72+ code : ( { inline, className, children, ...props } : any ) => {
73+ const isInline = inline || ! className ?. includes ( 'language-' )
74+
75+ if ( isInline ) {
76+ return (
77+ < code
78+ { ...props }
79+ className = 'whitespace-normal rounded bg-gray-200 px-1 py-0.5 font-mono text-[#F59E0B] text-xs dark:bg-[var(--surface-11)] dark:text-[#F59E0B]'
80+ >
81+ { children }
82+ </ code >
83+ )
84+ }
85+
86+ return (
87+ < code
88+ { ...props }
89+ className = 'block whitespace-pre-wrap break-words rounded bg-[#1A1A1A] p-2 text-[#E5E5E5] text-xs'
90+ >
7991 { children }
8092 </ code >
81- ) ,
82- a : ( { href, children } ) => (
93+ )
94+ } ,
95+ a : ( { href, children } : any ) => (
8396 < a
8497 href = { href }
8598 target = '_blank'
@@ -89,10 +102,12 @@ const NoteMarkdown = memo(function NoteMarkdown({ content }: { content: string }
89102 { children }
90103 </ a >
91104 ) ,
92- strong : ( { children } ) => < strong className = 'font-semibold text-white' > { children } </ strong > ,
93- em : ( { children } ) => < em className = 'text-[#B8B8B8]' > { children } </ em > ,
94- blockquote : ( { children } ) => (
95- < blockquote className = '!mt-0 !-mb-4 border-[#F59E0B] border-l-2 pl-3 text-[#B8B8B8] italic' >
105+ strong : ( { children } : any ) => (
106+ < strong className = 'break-words font-semibold text-white' > { children } </ strong >
107+ ) ,
108+ em : ( { children } : any ) => < em className = 'break-words text-[#B8B8B8]' > { children } </ em > ,
109+ blockquote : ( { children } : any ) => (
110+ < blockquote className = 'mt-1 mb-2 break-words border-[#F59E0B] border-l-2 pl-3 text-[#B8B8B8] italic' >
96111 { children }
97112 </ blockquote >
98113 ) ,
@@ -195,7 +210,7 @@ export const NoteBlock = memo(function NoteBlock({ id, data }: NodeProps<NoteBlo
195210 </ div >
196211
197212 < div className = 'relative px-[12px] pt-[6px] pb-[8px]' >
198- < div className = 'relative whitespace-pre-wrap break-words' >
213+ < div className = 'relative break-words' >
199214 { isEmpty ? (
200215 < p className = 'text-[#868686] text-sm italic' > Add a note...</ p >
201216 ) : showMarkdown ? (
0 commit comments