11 lines
284 B
JavaScript
11 lines
284 B
JavaScript
/** Strip markdown artifacts and normalize whitespace. Pure, no side effects. */
|
|
export function cleanText(str) {
|
|
if (!str) return "";
|
|
return str
|
|
.replace(/^#+\s*/gm, "")
|
|
.replace(/\*\*(.*?)\*\*/g, "$1")
|
|
.replace(/[*_`]/g, "")
|
|
.replace(/\s+/g, " ")
|
|
.trim();
|
|
}
|