Skip to content
This repository was archived by the owner on Mar 18, 2026. It is now read-only.

Commit 185ed8d

Browse files
committed
refactor: Remove normalization of non-standard pipe characters from MessageRenderer
1 parent 47db442 commit 185ed8d

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

src/app/_common/components/chatParser/ChatParser.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ import {
2525
findTodoDetailsBlocks
2626
} from '@/app/_common/components/chatParser/ChatParserTodoDetails';
2727
import {
28-
parseSimpleMarkdown,
29-
normalizeTableSeparators
28+
parseSimpleMarkdown
3029
} from '@/app/_common/components/chatParser/ChatParserMarkdown';
3130
import { parseCitation } from '@/app/_common/components/chatParser/ChatParserCite';
3231
import { convertToString, needsConversion } from '@/app/_common/components/chatParser/ChatParserNonStr';
@@ -91,9 +90,6 @@ export const MessageRenderer: React.FC<MessageRendererProps> = ({
9190
return null;
9291
}
9392

94-
// 비표준 파이프 문자를 표준 Markdown 파이프로 정규화
95-
processedContent = normalizeTableSeparators(processedContent);
96-
9793
if (isUserMessage) {
9894
return (
9995
<div className={`${styles.markdownContent} ${className}`}>

src/app/_common/components/chatParser/ChatParserLatex.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ export const findLatexBlocks = (text: string): LatexBlockInfo[] => {
139139

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

144145
let match;
145146
const allMatches: Array<{ start: number, end: number, content: string, isBlock: boolean }> = [];
@@ -421,10 +422,13 @@ export const processLatexInText = (
421422
* 텍스트에 LaTeX가 포함되어 있는지 확인하는 헬퍼 함수
422423
*/
423424
export const hasLatex = (text: string): boolean => {
424-
// 블록 수식 ($$...$$) 또는 인라인 수식 ($...$) 패턴 확인
425-
// 멀티라인을 고려하여 dotAll 플래그 사용
425+
// 블록 수식 ($$...$$) 패턴 확인
426426
const blockMathRegex = /\$\$[\s\S]*?\$\$/;
427-
const inlineMathRegex = /(?<!\$)\$(?!\$)[^$\n]*\$(?!\$)/;
427+
428+
// 인라인 수식 ($...$) 패턴 확인
429+
// 단, 달러 금액($250, $40 등)은 제외
430+
// $ 바로 뒤에 숫자가 오는 경우는 LaTeX가 아닌 통화 기호로 간주
431+
const inlineMathRegex = /(?<!\$)\$(?!\$)(?!\d)[^$\n]+\$(?!\$)/;
428432

429433
return blockMathRegex.test(text) || inlineMathRegex.test(text);
430434
};

src/app/_common/components/chatParser/ChatParserMarkdown.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ export const normalizeTableSeparators = (text: string): string => {
1717
.replace(/\uFF5C/g, '|') // | (FULLWIDTH VERTICAL LINE) → |
1818
.replace(//g, '|') // | (FULLWIDTH VERTICAL LINE) → |
1919
.replace(//g, '|') // │ (BOX DRAWINGS) → |
20-
.replace(/\u007C/g, '|') // | (VERTICAL LINE, 정규화) → |
2120
.replace(/\u01C0/g, '|') // ǀ (LATIN LETTER DENTAL CLICK) → |
2221
.replace(/\u05C0/g, '|') // ׀ (HEBREW PUNCTUATION PASEQ) → |
2322
.replace(/\u2758/g, '|') // ❘ (LIGHT VERTICAL BAR) → |

0 commit comments

Comments
 (0)