Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🧹 chore: remove legacy markdown code #3789

Merged
merged 1 commit into from
Aug 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions client/src/components/Chat/Messages/Content/Markdown.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import React, { memo, useMemo } from 'react';
import remarkGfm from 'remark-gfm';
import rehypeRaw from 'rehype-raw';
import remarkMath from 'remark-math';
import supersub from 'remark-supersub';
import rehypeKatex from 'rehype-katex';
import { useRecoilValue } from 'recoil';
import ReactMarkdown from 'react-markdown';
import type { PluggableList } from 'unified';
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 { useFileDownload } from '~/data-provider';
import useLocalize from '~/hooks/useLocalize';
Expand Down Expand Up @@ -136,11 +135,9 @@ const Markdown = memo(({ content = '', isEdited, showCursor, isLatestMessage }:
subset: langSubset,
},
],
[rehypeRaw],
];

if (isInitializing) {
rehypePlugins.pop();
return (
<div className="absolute">
<p className="relative">
Expand All @@ -150,12 +147,7 @@ const Markdown = memo(({ content = '', isEdited, showCursor, isLatestMessage }:
);
}

let isValidIframe: string | boolean | null = false;
if (isEdited !== true) {
isValidIframe = validateIframe(currentContent);
}

if (isEdited === true || (!isLatestMessage && !isValidIframe)) {
if (isEdited === true || !isLatestMessage) {
rehypePlugins.pop();
}

Expand Down