8 lines
230 B
TypeScript
8 lines
230 B
TypeScript
export function nl2br(text: string): string {
|
|
return text.replace(/(?:\r\n|\r|\n)/g, "<br>");
|
|
}
|
|
|
|
export function flattenHTMLParagraphs(html: string): string {
|
|
return html.replace("</p><p>", "<br />").replace(/<?\/p>/g, "");
|
|
}
|