Skip to content
This repository was archived by the owner on Oct 30, 2025. It is now read-only.

Commit 7d9521f

Browse files
authored
Revert "markdown: normalize ordered list markers"
1 parent 70598ff commit 7d9521f

File tree

1 file changed

+1
-21
lines changed

1 file changed

+1
-21
lines changed

frontend/components/design-system-components/MessageMarkdown.tsx

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -280,25 +280,6 @@ const markdownComponents: any = {
280280
}
281281
} as const
282282

283-
// Normalize ordered list markers so that lines starting with "1) " are
284-
// converted to the CommonMark style "1. ". This helps react-markdown parse
285-
// them as ordered lists. We avoid transforming content inside fenced code blocks.
286-
const normalizeOrderedListMarkers = (markdown: string) => {
287-
let inCodeFence = false
288-
const fenceRegex = /^\s*```/
289-
return markdown
290-
.split('\n')
291-
.map(line => {
292-
if (fenceRegex.test(line)) {
293-
inCodeFence = !inCodeFence
294-
return line
295-
}
296-
if (inCodeFence) return line
297-
return line.replace(/^(\s*)(\d+)\)\s+/, '$1$2. ')
298-
})
299-
.join('\n')
300-
}
301-
302283
const MessageMarkdown = ({
303284
children,
304285
className,
@@ -310,7 +291,6 @@ const MessageMarkdown = ({
310291
allowHtml?: boolean
311292
textSize?: MarkdownTextSize
312293
}) => {
313-
const normalizedChildren = normalizeOrderedListMarkers(children)
314294
return (
315295
<MarkdownContext.Provider value={textSize}>
316296
<MemoizedReactMarkdown
@@ -327,7 +307,7 @@ const MessageMarkdown = ({
327307
}
328308
components={markdownComponents}
329309
>
330-
{normalizedChildren}
310+
{children}
331311
</MemoizedReactMarkdown>
332312
</MarkdownContext.Provider>
333313
)

0 commit comments

Comments
 (0)