mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-20 10:20:15 +01:00
fix: correctly escapes user content in search results
This commit is contained in:
parent
3295eb806c
commit
b496174b4c
1 changed files with 7 additions and 4 deletions
|
|
@ -8,8 +8,8 @@ import rehypeRaw from 'rehype-raw'
|
||||||
import CodeBlock from './CodeBlock';
|
import CodeBlock from './CodeBlock';
|
||||||
import { langSubset } from '~/utils/languages';
|
import { langSubset } from '~/utils/languages';
|
||||||
|
|
||||||
const Content = React.memo(({ content, isCreatedByUser = false }) => {
|
const Content = React.memo(({ content, isCreatedByUser = true }) => {
|
||||||
const rehypePlugins = [
|
let rehypePlugins = [
|
||||||
[rehypeKatex, { output: 'mathml' }],
|
[rehypeKatex, { output: 'mathml' }],
|
||||||
[
|
[
|
||||||
rehypeHighlight,
|
rehypeHighlight,
|
||||||
|
|
@ -20,12 +20,15 @@ const Content = React.memo(({ content, isCreatedByUser = false }) => {
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
[rehypeRaw],
|
[rehypeRaw],
|
||||||
]
|
];
|
||||||
|
|
||||||
|
rehypePlugins = isCreatedByUser ? rehypePlugins.slice(0, -1) : rehypePlugins;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ReactMarkdown
|
<ReactMarkdown
|
||||||
remarkPlugins={[remarkGfm, [remarkMath, { singleDollarTextMath: false }]]}
|
remarkPlugins={[remarkGfm, [remarkMath, { singleDollarTextMath: false }]]}
|
||||||
rehypePlugins={isCreatedByUser ? rehypePlugins.slice(-1) : rehypePlugins}
|
rehypePlugins={rehypePlugins}
|
||||||
linkTarget="_new"
|
linkTarget="_new"
|
||||||
components={{
|
components={{
|
||||||
code,
|
code,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue