fix: ensure newlines around think tags for proper markdown rendering

- Fix markdown rendering issues when think content directly connects with markdown content
pull/20594/head
xuzijie1995 12 months ago
parent d6b30efe2c
commit 6f58b08461

@ -33,5 +33,6 @@ export const preprocessThinkTag = (content: string) => {
return flow([
(str: string) => str.replace(thinkOpenTagRegex, '<details data-think=true>\n'),
(str: string) => str.replace(thinkCloseTagRegex, '\n[ENDTHINKFLAG]</details>'),
(str: string) => str.replace(/(<\/details>)(?![^\S\r\n]*[\r\n])(?![^\S\r\n]*$)/g, '$1\n'),
])(content)
}

Loading…
Cancel
Save