mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-27 13:48:51 +01:00
🧮 feat: Improve LaTeX rendering consistency (#3763)
* refactor: simplify LaTeX pre-processing for more consistent rendering, disables `singleDollarTextMath` * refactor: disable singleDollarTextMath in all markdown components * wip: first pass * refactor: preserve code blocks and convert rather than preserve LaTeX delimiters * refactor: remove unused escapeDollarNumber function from latex.ts
This commit is contained in:
parent
967e8a1e92
commit
ea5140ff0f
3 changed files with 156 additions and 3 deletions
|
|
@ -8,7 +8,7 @@ import { useRecoilValue } from 'recoil';
|
|||
import ReactMarkdown from 'react-markdown';
|
||||
import type { PluggableList } from 'unified';
|
||||
import rehypeHighlight from 'rehype-highlight';
|
||||
import { cn, langSubset, validateIframe, processLaTeX, handleDoubleClick } from '~/utils';
|
||||
import { langSubset, validateIframe, preprocessLaTeX, handleDoubleClick } from '~/utils';
|
||||
import CodeBlock from '~/components/Messages/Content/CodeBlock';
|
||||
import { useFileDownload } from '~/data-provider';
|
||||
import useLocalize from '~/hooks/useLocalize';
|
||||
|
|
@ -123,7 +123,7 @@ const Markdown = memo(({ content = '', isEdited, showCursor, isLatestMessage }:
|
|||
let currentContent = content;
|
||||
if (!isInitializing) {
|
||||
currentContent = currentContent.replace('z-index: 1;', '') || '';
|
||||
currentContent = LaTeXParsing ? processLaTeX(currentContent) : currentContent;
|
||||
currentContent = LaTeXParsing ? preprocessLaTeX(currentContent) : currentContent;
|
||||
}
|
||||
|
||||
const rehypePlugins: PluggableList = [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue