fix: package markdown fixes

This commit is contained in:
Danny Avila 2024-08-23 16:34:04 -04:00
parent b3e3788261
commit c8d9af42e5
3 changed files with 254 additions and 3037 deletions

View file

@ -93,7 +93,7 @@
"rehype-raw": "^7.0.0",
"remark-directive": "^3.0.0",
"remark-gfm": "^4.0.0",
"remark-math": "^5.1.1",
"remark-math": "^6.0.0",
"remark-supersub": "^1.0.0",
"tailwind-merge": "^1.9.1",
"tailwindcss-animate": "^1.0.5",

View file

@ -23,11 +23,13 @@ type TCodeProps = {
children: React.ReactNode;
};
export const code: React.ElementType = memo(({ inline, className, children }: TCodeProps) => {
export const code: React.ElementType = memo(({ className, children }: TCodeProps) => {
const match = /language-(\w+)/.exec(className ?? '');
const lang = match && match[1];
if (inline) {
if (lang === 'math') {
return children;
} else if (typeof children === 'string' && children.split('\n').length === 1) {
return (
<code onDoubleClick={handleDoubleClick} className={className}>
{children}
@ -156,12 +158,12 @@ const Markdown = memo(({ content = '', showCursor, isLatestMessage }: TContentPr
return (
<ReactMarkdown
remarkPlugins={[
remarkDirective,
/* @ts-ignore */
supersub,
remarkGfm,
/* @ts-ignore */
[remarkMath, { singleDollarTextMath: true }],
remarkDirective,
/* @ts-ignore */
artifactPlugin,
]}

3281
package-lock.json generated

File diff suppressed because it is too large Load diff