Skip to content
This repository was archived by the owner on Mar 18, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
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
6 changes: 1 addition & 5 deletions src/app/_common/components/chatParser/ChatParser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ import {
findTodoDetailsBlocks
} from '@/app/_common/components/chatParser/ChatParserTodoDetails';
import {
parseSimpleMarkdown,
normalizeTableSeparators
parseSimpleMarkdown
} from '@/app/_common/components/chatParser/ChatParserMarkdown';
import { parseCitation } from '@/app/_common/components/chatParser/ChatParserCite';
import { convertToString, needsConversion } from '@/app/_common/components/chatParser/ChatParserNonStr';
Expand Down Expand Up @@ -91,9 +90,6 @@ export const MessageRenderer: React.FC<MessageRendererProps> = ({
return null;
}

// 비표준 파이프 문자를 표준 Markdown 파이프로 정규화
processedContent = normalizeTableSeparators(processedContent);

if (isUserMessage) {
return (
<div className={`${styles.markdownContent} ${className}`}>
Expand Down
12 changes: 8 additions & 4 deletions src/app/_common/components/chatParser/ChatParserLatex.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ export const findLatexBlocks = (text: string): LatexBlockInfo[] => {

// 정규식을 사용한 더 정확한 LaTeX 블록 찾기
const blockRegex = /\$\$([\s\S]*?)\$\$/g;
const inlineRegex = /(?<!\$)\$(?!\$)([^$\n]+)\$(?!\$)/g;
// 인라인 수식: $ 바로 뒤에 숫자가 오는 경우는 제외 (달러 금액 표시)
const inlineRegex = /(?<!\$)\$(?!\$)(?!\d)([^$\n]+)\$(?!\$)/g;

let match;
const allMatches: Array<{ start: number, end: number, content: string, isBlock: boolean }> = [];
Expand Down Expand Up @@ -421,10 +422,13 @@ export const processLatexInText = (
* 텍스트에 LaTeX가 포함되어 있는지 확인하는 헬퍼 함수
*/
export const hasLatex = (text: string): boolean => {
// 블록 수식 ($$...$$) 또는 인라인 수식 ($...$) 패턴 확인
// 멀티라인을 고려하여 dotAll 플래그 사용
// 블록 수식 ($$...$$) 패턴 확인
const blockMathRegex = /\$\$[\s\S]*?\$\$/;
const inlineMathRegex = /(?<!\$)\$(?!\$)[^$\n]*\$(?!\$)/;

// 인라인 수식 ($...$) 패턴 확인
// 단, 달러 금액($250, $40 등)은 제외
// $ 바로 뒤에 숫자가 오는 경우는 LaTeX가 아닌 통화 기호로 간주
const inlineMathRegex = /(?<!\$)\$(?!\$)(?!\d)[^$\n]+\$(?!\$)/;

return blockMathRegex.test(text) || inlineMathRegex.test(text);
};
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export const normalizeTableSeparators = (text: string): string => {
.replace(/\uFF5C/g, '|') // | (FULLWIDTH VERTICAL LINE) → |
.replace(/|/g, '|') // | (FULLWIDTH VERTICAL LINE) → |
.replace(/│/g, '|') // │ (BOX DRAWINGS) → |
.replace(/\u007C/g, '|') // | (VERTICAL LINE, 정규화) → |
.replace(/\u01C0/g, '|') // ǀ (LATIN LETTER DENTAL CLICK) → |
.replace(/\u05C0/g, '|') // ׀ (HEBREW PUNCTUATION PASEQ) → |
.replace(/\u2758/g, '|') // ❘ (LIGHT VERTICAL BAR) → |
Expand Down