mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-03-11 02:22:37 +01:00
🛠️ fix: Preserve Dollar Signs in Code Blocks for LaTeX Parsing (#1612)
This commit is contained in:
parent
367c78f8d2
commit
36560d5d9b
2 changed files with 42 additions and 5 deletions
|
|
@ -83,4 +83,23 @@ describe('processLaTeX', () => {
|
|||
LaTeX is a typesetting system commonly used for mathematical and scientific documents. It provides a wide range of formatting options and symbols for expressing mathematical expressions.`;
|
||||
expect(processLaTeX(complexBlockLatex)).toBe(expectedOutput);
|
||||
});
|
||||
|
||||
describe('processLaTeX with code block exception', () => {
|
||||
test('ignores dollar signs inside inline code', () => {
|
||||
const content = 'This is inline code: `$100`';
|
||||
expect(processLaTeX(content)).toBe(content);
|
||||
});
|
||||
|
||||
test('ignores dollar signs inside multi-line code blocks', () => {
|
||||
const content = '```\n$100\n# $1000\n```';
|
||||
expect(processLaTeX(content)).toBe(content);
|
||||
});
|
||||
|
||||
test('processes LaTeX outside of code blocks', () => {
|
||||
const content =
|
||||
'Outside \\(x^2 + y^2 = z^2\\) and inside code block: ```\n$100\n# $1000\n```';
|
||||
const expected = 'Outside $x^2 + y^2 = z^2$ and inside code block: ```\n$100\n# $1000\n```';
|
||||
expect(processLaTeX(content)).toBe(expected);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue