mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-18 17:30:16 +01:00
🧹 chore: remove legacy markdown code (#3789)
This commit is contained in:
parent
5694ad4e55
commit
34fd960d54
1 changed files with 2 additions and 10 deletions
|
|
@ -1,6 +1,5 @@
|
||||||
import React, { memo, useMemo } from 'react';
|
import React, { memo, useMemo } from 'react';
|
||||||
import remarkGfm from 'remark-gfm';
|
import remarkGfm from 'remark-gfm';
|
||||||
import rehypeRaw from 'rehype-raw';
|
|
||||||
import remarkMath from 'remark-math';
|
import remarkMath from 'remark-math';
|
||||||
import supersub from 'remark-supersub';
|
import supersub from 'remark-supersub';
|
||||||
import rehypeKatex from 'rehype-katex';
|
import rehypeKatex from 'rehype-katex';
|
||||||
|
|
@ -8,7 +7,7 @@ import { useRecoilValue } from 'recoil';
|
||||||
import ReactMarkdown from 'react-markdown';
|
import ReactMarkdown from 'react-markdown';
|
||||||
import type { PluggableList } from 'unified';
|
import type { PluggableList } from 'unified';
|
||||||
import rehypeHighlight from 'rehype-highlight';
|
import rehypeHighlight from 'rehype-highlight';
|
||||||
import { langSubset, validateIframe, preprocessLaTeX, handleDoubleClick } from '~/utils';
|
import { langSubset, preprocessLaTeX, handleDoubleClick } from '~/utils';
|
||||||
import CodeBlock from '~/components/Messages/Content/CodeBlock';
|
import CodeBlock from '~/components/Messages/Content/CodeBlock';
|
||||||
import { useFileDownload } from '~/data-provider';
|
import { useFileDownload } from '~/data-provider';
|
||||||
import useLocalize from '~/hooks/useLocalize';
|
import useLocalize from '~/hooks/useLocalize';
|
||||||
|
|
@ -136,11 +135,9 @@ const Markdown = memo(({ content = '', isEdited, showCursor, isLatestMessage }:
|
||||||
subset: langSubset,
|
subset: langSubset,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[rehypeRaw],
|
|
||||||
];
|
];
|
||||||
|
|
||||||
if (isInitializing) {
|
if (isInitializing) {
|
||||||
rehypePlugins.pop();
|
|
||||||
return (
|
return (
|
||||||
<div className="absolute">
|
<div className="absolute">
|
||||||
<p className="relative">
|
<p className="relative">
|
||||||
|
|
@ -150,12 +147,7 @@ const Markdown = memo(({ content = '', isEdited, showCursor, isLatestMessage }:
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let isValidIframe: string | boolean | null = false;
|
if (isEdited === true || !isLatestMessage) {
|
||||||
if (isEdited !== true) {
|
|
||||||
isValidIframe = validateIframe(currentContent);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isEdited === true || (!isLatestMessage && !isValidIframe)) {
|
|
||||||
rehypePlugins.pop();
|
rehypePlugins.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue