storkit: merge 427_story_server_side_text_normalization_for_chat_message_line_breaks
This commit is contained in:
@@ -55,6 +55,9 @@ pub fn chunk_for_whatsapp(text: &str) -> Vec<String> {
|
||||
/// This function converts common Markdown constructs so messages render
|
||||
/// nicely in WhatsApp instead of showing raw Markdown syntax.
|
||||
pub fn markdown_to_whatsapp(text: &str) -> String {
|
||||
let normalized = crate::chat::util::normalize_line_breaks(text);
|
||||
let text = normalized.as_str();
|
||||
|
||||
// Regexes are compiled once and reused across calls.
|
||||
static RE_FENCED_BLOCK: LazyLock<Regex> =
|
||||
LazyLock::new(|| Regex::new(r"(?ms)^```.*?\n(.*?)^```").unwrap());
|
||||
|
||||
Reference in New Issue
Block a user