I need this code to return a Mark down with the highlighted annotations, right now it…
- User
I need this code to return a Mark down with the highlighted annotations, right now it returns children.. can we combine them or something? const renderAnnotatedText = (text: string) => { if (annotationIndex === null || !selectedText) { //Render it in the same style as previous with STYLE_LEVEL_TO_CLASSES.p return }
codeconst parts = text.split(new RegExp(`(${selectedText})`, "g")); let currentCharIndex = 0; const children: React.ReactNode[] = parts.map((part, index) => { if (part === selectedText && currentCharIndex === annotationIndex) { currentCharIndex += part.length; return ( <> <span className='bg-yellow-100'>{selectedText}</span> <input ref={inputRef} type='text' style={{ fontSize: '14px', // Adjust the font size as needed height: '2rem', // Adjust the height as needed width: '200px', // Adjust the width as needed padding: '0.5rem', // Adjust the padding as needed lineHeight: '1.5', // Adjust the line height as needed fontFamily: 'Arial, sans-serif' // Adjust the font family as needed }} className={cn( 'min-h-[1rem] md:min-h-[2rem]', "w-auto", 'self-center', 'rounded', 'px-1 px-2', 'border', 'bg-danger-50', 'text-lg', 'border-secondary-400', 'transition ease-in-out', 'focus:border-secondary-700', 'focus:outline-none', 'placeholder-base' )} placeholder='Add annotation . . .' onKeyDown={(e) => { if (e.key === 'Enter') { const target = e.target as HTMLInputElement; addAnnotation(target.value); target.value = ''; } }} /> </> ); - Assistant
- User
I need this to return a Markdown only... please use the children to assemble it.
- Assistant