mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-02 15:10:21 +00:00
fix(line): preserve underscores inside words in stripMarkdown (#47465)
Fixes #46185. Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm test -- extensions/line/src/markdown-to-line.test.ts src/tts/prepare-text.test.ts Note: `pnpm check` currently fails on unchanged `extensions/microsoft/speech-provider.test.ts` lines 108 and 139 on the rebased base, outside this PR diff.
This commit is contained in:
@@ -9,7 +9,7 @@ export function stripMarkdown(text: string): string {
|
||||
result = result.replace(/__(.+?)__/g, "$1");
|
||||
|
||||
result = result.replace(/(?<!\*)\*(?!\*)(.+?)(?<!\*)\*(?!\*)/g, "$1");
|
||||
result = result.replace(/(?<!_)_(?!_)(.+?)(?<!_)_(?!_)/g, "$1");
|
||||
result = result.replace(/(?<![\p{L}\p{N}])_(?!_)(.+?)(?<!_)_(?![\p{L}\p{N}])/gu, "$1");
|
||||
|
||||
result = result.replace(/~~(.+?)~~/g, "$1");
|
||||
result = result.replace(/^#{1,6}\s+(.+)$/gm, "$1");
|
||||
|
||||
Reference in New Issue
Block a user