mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-03-11 18:42:36 +01:00
fix: package markdown fixes
This commit is contained in:
parent
b3e3788261
commit
c8d9af42e5
3 changed files with 254 additions and 3037 deletions
|
|
@ -93,7 +93,7 @@
|
||||||
"rehype-raw": "^7.0.0",
|
"rehype-raw": "^7.0.0",
|
||||||
"remark-directive": "^3.0.0",
|
"remark-directive": "^3.0.0",
|
||||||
"remark-gfm": "^4.0.0",
|
"remark-gfm": "^4.0.0",
|
||||||
"remark-math": "^5.1.1",
|
"remark-math": "^6.0.0",
|
||||||
"remark-supersub": "^1.0.0",
|
"remark-supersub": "^1.0.0",
|
||||||
"tailwind-merge": "^1.9.1",
|
"tailwind-merge": "^1.9.1",
|
||||||
"tailwindcss-animate": "^1.0.5",
|
"tailwindcss-animate": "^1.0.5",
|
||||||
|
|
|
||||||
|
|
@ -23,11 +23,13 @@ type TCodeProps = {
|
||||||
children: React.ReactNode;
|
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 match = /language-(\w+)/.exec(className ?? '');
|
||||||
const lang = match && match[1];
|
const lang = match && match[1];
|
||||||
|
|
||||||
if (inline) {
|
if (lang === 'math') {
|
||||||
|
return children;
|
||||||
|
} else if (typeof children === 'string' && children.split('\n').length === 1) {
|
||||||
return (
|
return (
|
||||||
<code onDoubleClick={handleDoubleClick} className={className}>
|
<code onDoubleClick={handleDoubleClick} className={className}>
|
||||||
{children}
|
{children}
|
||||||
|
|
@ -156,12 +158,12 @@ const Markdown = memo(({ content = '', showCursor, isLatestMessage }: TContentPr
|
||||||
return (
|
return (
|
||||||
<ReactMarkdown
|
<ReactMarkdown
|
||||||
remarkPlugins={[
|
remarkPlugins={[
|
||||||
remarkDirective,
|
|
||||||
/* @ts-ignore */
|
/* @ts-ignore */
|
||||||
supersub,
|
supersub,
|
||||||
remarkGfm,
|
remarkGfm,
|
||||||
/* @ts-ignore */
|
/* @ts-ignore */
|
||||||
[remarkMath, { singleDollarTextMath: true }],
|
[remarkMath, { singleDollarTextMath: true }],
|
||||||
|
remarkDirective,
|
||||||
/* @ts-ignore */
|
/* @ts-ignore */
|
||||||
artifactPlugin,
|
artifactPlugin,
|
||||||
]}
|
]}
|
||||||
|
|
|
||||||
3281
package-lock.json
generated
3281
package-lock.json
generated
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue